add wizard flag

This commit is contained in:
jxxghp
2025-09-09 13:50:11 +08:00
parent b201e9ab8c
commit 3b5d4982b5
4 changed files with 14 additions and 2 deletions
+6
View File
@@ -8,8 +8,10 @@ from app import schemas
from app.chain.user import UserChain from app.chain.user import UserChain
from app.core import security from app.core import security
from app.core.config import settings from app.core.config import settings
from app.db.systemconfig_oper import SystemConfigOper
from app.helper.sites import SitesHelper # noqa from app.helper.sites import SitesHelper # noqa
from app.helper.wallpaper import WallpaperHelper from app.helper.wallpaper import WallpaperHelper
from app.schemas.types import SystemConfigKey
router = APIRouter() router = APIRouter()
@@ -29,7 +31,10 @@ def login_access_token(
if not success: if not success:
raise HTTPException(status_code=401, detail=user_or_message) raise HTTPException(status_code=401, detail=user_or_message)
# 用户等级
level = SitesHelper().auth_level level = SitesHelper().auth_level
# 是否显示配置向导
show_wizard = not SystemConfigOper().get(SystemConfigKey.SetupWizardState) and not settings.ADVANCED_MODE
return schemas.Token( return schemas.Token(
access_token=security.create_access_token( access_token=security.create_access_token(
userid=user_or_message.id, userid=user_or_message.id,
@@ -45,6 +50,7 @@ def login_access_token(
avatar=user_or_message.avatar, avatar=user_or_message.avatar,
level=level, level=level,
permissions=user_or_message.permissions or {}, permissions=user_or_message.permissions or {},
widzard=show_wizard
) )
+2
View File
@@ -75,6 +75,8 @@ class ConfigModel(BaseModel):
DEBUG: bool = False DEBUG: bool = False
# 是否开发模式 # 是否开发模式
DEV: bool = False DEV: bool = False
# 高级设置模式
ADVANCED_MODE: bool = True
# ==================== 安全认证配置 ==================== # ==================== 安全认证配置 ====================
# 密钥 # 密钥
+2
View File
@@ -20,6 +20,8 @@ class Token(BaseModel):
level: int = 1 level: int = 1
# 详细权限 # 详细权限
permissions: Optional[dict] = Field(default_factory=dict) permissions: Optional[dict] = Field(default_factory=dict)
# 是否显示配置向导
widzard: Optional[bool] = None
class TokenPayload(BaseModel): class TokenPayload(BaseModel):
+4 -2
View File
@@ -175,8 +175,6 @@ class SystemConfigKey(Enum):
UserCustomCSS = "UserCustomCSS" UserCustomCSS = "UserCustomCSS"
# 用户已安装的插件 # 用户已安装的插件
UserInstalledPlugins = "UserInstalledPlugins" UserInstalledPlugins = "UserInstalledPlugins"
# 插件安装统计
PluginInstallReport = "PluginInstallReport"
# 插件文件夹分组配置 # 插件文件夹分组配置
PluginFolders = "PluginFolders" PluginFolders = "PluginFolders"
# 默认电影订阅规则 # 默认电影订阅规则
@@ -193,6 +191,10 @@ class SystemConfigKey(Enum):
NotificationTemplates = "NotificationTemplates" NotificationTemplates = "NotificationTemplates"
# 刮削开关设置 # 刮削开关设置
ScrapingSwitchs = "ScrapingSwitchs" ScrapingSwitchs = "ScrapingSwitchs"
# 插件安装统计
PluginInstallReport = "PluginInstallReport"
# 配置向导状态
SetupWizardState = "SetupWizardState"
# 处理进度Key字典 # 处理进度Key字典