mirror of
https://github.com/LukeHagar/sveltekit-og.git
synced 2025-12-08 20:57:45 +00:00
Cache All the time
This commit is contained in:
@@ -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
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user