From 98a98198d322c969c145a92878f18fcc9d653b8a Mon Sep 17 00:00:00 2001 From: kicer Date: Fri, 4 Sep 2026 08:36:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E6=88=B7=E9=A1=B5=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E7=9A=84=20/api/system/status=20=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=EF=BC=9A=E7=94=A8=20/api/me=20=E7=9A=84=20404=20?= =?UTF-8?q?=E5=88=A4=E5=AE=9A=E6=9C=AA=E5=90=AF=E7=94=A8=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/server/public/index.html | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/server/public/index.html b/app/server/public/index.html index c3fb852..3784496 100644 --- a/app/server/public/index.html +++ b/app/server/public/index.html @@ -1987,20 +1987,22 @@ setTitle('账户'); setActions(''); setBody('
加载中…
'); + // 单个 /api/me 即可判认证开关:启用认证时中间件保证已登录,user 必有; + // 未启用时 createAuth 提前返回,该路由不存在 → 404。无需再拉 /api/system/status + let me; try { - const [st, me] = await Promise.all([ - req('GET', '/api/system/status'), - req('GET', '/api/me').catch(function () { return { user: null }; }), // 未启用认证时无此路由 - ]); - if (!ctx()) return; - if (!st.auth_enabled || !me || !me.user) { - setBody('
未启用登录认证,无账户设置。
'); - return; - } - setBody('
' + userCardHtml(me.user) + '
'); + me = await req('GET', '/api/me'); } catch (e) { - if (ctx()) setBody('
加载失败:' + esc(e.message) + '
'); + if (ctx()) setBody('
' + + (e.status === 404 ? '未启用登录认证,无账户设置。' : '加载失败:' + esc(e.message)) + '
'); + return; } + if (!ctx()) return; + if (!me || !me.user) { + setBody('
未启用登录认证,无账户设置。
'); + return; + } + setBody('
' + userCardHtml(me.user) + '
'); } async function changePassword() { try {