Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-03-02 23:56:37 +08:00
parent 3e118f2474
commit 498441c4c9
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 4 additions and 4 deletions

View file

@ -581,9 +581,9 @@
})
// 用于授权页保持连接,避免非常驻内存内核自动退出 https://github.com/siyuan-note/insider/issues/1099
const ws = new WebSocket((window.location.protocol === 'https:' ? 'wss' : 'ws') + '://' + window.location.host + '/ws?app=siyuan&id=auth')
const ws = new WebSocket((window.location.protocol === 'https:' ? 'wss' : 'ws') + '://' + window.location.host + '/ws?app=siyuan' + Math.random().toString(36).substring(8) + '&id=auth&type=auth')
ws.onmessage = (event) => {
const data = processMessage(JSON.parse(event.data));
const data = JSON.parse(event.data);
if (data.cmd === "loginAuth") {
window.location.href = toPath
}

View file

@ -153,7 +153,7 @@ func LoginAuth(c *gin.Context) {
return
}
util.BroadcastByType("main", "loginAuth", 0, "", nil)
util.BroadcastByType("auth", "loginAuth", 0, "", nil)
}
func GetCaptcha(c *gin.Context) {

View file

@ -727,7 +727,7 @@ func serveWebSocket(ginServer *gin.Engine) {
if !authOk {
// 用于授权页保持连接,避免非常驻内存内核自动退出 https://github.com/siyuan-note/insider/issues/1099
authOk = strings.Contains(s.Request.RequestURI, "/ws?app=siyuan&id=auth")
authOk = strings.Contains(s.Request.RequestURI, "/ws?app=siyuan") && strings.Contains(s.Request.RequestURI, "&id=auth&type=auth")
}
if !authOk {