addition of new dashboard

This commit is contained in:
2026-08-20 15:08:32 +00:00
parent 0622018d95
commit bf59249ed7
161 changed files with 13170 additions and 119 deletions

28
backend/http/refresh.js Normal file
View File

@@ -0,0 +1,28 @@
import { getPool } from "../db/index.js";
import { getNewKey, getUser } from "./auth.js";
export async function refresh(req, res) {
try {
const client = await getPool();
const apiKey = getNewKey(req.user);
await client.query(`
UPDATE public.auth SET
api_key = $1
WHERE user_id = $2
AND app_id = (
SELECT id FROM public.app WHERE type = $3
);
`, [
apiKey,
req.user.id,
req.query.app,
]);
const user = await getUser(client, req.user.issuer, req.user.identifier);
req.session.passport.user = user;
} catch (e) {
console.error(e);
} finally {
res.redirect('/dashboard');
}
}