This commit is contained in:
@@ -22,8 +22,30 @@ const configuredLegacyAudioHosts = () => [
|
||||
...defaultLegacyAudioHosts
|
||||
].filter(Boolean)
|
||||
|
||||
const resolveSdkMinioProxyBaseUrl = () => {
|
||||
const apiBaseUrl = dataSourceConfig.apiBaseUrl.trim().replace(/\/+$/, '')
|
||||
const normalizedApiBaseUrl = apiBaseUrl.endsWith('/app-api')
|
||||
? apiBaseUrl
|
||||
: `${apiBaseUrl}/app-api`
|
||||
return `${normalizedApiBaseUrl}/gis/sdk/minio`
|
||||
}
|
||||
|
||||
const toSdkMinioProxyUrl = (assetPath: string) => `${resolveSdkMinioProxyBaseUrl()}${assetPath}`
|
||||
|
||||
export const normalizeSameOriginPublicUrl = (url: string | null | undefined) => {
|
||||
const value = url?.trim()
|
||||
|
||||
// The SDK proxy is public and provides the same disk and HTTP cache used by
|
||||
// the kiosk client. Guide images and audio should use it instead of bypassing
|
||||
// the cache through the MinIO public endpoint.
|
||||
if (value?.startsWith('/minio/museum-assets/')) {
|
||||
return toSdkMinioProxyUrl(value.replace(/^\/minio/, ''))
|
||||
}
|
||||
|
||||
if (value?.startsWith('/museum-assets/') || value?.startsWith('/tts-audio/')) {
|
||||
return toSdkMinioProxyUrl(value)
|
||||
}
|
||||
|
||||
if (!value || !isAbsoluteHttpUrl(value)) return value || ''
|
||||
|
||||
try {
|
||||
@@ -38,7 +60,7 @@ export const normalizeSameOriginPublicUrl = (url: string | null | undefined) =>
|
||||
|| parsed.pathname.startsWith('/tts-audio/')
|
||||
)
|
||||
) {
|
||||
return `${parsed.pathname}${parsed.search}${parsed.hash}`
|
||||
return toSdkMinioProxyUrl(`${parsed.pathname}${parsed.search}${parsed.hash}`)
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user