🐛 浏览器端开启访问鉴权后文档更新未保存 Fix https://github.com/siyuan-note/siyuan/issues/5096

This commit is contained in:
Liang Ding 2022-07-06 22:13:49 +08:00
parent dce2ddca6a
commit 8b0f3d70d9
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 16 additions and 5 deletions

View file

@ -140,6 +140,12 @@ func CheckAuth(c *gin.Context) {
if session.AccessAuthCode != Conf.AccessAuthCode {
userAgentHeader := c.GetHeader("User-Agent")
if strings.HasPrefix(userAgentHeader, "SiYuan/") || strings.HasPrefix(userAgentHeader, "Mozilla/") {
if "GET" != c.Request.Method {
c.JSON(401, map[string]interface{}{"code": -1, "msg": Conf.Language(156)})
c.Abort()
return
}
c.Redirect(302, "/check-auth")
c.Abort()
return