This commit is contained in:
2026-07-11 11:05:19 +08:00
parent d2a30c58ca
commit f5f4be2986
10 changed files with 5 additions and 450 deletions
-13
View File
@@ -66,12 +66,6 @@ export async function apiRequest<T>(path: string, options: RequestOptions = {}):
if (token) headers['Authorization'] = `Bearer ${token}`;
}
// 开发者访问令牌(网站关闭时用于绕过限制)
const devAccessToken = localStorage.getItem('dev_access_token');
if (devAccessToken) {
headers['X-Dev-Access'] = devAccessToken;
}
let bodyStr: string | undefined;
if (body !== undefined) {
const json = JSON.stringify(body);
@@ -116,13 +110,6 @@ export async function apiRequest<T>(path: string, options: RequestOptions = {}):
// Handle error responses
if (!res.ok) {
// 网站关闭 → 跳转到维护页面
if (res.status === 503 && parsed?.detail?.code === 'SITE_CLOSED') {
if (!window.location.pathname.startsWith('/maintenance')) {
window.location.href = '/maintenance';
}
throw new Error(parsed?.detail?.message || '系统正在升级维护');
}
let msg = parsed?.detail?.message || parsed?.message || `请求失败 (${res.status})`;
if (typeof parsed?.detail === 'string') {
msg = parsed.detail;
+1 -1
View File
@@ -290,7 +290,7 @@ export async function verifyCaptcha(captchaId: string, x: number): Promise<strin
return res.token;
}
// ── Site Info ─────────────────────────────────────────────
export async function getSiteInfo(): Promise<{ siteName: string; siteLogo: string; userAgreementPrivacyUrl: string; siteCopyright: string; operationManual: string; siteEnabled: boolean }> {
export async function getSiteInfo(): Promise<{ siteName: string; siteLogo: string; userAgreementPrivacyUrl: string; siteCopyright: string; operationManual: string }> {
if (USE_MOCK) return { siteName: 'VideoGen.AI', siteLogo: '', userAgreementPrivacyUrl: '', siteCopyright: '© 2024 民众智创 版权所有', operationManual: '' };
return api.get('/auth/site-info', false);
}