From 209aa4a86502956aa7a83d85f5039d78b6da26eb Mon Sep 17 00:00:00 2001 From: yuyx <237899745@qq.com> Date: Thu, 27 Nov 2025 23:25:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E5=81=8F=E5=A5=BD=E5=88=B7=E6=96=B0=E5=90=8E=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原因:authMiddleware 中的 req.user 对象没有包含 theme_preference 字段, 导致 /api/user/theme 接口始终返回 undefined,用户设置的主题无法被正确读取。 修复:在 req.user 中添加 theme_preference 字段 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- backend/auth.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/auth.js b/backend/auth.js index 1fe9fb6..f363372 100644 --- a/backend/auth.js +++ b/backend/auth.js @@ -102,7 +102,9 @@ function authMiddleware(req, res, next) { storage_permission: user.storage_permission || 'sftp_only', current_storage_type: user.current_storage_type || 'sftp', local_storage_quota: user.local_storage_quota || 1073741824, - local_storage_used: user.local_storage_used || 0 + local_storage_used: user.local_storage_used || 0, + // 主题偏好 + theme_preference: user.theme_preference || null }; next();