mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-17 23:48:45 +00:00
클라이언트 승인 대기 페이지 구현
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user