chore: 统一本地服务器与远程仓库源码
- 合并 main 与 master 历史并以服务器结构为基线 - 保留迁移、数据保留、AWS 账单与部署安全能力 - 建立 SDD 规格和 CI 验证闭环
This commit is contained in:
commit
fd60361d93
460 files changed
+37492
-23871
No files matched your search
@@ -53,8 +53,10 @@ function resolveApiUrl(path: string): string {
|
||||
export function getWsBase(): string {
|
||||
const envBase = import.meta.env.VITE_API_BASE_URL;
|
||||
if (envBase) {
|
||||
const origin = String(envBase).replace(/\/$/, '').replace(/\/api\/v1$/, '');
|
||||
return origin.replace(/^http/, 'ws');
|
||||
const apiUrl = new URL(String(envBase), window.location.origin);
|
||||
apiUrl.protocol = apiUrl.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
apiUrl.pathname = apiUrl.pathname.replace(/\/$/, '').replace(/\/api\/v1$/, '');
|
||||
return apiUrl.toString().replace(/\/$/, '');
|
||||
}
|
||||
const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
return `${proto}//${window.location.host}`;
|
||||
@@ -101,14 +103,14 @@ async function request<T = any>(
|
||||
clearToken();
|
||||
useUserStore.getState().logout();
|
||||
window.location.href = '/login';
|
||||
throw new Error(i18n.t('common.request.tokenExpired'));
|
||||
throw new Error(i18n.t('common.requestts.sd3ab821c'));
|
||||
}
|
||||
|
||||
let json: ApiResponse<T>;
|
||||
try {
|
||||
json = await response.json();
|
||||
} catch {
|
||||
throw new Error(`HTTP ${response.status}: ${i18n.t('common.responseParseError')}`);
|
||||
throw new Error(`HTTP ${response.status}: 响应解析失败`);
|
||||
}
|
||||
|
||||
if (!response.ok || (json.code && json.code !== 200)) {
|
||||
@@ -191,4 +193,4 @@ export const http = {
|
||||
},
|
||||
};
|
||||
|
||||
export default http;
|
||||
export default http;
|
||||
@@ -32,22 +32,22 @@ export interface ThemeGroup {
|
||||
|
||||
/** 主流主题 — 默认推荐 */
|
||||
const MAINSTREAM_THEMES: ThemeOption[] = [
|
||||
{ id: 'system', name: i18n.t('common.lightDark'), description: i18n.t('theme.system'), isDark: false, primaryColor: 'linear-gradient(135deg, #2563eb 50%, #0d1117 50%)' },
|
||||
{ id: 'ocean-deep', name: i18n.t('theme.deepBlue'), description: i18n.t('theme.deepBlue'), isDark: true, primaryColor: '#0d1117' },
|
||||
{ id: 'light-professional', name: i18n.t('theme.brightWhite'), description: i18n.t('theme.brightWhiteDesc'), isDark: false, primaryColor: '#2563eb' },
|
||||
{ id: 'system', name: i18n.t('common.lightDark'), description: i18n.t('common.themets.s17d84295'), isDark: false, primaryColor: 'linear-gradient(135deg, #2563eb 50%, #0d1117 50%)' },
|
||||
{ id: 'ocean-deep', name: i18n.t('common.themets.s2f82cbb2'), description: i18n.t('common.themets.s29ee972b'), isDark: true, primaryColor: '#0d1117' },
|
||||
{ id: 'light-professional', name: i18n.t('common.themets.s2d43cc04'), description: i18n.t('common.themets.s37e76182'), isDark: false, primaryColor: '#2563eb' },
|
||||
];
|
||||
|
||||
/** 开发者主题 — 高辨识度扩展 */
|
||||
const DEVELOPER_THEMES: ThemeOption[] = [
|
||||
{ id: 'one-dark', name: 'One Dark', description: i18n.t('theme.oneDarkDesc'), isDark: true, primaryColor: '#c678dd' },
|
||||
{ id: 'dracula', name: 'Dracula', description: i18n.t('theme.draculaDesc'), isDark: true, primaryColor: '#bd93f9' },
|
||||
{ id: 'tokyo-night', name: 'Tokyo Night', description: i18n.t('theme.tokyoNightDesc'), isDark: true, primaryColor: '#7aa2f7' },
|
||||
{ id: 'catppuccin', name: 'Catppuccin', description: i18n.t('theme.catppuccinDesc'), isDark: true, primaryColor: '#89b4fa' },
|
||||
{ id: 'one-dark', name: 'One Dark', description: i18n.t('common.themets.s02b08e05'), isDark: true, primaryColor: '#c678dd' },
|
||||
{ id: 'dracula', name: 'Dracula', description: i18n.t('common.themets.s525ce260'), isDark: true, primaryColor: '#bd93f9' },
|
||||
{ id: 'tokyo-night', name: 'Tokyo Night', description: i18n.t('common.themets.s6f40fb5e'), isDark: true, primaryColor: '#7aa2f7' },
|
||||
{ id: 'catppuccin', name: 'Catppuccin', description: i18n.t('common.themets.s571aa09d'), isDark: true, primaryColor: '#89b4fa' },
|
||||
];
|
||||
|
||||
export const THEME_GROUPS: ThemeGroup[] = [
|
||||
{ label: i18n.t('theme.mainstream'), options: MAINSTREAM_THEMES },
|
||||
{ label: i18n.t('theme.developer'), options: DEVELOPER_THEMES },
|
||||
{ label: i18n.t('common.themets.s8392cae7'), options: MAINSTREAM_THEMES },
|
||||
{ label: i18n.t('common.themets.sc2e48855'), options: DEVELOPER_THEMES },
|
||||
];
|
||||
|
||||
export const THEME_OPTIONS: ThemeOption[] = [
|
||||
|
||||
Reference in new issue
Block a user