From 6c5d5a3ef234239f7169bd9a31483863f97114e3 Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Tue, 3 Dec 2024 13:04:30 -0500 Subject: [PATCH 1/2] Redirect old note permalinks to embeds --- .../documents/[id]/annotations/[note_id]/+page.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/routes/(app)/documents/[id]/annotations/[note_id]/+page.ts diff --git a/src/routes/(app)/documents/[id]/annotations/[note_id]/+page.ts b/src/routes/(app)/documents/[id]/annotations/[note_id]/+page.ts new file mode 100644 index 000000000..3174414f1 --- /dev/null +++ b/src/routes/(app)/documents/[id]/annotations/[note_id]/+page.ts @@ -0,0 +1,13 @@ +import { redirect } from "@sveltejs/kit"; + +import { EMBED_URL } from "@/config/config.js"; + +// redirect to embed route +export function load({ url }) { + const u = new URL(url); + + u.searchParams.set("embed", "1"); + u.hostname = EMBED_URL; + + return redirect(302, u); +} From 5147167396ff220f94b3df82a4778a7e1cbc9aed Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Tue, 3 Dec 2024 13:11:34 -0500 Subject: [PATCH 2/2] Redirect page endpoints to embed --- .../(app)/documents/[id]/pages/[page]/+page.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/routes/(app)/documents/[id]/pages/[page]/+page.ts diff --git a/src/routes/(app)/documents/[id]/pages/[page]/+page.ts b/src/routes/(app)/documents/[id]/pages/[page]/+page.ts new file mode 100644 index 000000000..3174414f1 --- /dev/null +++ b/src/routes/(app)/documents/[id]/pages/[page]/+page.ts @@ -0,0 +1,13 @@ +import { redirect } from "@sveltejs/kit"; + +import { EMBED_URL } from "@/config/config.js"; + +// redirect to embed route +export function load({ url }) { + const u = new URL(url); + + u.searchParams.set("embed", "1"); + u.hostname = EMBED_URL; + + return redirect(302, u); +}