title: auto
des: auto note:auto
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user