Add legacy authentication and session routes

Introduces legacy endpoints for login, joinserver, and checkserver, along with their input validation schemas. Updates sessionsService with joinLegacyServer to support legacy session handling. This enables compatibility with legacy clients requiring these authentication flows.
This commit is contained in:
2025-12-28 23:19:38 +01:00
parent e8f58e63cd
commit 3cd42103e5
7 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
const z = require("zod")
module.exports = {
GET: {
query: z.object({
user: z.string().min(1),
sessionId: z.string().min(1),
serverId: z.string().min(1)
})
}
}

View File

@@ -0,0 +1,10 @@
const z = require("zod")
module.exports = {
GET: {
query: z.object({
user: z.string().min(1),
serverId: z.string().min(1)
})
}
}

16
schemas/legacy/login.js Normal file
View File

@@ -0,0 +1,16 @@
const z = require("zod")
const loginShape = {
user: z.string().min(1, { message: "Username required" }),
password: z.string().min(1, { message: "Password required" }),
version: z.union([z.string(), z.number()]).optional()
}
module.exports = {
POST: {
body: z.object(loginShape),
},
GET: {
query: z.object(loginShape)
}
}