your personal website on atproto - mirror blento.app
25
fork

Configure Feed

Select the types of activity you want to include in your feed.

og images

Florian a9a642dc 12e5f7b9

+31 -1
+4
src/lib/helper.ts
··· 295 295 } 296 296 297 297 await Promise.all(promises); 298 + 299 + // Invalidate cached OG image so the next scrape regenerates it. 300 + // Fire-and-forget; server checks auth against the signed-cookie session. 301 + fetch(`/${data.did}/og-new.png`, { method: 'DELETE' }).catch(() => {}); 298 302 } 299 303 300 304 export function createEmptyCard(page: string) {
+27 -1
src/routes/[[actor=actor]]/og-new.png/+server.ts
··· 1 1 import { env } from '$env/dynamic/private'; 2 2 import { env as publicEnv } from '$env/dynamic/public'; 3 - import { error } from '@sveltejs/kit'; 3 + import { error, json } from '@sveltejs/kit'; 4 4 import { getActor } from '$lib/actor'; 5 5 import { createCache } from '$lib/cache'; 6 6 ··· 85 85 } 86 86 }); 87 87 } 88 + 89 + export async function DELETE({ params, platform, request, locals }) { 90 + if (!locals.did) { 91 + throw error(401, 'Not authenticated'); 92 + } 93 + 94 + const actor = await getActor({ 95 + request, 96 + paramActor: params.actor, 97 + platform, 98 + blockBoth: false 99 + }); 100 + 101 + if (!actor) { 102 + throw error(404, 'Page not found'); 103 + } 104 + 105 + if (actor !== locals.did) { 106 + throw error(403, 'Cannot invalidate another user\'s OG image'); 107 + } 108 + 109 + const cache = createCache(platform); 110 + await cache?.delete('og', actor); 111 + 112 + return json({ success: true }); 113 + }