title: auto

des: auto
note:auto
This commit is contained in:
2023-10-03 11:00:16 +08:00
parent ab1bb590bf
commit fa46a3f055
7 changed files with 30 additions and 34 deletions

View File

@@ -92,6 +92,7 @@ export default function Validasi() {
color="green"
onClick={() => {
onValid();
// myConsole("ok")
}}
>
Submit

View File

@@ -5,12 +5,18 @@ import { getConfig } from "@/bin/config";
import { unsealData } from "iron-session";
import { cookies } from "next/headers";
import fs from "fs";
import yaml from "yaml";
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
export async function getToken() {
const c = cookies().get("ssn");
const token = await unsealData(c?.value as string, {
password: (await getConfig()).server.password,
password: await config.server.password,
});
return token
const data = JSON.parse(token as any)
return data;
}

View File

@@ -30,7 +30,7 @@ export default function HomeView() {
return (
<>
<pre>{JSON.stringify(token, null, 2)}</pre>
{/* <pre>{JSON.stringify(token, null, 2)}</pre> */}
<Title>Home</Title>
<Text>Welcome, {token?.username}</Text>
<Logout />