This commit is contained in:
Developer
2026-03-12 21:21:01 +08:00
parent 9347c8752d
commit a55bcd46ea
6 changed files with 300 additions and 69 deletions

View File

@@ -5,9 +5,13 @@ import { Platform } from 'react-native';
* Native 端直接返回原 URLApp 请求头由 axios 拦截器统一设置)。
*/
export function proxyImageUrl(url: string): string {
if (Platform.OS !== 'web' || !url) return url;
return url.replace(
/^https?:\/\/([a-z0-9]+\.hdslb\.com)/,
'http://localhost:3001/bilibili-img/$1',
);
if (!url) return url;
if (Platform.OS === 'web') {
return url.replace(
/^https?:\/\/([a-z0-9]+\.hdslb\.com)/,
'http://localhost:3001/bilibili-img/$1',
);
}
// Native: force HTTPS so Release APK doesn't block cleartext HTTP
return url.replace(/^http:\/\//, 'https://');
}