클라이언트 승인 대기 페이지 구현

This commit is contained in:
static
2024-12-31 21:58:13 +09:00
parent ccad4fbd8b
commit e5cbd46b35
13 changed files with 243 additions and 59 deletions

View File

@@ -2,18 +2,24 @@
import { onMount } from "svelte";
import { goto } from "$app/navigation";
import "../app.css";
import { prepareClientKeyStore } from "./services";
import { prepareClientKeyStore, prepareMasterKeyStore } from "./services";
let { children } = $props();
onMount(() => {
prepareClientKeyStore().then(async (ok) => {
if (!ok && !["/auth", "/key"].some((path) => location.pathname.startsWith(path))) {
await goto(
"/key/generate?redirect=" + encodeURIComponent(location.pathname + location.search),
);
onMount(async () => {
const redirect = async (url: string) => {
const whitelist = ["/auth", "/key", "/client/pending"];
if (!whitelist.some((path) => location.pathname.startsWith(path))) {
await goto(`${url}?redirect=${encodeURIComponent(location.pathname + location.search)}`);
}
});
};
if (!(await prepareClientKeyStore())) {
return await redirect("/key/generate");
}
if (!(await prepareMasterKeyStore())) {
return await redirect("/client/pending");
}
});
</script>