fix: update push setting prompts

This commit is contained in:
JustSong
2022-11-25 11:11:15 +08:00
parent 5c8f6cbed0
commit d9362cb7d0
3 changed files with 25 additions and 50 deletions

View File

@@ -1,16 +1,12 @@
package controller
import (
"crypto/sha1"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"message-pusher/common"
"message-pusher/model"
"net/http"
"sort"
"strings"
)
func GetStatus(c *gin.Context) {
@@ -171,23 +167,3 @@ func ResetPassword(c *gin.Context) {
})
return
}
func WeChatTestAccountVerification(c *gin.Context) {
user := model.User{Username: c.Param("username")}
user.FillUserByUsername()
// https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html
signature := c.Query("signature")
timestamp := c.Query("timestamp")
nonce := c.Query("nonce")
echoStr := c.Query("echostr")
arr := []string{user.WeChatTestAccountVerificationToken, timestamp, nonce}
sort.Strings(arr)
str := strings.Join(arr, "")
hash := sha1.Sum([]byte(str))
hexStr := hex.EncodeToString(hash[:])
if signature == hexStr {
c.String(http.StatusOK, echoStr)
} else {
c.Status(http.StatusForbidden)
}
}

View File

@@ -13,7 +13,6 @@ func SetApiRouter(router *gin.Engine) {
apiRouter.GET("/status", controller.GetStatus)
apiRouter.GET("/notice", controller.GetNotice)
apiRouter.GET("/about", controller.GetAbout)
apiRouter.GET("/wechat_test_account_verification/:username", controller.WeChatTestAccountVerification)
apiRouter.GET("/verification", middleware.CriticalRateLimit(), middleware.TurnstileCheck(), controller.SendEmailVerification)
apiRouter.GET("/reset_password", middleware.CriticalRateLimit(), middleware.TurnstileCheck(), controller.SendPasswordResetEmail)
apiRouter.POST("/user/reset", middleware.CriticalRateLimit(), controller.ResetPassword)

View File

@@ -19,7 +19,6 @@ const PushSetting = () => {
wechat_test_account_secret: '',
wechat_test_account_template_id: '',
wechat_test_account_open_id: '',
wechat_test_account_verification_token: '',
wechat_corp_account_id: '',
wechat_corp_account_agent_secret: '',
wechat_corp_account_agent_id: '',
@@ -81,8 +80,6 @@ const PushSetting = () => {
data.wechat_test_account_template_id =
inputs.wechat_test_account_template_id;
data.wechat_test_account_open_id = inputs.wechat_test_account_open_id;
data.wechat_test_account_verification_token =
inputs.wechat_test_account_verification_token;
break;
case 'corp':
data.wechat_corp_account_id = inputs.wechat_corp_account_id;
@@ -135,7 +132,9 @@ const PushSetting = () => {
<Grid.Column>
<Form loading={loading}>
<Header as='h3'>通用设置</Header>
<Message>注意密钥类配置信息不会发送到前端显示</Message>
<Message>
注意密钥类配置信息不会发送到前端显示另外浏览器可能会错误填充账户和密钥信息请留意
</Message>
<Form.Group widths={3}>
<Form.Select
label='默认推送方式'
@@ -186,10 +185,8 @@ const PushSetting = () => {
</Header.Subheader>
</Header>
<Message>
接口配置信息中的 URL 填写
<code>{`${window.location.origin}/api/wechat_test_account_verification/${inputs.username}`}</code>
<br />
Token 填一个随机字符串然后填入下方的接口配置验证 Token
需要新增测试模板模板标题推荐填写消息推送模板内容必须填写为
{' {{'}text.DATA{'}}'}
</Message>
<Form.Group widths={3}>
<Form.Input
@@ -225,16 +222,7 @@ const PushSetting = () => {
onChange={handleInputChange}
autoComplete='off'
value={inputs.wechat_test_account_open_id}
placeholder='测试号二维码 -> 用户列表 -> 微信号'
/>
<Form.Input
label='接口配置验证 Token'
name='wechat_test_account_verification_token'
onChange={handleInputChange}
autoComplete='off'
type='password'
value={inputs.wechat_test_account_verification_token}
placeholder='接口配置信息 -> Token'
placeholder='扫描测试号二维码 -> 用户列表 -> 微信号'
/>
</Form.Group>
<Button onClick={() => submit('test')} loading={loading}>
@@ -254,6 +242,15 @@ const PushSetting = () => {
</a>
</Header.Subheader>
</Header>
<Message>
注意企业微信要求配置可信 IP步骤应用管理 -> 自建 -> 创建应用 ->
应用设置页面下拉中找到企业可信 IP点击配置 -> 设置可信域名 ->
可调用
JS-SDK跳转小程序的可信域名下面填写一个域名然后点击申请校验域名根据提示完成校验
-> 之后填写服务器 IP 地址 IP
地址是消息推送服务所部署在的服务器的 IP
地址未必是上面校验域名中记录的 IP 地址
</Message>
<Form.Group widths={3}>
<Form.Input
label='企业 ID'
@@ -313,8 +310,8 @@ const PushSetting = () => {
<Header as='h3'>
飞书设置lark
<Header.Subheader>
通过飞书群机器人进行推送选择一个群聊 -> 设置 -> 群机器人 ->
添加机器人 -> 自定义机器人 -> 添加
通过飞书群机器人进行推送飞书桌面客户端的配置流程选择一个群聊
-> 设置 -> 群机器人 -> 添加机器人 -> 自定义机器人 -> 添加
<strong>注意选中签名校验</strong>
<a
target='_blank'
@@ -351,8 +348,9 @@ const PushSetting = () => {
<Header as='h3'>
钉钉设置ding
<Header.Subheader>
通过钉钉机器人进行推送选择一个群聊 -> 群设置 -> 智能群助手 ->
添加机器人点击右侧齿轮图标 -> 自定义 -> 添加
通过钉钉机器人进行推送钉钉桌面客户端的配置流程选择一个群聊 ->
群设置 -> 智能群助手 -> 添加机器人点击右侧齿轮图标 -> 自定义
-> 添加
<strong>注意选中加密</strong>
<a
target='_blank'
@@ -389,12 +387,14 @@ const PushSetting = () => {
<Header as='h3'>
Bark 设置bark
<Header.Subheader>
通过 Bark 进行推送下载 Bark 后按提示注册设备即可
通过 Bark 进行推送下载 Bark 后按提示注册设备之后会看到一个
URL例如 <code>https://api.day.app/wrsVSDRANDOM/Body Text</code>
其中 <code>wrsVSDRANDOM</code> key
</Header.Subheader>
</Header>
<Form.Group widths={2}>
<Form.Input
label='Bark 地址服务器地址'
label='服务器地址'
name='bark_server'
onChange={handleInputChange}
autoComplete='off'
@@ -402,7 +402,7 @@ const PushSetting = () => {
placeholder='在此填写 Bark 服务器地址'
/>
<Form.Input
label='签名校验密钥'
label='推送 key'
name='bark_secret'
type='password'
onChange={handleInputChange}