feat(caddy,stand,smoke): prod-like routing stand, api smoke, old ui fallback for unknown paths
This commit is contained in:
1 parent
c74dac3e00
commit
f6d76bb307
11 files changed
+271
-4
No files matched your search
@@ -0,0 +1,29 @@
|
||||
<script lang="ts">
|
||||
import { oldUiUrl } from "#lib/spa-paths.js";
|
||||
import { page } from "$app/state";
|
||||
|
||||
const NOT_FOUND = 404;
|
||||
|
||||
const missing = $derived(page.status === NOT_FOUND);
|
||||
|
||||
$effect(() => {
|
||||
if (missing) {
|
||||
location.replace(oldUiUrl(page.url.href));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if missing}
|
||||
<p class="p-6 text-cladd-fg-soft">Opening this page in the old interface</p>
|
||||
{:else}
|
||||
<div class="flex flex-col gap-2 p-6">
|
||||
<h1 class="font-semibold text-[18px]">Something went wrong</h1>
|
||||
<p class="text-cladd-fg-soft">{page.error?.message}</p>
|
||||
<a
|
||||
class="text-brand underline"
|
||||
data-sveltekit-reload
|
||||
href={oldUiUrl(page.url.href)}
|
||||
>Open this page in the old interface</a
|
||||
>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -43,10 +43,12 @@
|
||||
return;
|
||||
}
|
||||
lastHref = url.href;
|
||||
if (fromUrl?.start === start && fromUrl?.end === end) {
|
||||
const clean = !url.searchParams.has("ffui");
|
||||
if (clean && fromUrl?.start === start && fromUrl?.end === end) {
|
||||
return;
|
||||
}
|
||||
const next = new URL(url.href);
|
||||
next.searchParams.delete("ffui");
|
||||
next.searchParams.set("start", start);
|
||||
next.searchParams.set("end", end);
|
||||
lastHref = next.href;
|
||||
|
||||
Reference in new issue
Block a user