opt: 取消强制手机号验证,更新配置

This commit is contained in:
RockYang
2023-07-24 18:18:09 +08:00
parent 253951b4b3
commit ca8c8e6490
9 changed files with 54 additions and 25 deletions

View File

@@ -47,6 +47,10 @@ func (h *ChatHandler) ChatHandle(c *gin.Context) {
logger.Error(err)
return
}
// 设置读写超时时间
_ = ws.SetWriteDeadline(time.Now().Add(300 * time.Second))
_ = ws.SetReadDeadline(time.Now().Add(300 * time.Second))
sessionId := c.Query("session_id")
roleId := h.GetInt(c, "role_id", 0)
chatId := c.Query("chat_id")

View File

@@ -46,6 +46,7 @@ type CodeStats struct {
// Token 生成自验证 token
func (h *VerifyHandler) Token(c *gin.Context) {
// 如果不是通过浏览器访问,则返回错误的 token
// TODO: 引入验证码机制防刷机制
if c.GetHeader("Sec-Fetch-Mode") != "cors" {
token := fmt.Sprintf("%s:%d", utils.RandString(32), time.Now().Unix())
encrypt, err := utils.AesEncrypt(h.App.Config.AesEncryptKey, []byte(token))
@@ -109,7 +110,6 @@ func (h *VerifyHandler) SendMsg(c *gin.Context) {
var stat CodeStats
err = h.db.Get(MobileStatPrefix+data.Mobile, &stat)
if err != nil {
logger.Error(err)
stat = CodeStats{
Mobile: data.Mobile,
Count: 0,