mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-07 23:18:38 +08:00
header
This commit is contained in:
@@ -5,9 +5,13 @@ import { Platform } from 'react-native';
|
||||
* Native 端直接返回原 URL(App 请求头由 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://');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user