fix: 移除统计&添加环境变量

This commit is contained in:
bietiaop
2025-01-24 21:44:12 +08:00
parent 8ec5a4d071
commit 86f6caa714
4 changed files with 48 additions and 35 deletions

1
napcat.webui/.env Normal file
View File

@@ -0,0 +1 @@
VITE_DEBUG_BACKEND_URL="http://127.0.0.1:6099"

View File

@@ -13,8 +13,6 @@
content="viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
name="viewport" />
<link href="/favicon.ico" rel="icon" />
<script defer src="https://umami.napneko.icu/script.js"
data-website-id="0502515d-e241-4191-9bd0-ce2a1c13f8fb"></script>
</head>
<body>

9
napcat.webui/vite-env.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_DEBUG_BACKEND_URL: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

View File

@@ -1,14 +1,19 @@
import react from '@vitejs/plugin-react'
import path from 'node:path'
import { defineConfig, normalizePath } from 'vite'
import { defineConfig, loadEnv, normalizePath } from 'vite'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import tsconfigPaths from 'vite-tsconfig-paths'
const monacoEditorPath = normalizePath(
path.resolve(__dirname, 'node_modules/monaco-editor/min/vs')
)
// https://vitejs.dev/config/
export default defineConfig({
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd())
const backendDebugUrl = env.VITE_DEBUG_BACKEND_URL
console.log('backendDebugUrl', backendDebugUrl)
return {
plugins: [
react(),
tsconfigPaths(),
@@ -24,8 +29,7 @@ export default defineConfig({
base: '/webui/',
server: {
proxy: {
'/api': 'http://192.168.30.10:6099'
// '/api': 'http://127.0.0.1:6099'
'/api': backendDebugUrl
}
},
build: {
@@ -44,4 +48,5 @@ export default defineConfig({
}
}
}
}
})