This commit is contained in:
eric
2026-03-13 04:41:51 -05:00
parent 37d0883ce9
commit a193fe4d45
22 changed files with 1119 additions and 468 deletions

View File

@@ -64,6 +64,7 @@ export interface ServicesConfig {
}
const isDev = process.env.NODE_ENV === "development";
const PAYJSAPI_PORT = process.env.PAYJSAPI_PORT || "8007";
/** 站点标识,用于 VIP 按站点隔离。digital 专题站ai.xx/android.xx各自独立如 digital_ai、digital_android */
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "digital";
@@ -71,6 +72,13 @@ export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "digital";
/** vip 站vip.hackrobot.cn的 site_id其付费 VIP 可解锁所有 digital 专题站 */
export const VIP_MASTER_SITE_ID = "vip";
export function getApiUrlFromRequest(hostHeader: string | null): string | null {
if (!hostHeader) return null;
if (!isDev) return process.env.PAYMENT_API_URL || DEFAULT_PAYMENT_API_URL;
const hostname = hostHeader.split(":")[0];
return `http://${hostname}:${PAYJSAPI_PORT}`;
}
/** 获取 PocketBase 配置(可传入主题覆盖) */
export function getPocketBaseConfig(themeOverride?: { joinCollection?: string }): PocketBaseConfig {
const joinCollection =