Compare commits

...

5 Commits

Author SHA1 Message Date
Bas950
b6bad90919 chore: release v0.0.9 2024-09-13 14:33:34 +02:00
Bas950
ee21bb9dec chore: release v0.0.20 2024-09-13 14:31:39 +02:00
Bas950
6efac4fef1 feat: use scienceId 2024-09-13 14:31:27 +02:00
Bas950
93424793bd chore: release v0.0.19 2024-09-13 13:46:33 +02:00
Bas950
affcb6a0cf chore: add reason 2024-09-13 13:46:27 +02:00
4 changed files with 9 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "@premid/api-master",
"type": "module",
"version": "0.0.18",
"version": "0.0.20",
"private": true,
"description": "PreMiD's api master",
"license": "MPL-2.0",

View File

@@ -78,7 +78,7 @@ export async function clearOldSessions() {
async function deleteSession(session: { token: string; session: string }, key: string): Promise<string> {
const abortController = new AbortController();
const timeoutId = setTimeout(() => abortController.abort(), 5000); //* 5 second timeout
const timeoutId = setTimeout(() => abortController.abort("Timeout"), 5000); //* 5 second timeout
try {
const discord = new REST({ version: "10", authPrefix: "Bearer" });

View File

@@ -1,7 +1,7 @@
{
"name": "@premid/api-worker",
"type": "module",
"version": "0.0.8",
"version": "0.0.9",
"private": true,
"description": "PreMiD's api",
"license": "MPL-2.0",

View File

@@ -8,13 +8,17 @@ import { redis } from "../functions/createServer.js";
const schema = type({
token: "string.trim",
session: "string.trim",
version: "string.semver & string.trim",
scienceId: "string.trim",
});
export async function sessionKeepAlive(request: FastifyRequest, reply: FastifyReply) {
//* Get the 2 headers
//* Get the headers
const out = schema({
token: request.headers["x-token"],
session: request.headers["x-session"],
version: request.headers["x-version"] ?? "2.6.8",
scienceId: request.headers["x-science-id"] ?? request.headers["x-token"],
});
if (out instanceof type.errors)
@@ -25,7 +29,7 @@ export async function sessionKeepAlive(request: FastifyRequest, reply: FastifyRe
await redis.hset(
"pmd-api.sessions",
out.token,
out.scienceId,
JSON.stringify({
session: out.session,
token: out.token,