web: add a 404 page & generic 404 error redirector
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
Run tests / check lockfile correctness (push) Waiting to run
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run

This commit is contained in:
wukko 2025-06-03 11:06:24 +06:00
parent 58209970ac
commit 779cd54a68
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2
3 changed files with 27 additions and 17 deletions

View File

@ -0,0 +1,18 @@
<script lang="ts">
import { onMount } from "svelte";
import { page } from "$app/state";
import { goto } from "$app/navigation";
import { defaultNavPage } from "$lib/subnav";
onMount(() => {
if (page.error?.message === "Not Found") {
if (page.url.pathname.startsWith("/settings")) {
goto(defaultNavPage("settings"), { replaceState: true });
} else if (page.url.pathname.startsWith("/about")) {
goto(defaultNavPage("about"), { replaceState: true });
} else {
goto("/", { replaceState: true });
}
}
});
</script>

View File

@ -1,18 +1,5 @@
<script lang="ts">
import { onMount } from "svelte";
import { page } from "$app/stores";
import { goto } from "$app/navigation";
import { defaultNavPage } from "$lib/subnav";
onMount(() => {
if ($page.error?.message === "Not Found") {
if ($page.url.pathname.startsWith("/settings")) {
goto(defaultNavPage("settings"), { replaceState: true });
} else if ($page.url.pathname.startsWith("/about")) {
goto(defaultNavPage("about"), { replaceState: true });
} else {
goto("/", { replaceState: true });
}
}
});
<script>
import ErrorRedirector from "$components/misc/ErrorRedirector.svelte";
</script>
<ErrorRedirector />

View File

@ -0,0 +1,5 @@
<script>
import ErrorRedirector from "$components/misc/ErrorRedirector.svelte";
</script>
<ErrorRedirector />