diff --git a/frontend-vue/public/logo.jpg b/frontend-vue/public/logo.jpg new file mode 100644 index 00000000..ab825d78 Binary files /dev/null and b/frontend-vue/public/logo.jpg differ diff --git a/frontend-vue/src/pages/brand/components/BrandBrandTab.vue b/frontend-vue/src/pages/brand/components/BrandBrandTab.vue index 06fad2db..d1fd23be 100644 --- a/frontend-vue/src/pages/brand/components/BrandBrandTab.vue +++ b/frontend-vue/src/pages/brand/components/BrandBrandTab.vue @@ -148,8 +148,9 @@ const runMode = ref<'immediate' | 'queue'>('immediate') const submitting = ref(false) const tasks = ref([]) -// 品牌检测由桌面客户端本地执行:以"文件夹选择"桥(Web 降级桥不提供)判定桌面运行时,浏览器下仅可预览 -const hasBridge = computed(() => Boolean(getPywebviewApi()?.select_brand_folder)) +// 品牌检测已服务端化(/api/brand/* 走域名):浏览器降级桥提供文件选择,Web 端可用; +// 文件夹选择/模板桥等降级桥未实现的方法在点击时提示"仅桌面端" +const hasBridge = computed(() => Boolean(getPywebviewApi())) const hasUid = computed(() => { const raw = typeof window === 'undefined' ? '' : window.localStorage.getItem('uid') || '' const numeric = Number(raw.trim()) diff --git a/frontend-vue/src/pages/home/DesktopHomePage.vue b/frontend-vue/src/pages/home/DesktopHomePage.vue index e1753129..6892bd8d 100644 --- a/frontend-vue/src/pages/home/DesktopHomePage.vue +++ b/frontend-vue/src/pages/home/DesktopHomePage.vue @@ -76,10 +76,10 @@ diff --git a/frontend-vue/src/pages/image/ImageWorkbenchPage.vue b/frontend-vue/src/pages/image/ImageWorkbenchPage.vue new file mode 100644 index 00000000..0e3148e0 --- /dev/null +++ b/frontend-vue/src/pages/image/ImageWorkbenchPage.vue @@ -0,0 +1,1519 @@ + + + diff --git a/frontend-vue/src/shared/api/http.ts b/frontend-vue/src/shared/api/http.ts index 2193fe25..94f264bf 100644 --- a/frontend-vue/src/shared/api/http.ts +++ b/frontend-vue/src/shared/api/http.ts @@ -60,6 +60,17 @@ function createHttpClient(): AxiosInstance { }) instance.interceptors.request.use((config: InternalAxiosRequestConfig) => { + // 携带本地登录令牌:桌面端同源 cookie 仍可用;dev(5173) 无 cookie 时靠 Bearer 过 Java 鉴权 + try { + if (config.url && config.url.indexOf('/newApi') === 0 && typeof window !== 'undefined') { + const token = window.localStorage.getItem('aiimage_auth_token') || '' + if (token) { + config.headers.Authorization = `Bearer ${token}` + } + } + } catch { + /* 忽略读取令牌异常 */ + } return config }) diff --git a/frontend-vue/src/shared/bridges/pywebview.ts b/frontend-vue/src/shared/bridges/pywebview.ts index 57e7df09..a50efb69 100644 --- a/frontend-vue/src/shared/bridges/pywebview.ts +++ b/frontend-vue/src/shared/bridges/pywebview.ts @@ -1,6 +1,5 @@ -import { ref } from 'vue'; - import { webFallbackApi } from './web-fallback'; +import { isDesktopRuntime } from '@/shared/runtime-env'; export interface UploadedJavaFile { fileKey: string; @@ -122,6 +121,8 @@ export interface PywebviewApi { not_found?: boolean; error?: string; }>; + /** 版本更新(桌面专属):下载更新包并启动 update.exe 后退出主程序(原 Flask /api/update/do 桥化) */ + do_update_app?: (fileUrl: string) => Promise<{ success: boolean; error?: string }>; launch_yaoayanui?: () => Promise<{ success: boolean; path?: string; @@ -197,8 +198,8 @@ declare global { let cachedPywebviewApi: PywebviewApi | undefined; let pywebviewReadyBound = false; -/** 当前是否运行在桌面客户端(pywebview)运行时;Web 独立部署下恒为 false */ -export const isDesktopRuntime = ref(false); +/** 当前是否运行在桌面客户端(pywebview)运行时;Web 独立部署下恒为 false(见 runtime-env.ts 注释) */ +export { isDesktopRuntime }; function syncPywebviewApi() { cachedPywebviewApi = window.pywebview?.api; diff --git a/frontend-vue/src/shared/runtime-env.ts b/frontend-vue/src/shared/runtime-env.ts new file mode 100644 index 00000000..02a5a27c --- /dev/null +++ b/frontend-vue/src/shared/runtime-env.ts @@ -0,0 +1,14 @@ +/** + * 桌面运行时环境标志 + * + * 独立模块避免共享模块之间循环依赖(pywebview.ts 写入、各页面读取)。 + * 桌面客户端窗口加载 Web 版 URL 后 pywebview 桥注入完成即置 true; + * 初始为 false,页面在 pywebviewready 之后的交互/挂载阶段读取时已为 true。 + * + * 注意:前端 URL 已全部统一走 https+域名(品牌检测/图片生成已服务端化), + * 本地不再有任何 Flask API 回连,无需 LOCAL_API_BASE。 + */ +import { ref } from 'vue' + +/** 桌面客户端(pywebview 桥已注入)运行时标志;Web 独立部署下恒为 false */ +export const isDesktopRuntime = ref(false) diff --git a/frontend-vue/vite.config.ts b/frontend-vue/vite.config.ts index cb25a116..e7b9678a 100644 --- a/frontend-vue/vite.config.ts +++ b/frontend-vue/vite.config.ts @@ -71,13 +71,15 @@ export default defineConfig({ 'variant-collection': resolve(__dirname, 'variant-collection.html'), brand: resolve(__dirname, 'brand.html'), 'image-video': resolve(__dirname, 'image-video.html'), + image: resolve(__dirname, 'image.html'), 'amazon-console': resolve(__dirname, 'amazon-console.html'), home: resolve(__dirname, 'home.html'), login: resolve(__dirname, 'login.html'), }, output: { - entryFileNames: (chunkInfo) => - chunkInfo.name === 'image-video' ? 'assets/[name]-[hash].js' : 'assets/[name].js', + // 入口文件同样带内容 hash:/assets/ 静态服务配了 immutable 长缓存, + // 无 hash 的入口文件会导致前端更新对用户永不生效(旧文件名被永久缓存) + entryFileNames: 'assets/[name]-[hash].js', chunkFileNames: 'assets/[name]-[hash].js', assetFileNames: 'assets/[name]-[hash][extname]', },