diff options
Diffstat (limited to 'src/client/app/common/scripts')
| -rw-r--r-- | src/client/app/common/scripts/get-static-image-url.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/client/app/common/scripts/get-static-image-url.ts b/src/client/app/common/scripts/get-static-image-url.ts new file mode 100644 index 0000000000..f84adf709c --- /dev/null +++ b/src/client/app/common/scripts/get-static-image-url.ts @@ -0,0 +1,9 @@ +import { url as instanceUrl } from '../../config'; + +export function getStaticImageUrl(url: string): string { + const u = new URL(url); + const dummy = `${u.host}${u.pathname}`; // 拡張子がないとキャッシュしてくれないCDNがあるので + let result = `${instanceUrl}/proxy/${dummy}?url=${encodeURIComponent(u.href)}`; + result += '&static=1'; + return result; +} |