This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
export type DataSourceMode = 'static' | 'api' | 'sdk'
|
||||
export type GuideContentDataSourceMode = 'static' | 'remote' | 'mock'
|
||||
export type ConfiguredAudioLanguage = 'zh-CN' | 'yue-HK' | 'en-US'
|
||||
|
||||
const allowedModes = new Set<DataSourceMode>(['static', 'api', 'sdk'])
|
||||
const allowedGuideContentModes = new Set<GuideContentDataSourceMode>(['static', 'remote', 'mock'])
|
||||
@@ -27,6 +28,11 @@ const normalizeGuideContentMode = (mode: string | undefined): GuideContentDataSo
|
||||
return 'static'
|
||||
}
|
||||
|
||||
const normalizeAudioLanguage = (language: string | undefined): ConfiguredAudioLanguage => {
|
||||
if (language === 'en-US' || language === 'yue-HK') return language
|
||||
return 'zh-CN'
|
||||
}
|
||||
|
||||
const normalizeBoolean = (value: string | undefined) => (
|
||||
['1', 'true', 'yes', 'on'].includes(value?.trim().toLowerCase() || '')
|
||||
)
|
||||
@@ -74,7 +80,7 @@ export const dataSourceConfig = {
|
||||
defaultAudioApiBaseUrl
|
||||
),
|
||||
apiBaseUrl: normalizeUrl(import.meta.env.VITE_API_BASE_URL, defaultApiBaseUrl),
|
||||
audioLanguage: import.meta.env.VITE_AUDIO_LANGUAGE === 'en-US' ? 'en-US' : 'zh-CN',
|
||||
audioLanguage: normalizeAudioLanguage(import.meta.env.VITE_AUDIO_LANGUAGE),
|
||||
sgsApiBaseUrl: normalizeUrl(
|
||||
import.meta.env.VITE_SGS_API_BASE_URL || import.meta.env.VITE_API_BASE_URL,
|
||||
defaultApiBaseUrl
|
||||
|
||||
Reference in New Issue
Block a user