mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-17 11:02:06 +00:00
feat(pokedex): add shareable read-only dex links
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { loadSharedPokedex } from '$lib/services/SharedPokedexService';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load: PageServerLoad = async ({ locals, params, url, setHeaders }) => {
|
||||
const shared = await loadSharedPokedex(locals.supabase, params.token);
|
||||
if (!shared) throw error(404, 'Shared Pokédex not found');
|
||||
setHeaders({
|
||||
'Referrer-Policy': 'no-referrer',
|
||||
'X-Robots-Tag': 'noindex, nofollow'
|
||||
});
|
||||
|
||||
const canonicalUrl = `${url.origin}/shared/${params.token}`;
|
||||
return {
|
||||
shared,
|
||||
canonicalUrl,
|
||||
previewUrl: `${canonicalUrl}/preview.png`
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user