fix: image proxy logic

This commit is contained in:
shinya
2025-07-15 22:28:01 +08:00
parent 90129c0d69
commit af03f9f149

View File

@@ -13,12 +13,14 @@ export function getImageProxyUrl(): string | null {
if (enableImageProxy !== null) {
if (!JSON.parse(enableImageProxy) as boolean) {
return null;
} else {
// 启用,直接返回本地配置
return localStorage.getItem('imageProxyUrl')?.trim() || null;
}
}
const localImageProxy = localStorage.getItem('imageProxyUrl');
if (localImageProxy != null) {
return localImageProxy.trim() ? localImageProxy.trim() : null;
}
// 如果未设置,则使用全局对象
const serverImageProxy = (window as any).RUNTIME_CONFIG?.IMAGE_PROXY;
return serverImageProxy && serverImageProxy.trim()