Fix route path and UUID formatting in session service
Changed route definitions in index.js from "" to "/" for correct routing. Updated sessionsService.js to add dashes to UUID before querying user data, ensuring proper UUID formatting.
This commit is contained in:
parent
947192d997
commit
80fb6c6cd4
@ -4,14 +4,14 @@ const utils = require("../modules/utils")
|
||||
const serverService = require("../services/serverService")
|
||||
|
||||
if (utils.isTrueFromDotEnv("SUPPORT_AUTHLIB_INJECTOR")) {
|
||||
router.get("", (req, res) => {
|
||||
router.get("/", (req, res) => {
|
||||
const hostname = req.hostname
|
||||
const metadata = serverService.getServerMetadata(hostname)
|
||||
res.header("X-Authlib-Injector-Date", new Date().toISOString())
|
||||
return res.status(200).json(metadata)
|
||||
})
|
||||
} else {
|
||||
router.get("", (req, res, next) => next())
|
||||
router.get("/", (req, res, next) => next())
|
||||
}
|
||||
|
||||
module.exports = router
|
||||
@ -44,9 +44,9 @@ async function getBlockedServers() {
|
||||
}
|
||||
|
||||
async function getProfile({ uuid, unsigned = false }) {
|
||||
let userResult
|
||||
let userResult, $uuid = utils.addDashesToUUID(uuid)
|
||||
try {
|
||||
userResult = await authRepository.getUser(uuid, false)
|
||||
userResult = await authRepository.getUser($uuid, false)
|
||||
} catch (error) {
|
||||
if (error.code === 404) {
|
||||
return { code: 204, message: "User not found" }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user