-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create user center slack and integrate with importer #230
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to update the README.
RedirectURI string | ||
AuthedUserID string | ||
|
||
Enabled bool // 用户是否启用的标记 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the comment
func (sc *SlackClient) AuthUser(code string) (info *UserInfo, err error) { | ||
clientID := sc.ClientID | ||
clientSecret := sc.ClientSecret | ||
redirectURI := fmt.Sprintf("%s/answer/api/v1/user-center/login/callback", "https://as.0vo.lol") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you can't write a fixed URL address, you can refer to the
incubator-answer-plugins/user-center-wecom/handler.go
Lines 55 to 64 in f10caf7
func (uc *UserCenter) GetRedirectURL(ctx *gin.Context) { | |
authorizeUrl := fmt.Sprintf("%s/answer/api/v1/user-center/login/callback", plugin.SiteURL()) | |
redirectURL := uc.Company.GetRedirectURL(authorizeUrl) | |
state := genNonce() | |
redirectURL = strings.ReplaceAll(redirectURL, "STATE", state) | |
ctx.JSON(http.StatusOK, NewRespBodyData(http.StatusOK, "success", map[string]string{ | |
"redirect_url": redirectURL, | |
"key": state, | |
})) | |
} |
} | ||
|
||
sc.Enabled = true | ||
// sc.AccessToken = tokenResp.AccessToken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it.
UIOptions: plugin.ConfigFieldUIOptions{ | ||
Text: syncNowLabel, | ||
Action: &plugin.UIOptionAction{ | ||
Url: "/answer/admin/api/slack/sync", // 修改为 Slack 的同步 URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment maybe out of date.
if uc.Config.AutoSync { | ||
uc.CronSyncData() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way it is currently handled here results in a new ticker being started to synchronise the data every time the configuration is updated as long as AutoSync
is true. On the one hand, we need to deal with the case where AutoSync
is false, and on the other hand, we need to deal with the case where we can't turn on more than one at the same time. I hope this is understandable.
other: 授权网址 | ||
description: | ||
other: 企业微信授权网址 | ||
corp_id: | ||
title: | ||
other: 企业 ID | ||
description: | ||
other: 企业微信企业ID | ||
corp_secret: | ||
title: | ||
other: 应用 Secret | ||
description: | ||
other: 企业微信应用程序密钥 | ||
agent_id: | ||
title: | ||
other: 应用 Agent ID | ||
description: | ||
other: 企业微信应用程序代理ID | ||
notification: | ||
label: | ||
other: 打开通知 | ||
title: | ||
other: 通知 | ||
description: | ||
other: 用户将在企业微信上收到通知。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some translations is out of date.
part1 := matches[0][1] | ||
part2 := matches[1][1] | ||
rawTags := strings.Split(matches[2][1], ",") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course in most cases there is no problem with taking [1] directly. But it's safer to judge the internal length.
OSPP project
/ask [Title][Context][Tag]
see issue151