fix:小组件- PUSH

This commit is contained in:
吕新雨
2026-02-03 17:43:58 +08:00
parent d742b398ef
commit c1c2c6197d
66 changed files with 4888 additions and 479 deletions

View File

@@ -0,0 +1,37 @@
import i18n from 'i18next';
import { httpJson } from '../utils/http';
export type LegalLinks = {
privacyPolicyUrl: string;
termsOfUseUrl: string;
resolvedLang: 'en' | 'tc';
};
export function buildAcceptLanguage(): 'en' | 'tc' {
const lang = (i18n.language || '').trim();
const lower = lang.toLowerCase();
// 当前多语言仅支持 EN / TC与 reco 链路一致);其他语言统一回退到 en
if (lower.startsWith('zh')) {
return 'tc';
}
if (lower.includes('tc') || lower.includes('hant') || lower.includes('hk') || lower.includes('mo') || lower.includes('tw')) {
return 'tc';
}
return 'en';
}
export async function fetchLegalLinks(): Promise<LegalLinks> {
const headers: Record<string, string> = {
'Accept-Language': buildAcceptLanguage(),
};
return await httpJson<LegalLinks>({
path: '/v1/legal/links',
method: 'GET',
headers,
timeoutMs: 8_000,
debugLabel: 'LegalLinks',
});
}