fix: 修复 Vite allow list 错误

This commit is contained in:
CHE LIANG ZHAO
2026-01-26 16:24:39 +08:00
parent ab9aab7beb
commit ef34a1bb5d
4 changed files with 14 additions and 6 deletions

3
web/src/app.d.ts vendored
View File

@@ -8,6 +8,9 @@ declare global {
// interface PageState {} // interface PageState {}
// interface Platform {} // interface Platform {}
} }
// Vite 注入的全局变量
const __APP_VERSION__: string;
} }
export {}; export {};

View File

@@ -1,3 +0,0 @@
// 版本号配置
// 更新版本时需要手动修改此文件
export const VERSION = '1.3.0';

View File

@@ -27,8 +27,8 @@
import Sparkles from '@lucide/svelte/icons/sparkles'; import Sparkles from '@lucide/svelte/icons/sparkles';
import Info from '@lucide/svelte/icons/info'; import Info from '@lucide/svelte/icons/info';
// 版本号 // 版本号(从 Vite 编译时注入)
import { VERSION } from '$lib/version'; const appVersion = __APP_VERSION__;
// Theme // Theme
import { import {
@@ -248,7 +248,7 @@
title="查看更新日志" title="查看更新日志"
> >
<Info class="size-4" /> <Info class="size-4" />
<span class="text-xs">v{VERSION}</span> <span class="text-xs">v{appVersion}</span>
</button> </button>
{/snippet} {/snippet}
</Sidebar.MenuButton> </Sidebar.MenuButton>

View File

@@ -2,10 +2,18 @@ import { defineConfig } from 'vitest/config';
import { playwright } from '@vitest/browser-playwright'; import { playwright } from '@vitest/browser-playwright';
import { sveltekit } from '@sveltejs/kit/vite'; import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite'; import tailwindcss from '@tailwindcss/vite';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf-8'));
export default defineConfig({ export default defineConfig({
plugins: [sveltekit(), tailwindcss()], plugins: [sveltekit(), tailwindcss()],
define: {
__APP_VERSION__: JSON.stringify(pkg.version)
},
server: { server: {
proxy: { proxy: {
'/api': { '/api': {