fix(player): login footer layout, lang switcher z-index, profile.settings i18n; dev Vite proxy reads API PORT

This commit is contained in:
2026-06-23 14:41:15 +08:00
parent 9cef985974
commit 0c5541fc57
9 changed files with 108 additions and 52 deletions

View File

@@ -0,0 +1,19 @@
import { existsSync, readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
/** 本地 dev与 apps/api/.env 的 PORT 对齐,供 player/admin Vite 代理使用 */
export function resolveApiDevTarget() {
if (process.env.VITE_DEV_API_TARGET) return process.env.VITE_DEV_API_TARGET;
if (process.env.API_DEV_TARGET) return process.env.API_DEV_TARGET;
let port = '3000';
const envPath = resolve(repoRoot, 'apps/api/.env');
if (existsSync(envPath)) {
const match = readFileSync(envPath, 'utf8').match(/^PORT=(\d+)\s*$/m);
if (match) port = match[1];
}
return `http://localhost:${port}`;
}