mirror of
https://git.sr.ht/~roxwize/mipilin
synced 2025-05-10 23:33:07 +00:00
i dont really know what i added
Signed-off-by: roxwize <rae@roxwize.xyz>
This commit is contained in:
parent
e3c09d7f0d
commit
7b563f5c31
24 changed files with 797 additions and 151 deletions
|
@ -4,6 +4,21 @@ import { updates } from "../db/schema.js";
|
|||
import { desc, eq } from "drizzle-orm";
|
||||
import fs from "node:fs/promises";
|
||||
|
||||
const nonceChars =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_";
|
||||
let nonce: string;
|
||||
export function setNonce() {
|
||||
nonce = "";
|
||||
for (let i = 0; i < 32; i++)
|
||||
nonce += nonceChars[Math.floor(Math.random() * nonceChars.length)];
|
||||
return nonce;
|
||||
}
|
||||
export function getNonce() {
|
||||
if (!nonce)
|
||||
throw new Error("Nonce doesn't exist");
|
||||
return nonce;
|
||||
}
|
||||
|
||||
let moods: string[], moodsSorted: string[];
|
||||
export async function getMoods() {
|
||||
if (!moods)
|
||||
|
@ -42,7 +57,8 @@ export async function render(
|
|||
session: req.session,
|
||||
flashes: req.flash(),
|
||||
moods,
|
||||
currentMood
|
||||
currentMood,
|
||||
nonce
|
||||
};
|
||||
res.render(page, { ...o, ...stuff });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue