Cache All the time

This commit is contained in:
Shivam Meena
2022-10-31 01:02:38 +05:30
parent 54a10b8484
commit c434d745e2

View File

@@ -3,7 +3,6 @@ import satori from 'satori';
import { Resvg, initWasm } from '@resvg/resvg-wasm'; import { Resvg, initWasm } from '@resvg/resvg-wasm';
import type { SatoriOptions } from 'satori'; import type { SatoriOptions } from 'satori';
import type { SvelteComponent } from 'svelte'; import type { SvelteComponent } from 'svelte';
import { dev } from '$app/environment';
const resSvgWasm = initWasm(fetch('https://sveltekit-og.ethercorps.io/resvg.wasm')); const resSvgWasm = initWasm(fetch('https://sveltekit-og.ethercorps.io/resvg.wasm'));
const fontFile = await fetch('https://sveltekit-og.ethercorps.io/noto-sans.ttf'); const fontFile = await fetch('https://sveltekit-og.ethercorps.io/noto-sans.ttf');
@@ -36,9 +35,7 @@ class ImageResponse {
return new Response(png, { return new Response(png, {
headers: { headers: {
'Content-Type': 'image/png', 'Content-Type': 'image/png',
'cache-control': dev 'cache-control': 'public, immutable, no-transform, max-age=31536000',
? 'no-cache, no-store'
: 'public, immutable, no-transform, max-age=31536000',
...options.headers ...options.headers
}, },