Add legacy skin and cape routes, improve error handling

Introduces legacy routes for Minecraft skins and capes to support older endpoints. Enhances error handling in sessionsRepository for missing skins/capes, adds getActiveSkin and getActiveCape to sessionsService, and improves error logging in server.js.
This commit is contained in:
2025-12-29 22:02:52 +01:00
parent 80fb6c6cd4
commit 9b36c85974
8 changed files with 82 additions and 3 deletions

View File

@@ -69,9 +69,14 @@ async function getActiveSkin(uuid) {
`
const rows = await database.query(sql, [uuid])
const skin = rows[0]
if (!skin) {
throw new DefaultError(404, "Not found", "Not found")
}
return { code: 200, data: skin || null }
} catch (error) {
if (error instanceof DefaultError) {
throw error
}
logger.log("Internal Server Error".bold + " : " + error.toString(), ["MariaDB", "yellow"])
throw new DefaultError(500, "Internal Server Error", "Please contact an administrator.")
}
@@ -87,9 +92,14 @@ async function getActiveCape(uuid) {
`
const rows = await database.query(sql, [uuid])
const cape = rows[0]
if (!cape) {
throw new DefaultError(404, "Not found", "Not found")
}
return { code: 200, data: cape || null }
} catch (error) {
if (error instanceof DefaultError) {
throw error
}
logger.log("Internal Server Error".bold + " : " + error.toString(), ["MariaDB", "yellow"])
throw new DefaultError(500, "Internal Server Error", "Please contact an administrator.")
}