refactor(env, i18n, http): 更新环境配置与错误提示信息

修改 .env.example,简化 API 配置说明并明确生产环境要求。更新多语言错误提示,确保用户在未启用 API 代理时获得清晰反馈。重构 admin-http.ts,优化 API 基础 URL 的解析逻辑,提升代码可维护性。
This commit is contained in:
2026-05-29 11:48:13 +08:00
parent d90ca3c66b
commit 671c737781
10 changed files with 123 additions and 54 deletions

View File

@@ -2,21 +2,12 @@ import type { NextConfig } from "next";
import { parseAllowedDevOrigins } from "./src/lib/next-dev-origins";
const apiBaseUrl = process.env.API_BASE_URL?.trim() || "http://127.0.0.1:8000";
const allowedDevOrigins = parseAllowedDevOrigins(process.env.ALLOWED_DEV_ORIGINS);
const nextConfig: NextConfig = {
/* config options here */
...(allowedDevOrigins.length > 0 ? { allowedDevOrigins } : {}),
reactCompiler: true,
async rewrites() {
return [
{
source: "/api/:path*",
destination: `${apiBaseUrl}/api/:path*`,
},
];
},
async redirects() {
return [
{