Merge pull request #461 from Materialious/fix/proxy-channel-banner
Minor fixes to proxying
This commit is contained in:
@@ -171,7 +171,15 @@ export function proxyVideoUrl(source: string): string {
|
||||
}
|
||||
|
||||
export function proxyGoogleImage(source: string): string {
|
||||
return `${get(instanceStore)}/ggpht${new URL(source).pathname}`;
|
||||
|
||||
let path: string | undefined;
|
||||
try {
|
||||
path = new URL(source).pathname;
|
||||
} catch { }
|
||||
|
||||
if (typeof path === 'undefined') return '';
|
||||
|
||||
return `${get(instanceStore)}/ggpht${path}`;
|
||||
}
|
||||
|
||||
export function unsafeRandomItem(array: any[]): any {
|
||||
|
||||
@@ -79,7 +79,11 @@
|
||||
|
||||
<div class="padding">
|
||||
{#if data.channel.authorBanners.length > 0}
|
||||
<img src={data.channel.authorBanners[0].url} width="100%" alt="Channel banner" />
|
||||
<img
|
||||
src={proxyGoogleImage(data.channel.authorBanners[0].url)}
|
||||
width="100%"
|
||||
alt="Channel banner"
|
||||
/>
|
||||
{/if}
|
||||
<div class="description">
|
||||
<img
|
||||
|
||||
Reference in New Issue
Block a user