54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
declare const TARO_APP_API: string
|
||
declare const TARO_APP_TARGET: string
|
||
declare const TARO_APP_COMMUNITY_API: string
|
||
declare const TARO_APP_GATEWAY: string
|
||
|
||
export const APP_TARGET =
|
||
typeof TARO_APP_TARGET !== 'undefined' ? String(TARO_APP_TARGET) : 'weapp'
|
||
|
||
const isH5 = APP_TARGET === 'h5'
|
||
|
||
/**
|
||
* 电子书 / 虚拟支付主 API(对齐 ebook/wemini → https://api.nomadro.cn)
|
||
* H5 走同源 /ebook-api 代理,避免浏览器 CORS
|
||
*/
|
||
export const API_BASE = isH5
|
||
? '/ebook-api'
|
||
: typeof TARO_APP_API !== 'undefined' && TARO_APP_API
|
||
? String(TARO_APP_API).replace(/\/$/, '')
|
||
: 'https://api.nomadro.cn'
|
||
|
||
/**
|
||
* 社群 FastAPI(对齐 nomadweb/wemini)
|
||
* H5 走同源 /community-api 代理
|
||
*/
|
||
export const COMMUNITY_API_BASE = isH5
|
||
? '/community-api'
|
||
: typeof TARO_APP_COMMUNITY_API !== 'undefined' && TARO_APP_COMMUNITY_API
|
||
? String(TARO_APP_COMMUNITY_API).replace(/\/$/, '')
|
||
: 'https://nomadweb.nomadro.com/api/v1'
|
||
|
||
/**
|
||
* 统一网关(VIP 等,默认与电子书同域或 apps/api)
|
||
*/
|
||
export const GATEWAY_API_BASE = isH5
|
||
? '/ebook-api'
|
||
: typeof TARO_APP_GATEWAY !== 'undefined' && TARO_APP_GATEWAY
|
||
? String(TARO_APP_GATEWAY).replace(/\/$/, '')
|
||
: API_BASE
|
||
|
||
/** 与 ebook/wemini 共用,避免双 token */
|
||
export const STORAGE_TOKEN = 'nomadro_token'
|
||
export const STORAGE_OPENID = 'nomadro_openid'
|
||
|
||
export const WEB_BASE = 'https://nomadro.cn'
|
||
/**
|
||
* 抖音 request 合法域名 + 有效 TLS(nomadro.cn 证书主机名不匹配,真机必挂)
|
||
* 开发者工具不校验证书所以看似正常。
|
||
*/
|
||
export const TT_CONFIG_BASES = [
|
||
'https://api.nomadro.cn',
|
||
'https://dyapi.nomadro.cn',
|
||
] as const
|
||
export const WX_APPID = 'wx11f6afc44ea1532f'
|