feat(web): 桌面端前端 Web 独立部署适配——浏览器降级桥+登录态引导+页面动态修正

- 新增 web-fallback.ts:无 pywebview 时以浏览器能力降级(文件选择/上传/模板下载/配置),
  其余桌面能力(enqueue_json/vc_*/folder 选择等)保持 undefined 交由页面既有请在本地客户端中打开提示
- 新增 ensure-auth.ts:无 uid 时经 /newApi/check_login 恢复登录态,无 token/失效跳登录页;
  21 个入口 main.ts 挂载前先引导(桌面端已注入 uid 时零开销)
- pywebview.ts:getPywebviewApi() 在纯浏览器环境返回降级桥;新增 isDesktopRuntime 标志
  (首页更新面板/退出链接据此区分桌面与 Web);hasPywebview 语义修正为真实桥判定
- 登录页跳转、首页登出链接、品牌检测页 hasBridge 判定(select_brand_folder 存在性)适配 Web
This commit is contained in:
2026-09-07 16:35:19 +08:00
parent c5982dd900
commit 30b8c910e8
28 changed files with 424 additions and 32 deletions
@@ -53,6 +53,7 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { resolvePageHref } from '@/shared/page-prefix'
const AUTH_TOKEN_KEY = 'aiimage_auth_token'
const DEVICE_ID_KEY = 'aiimage_device_id'
@@ -185,7 +186,8 @@ async function submitLogin() {
/* cookie 同步失败不阻塞跳转(页面仍可读 localStorage */
}
clearAppPermissionCaches()
window.location.href = isDesktopClient() ? '/home' : '/home.html'
// 桌面端走 Flask /homeWeb 独立部署(路径含 /new_web_source)与 dev 走 resolvePageHref 归一
window.location.href = isDesktopClient() ? '/home' : resolvePageHref('/new_web_source/home.html')
} catch {
errorMessage.value = '网络异常,请稍后重试'
} finally {