diff --git a/data/textures/alex.png b/data/textures/alex.png new file mode 100644 index 0000000..b643fe2 Binary files /dev/null and b/data/textures/alex.png differ diff --git a/data/textures/steve.png b/data/textures/steve.png new file mode 100644 index 0000000..2872120 Binary files /dev/null and b/data/textures/steve.png differ diff --git a/routes/sessionsserver/blockedservers.js b/routes/sessionserver/blockedservers.js similarity index 100% rename from routes/sessionsserver/blockedservers.js rename to routes/sessionserver/blockedservers.js diff --git a/routes/sessionsserver/session/minecraft/hasJoined.js b/routes/sessionserver/session/minecraft/hasJoined.js similarity index 100% rename from routes/sessionsserver/session/minecraft/hasJoined.js rename to routes/sessionserver/session/minecraft/hasJoined.js diff --git a/routes/sessionsserver/session/minecraft/join.js b/routes/sessionserver/session/minecraft/join.js similarity index 100% rename from routes/sessionsserver/session/minecraft/join.js rename to routes/sessionserver/session/minecraft/join.js diff --git a/routes/sessionsserver/session/minecraft/profile/[uuid].js b/routes/sessionserver/session/minecraft/profile/[uuid].js similarity index 100% rename from routes/sessionsserver/session/minecraft/profile/[uuid].js rename to routes/sessionserver/session/minecraft/profile/[uuid].js diff --git a/routes/textures/texture/[hash].js b/routes/textures/texture/[hash].js index df9d29b..09bf57c 100644 --- a/routes/textures/texture/[hash].js +++ b/routes/textures/texture/[hash].js @@ -9,12 +9,7 @@ const TEXTURES_DIR = path.join(process.cwd(), "data", "textures") router.get("/", async (req, res, next) => { try { const hash = req.params.hash - if (!/^[a-f0-9]{64}$/i.test(hash)) { - throw new DefaultError(404, "Texture not found") - } - - const subDir = hash.substring(0, 2) - const filePath = path.join(TEXTURES_DIR, subDir, hash) + const filePath = path.join(TEXTURES_DIR, hash) if (!fs.existsSync(filePath)) { throw new DefaultError(404, "Texture not found") } diff --git a/services/authService.js b/services/authService.js index 7ecfc6f..61e5966 100644 --- a/services/authService.js +++ b/services/authService.js @@ -56,7 +56,7 @@ async function authenticate({ identifier, password, clientToken, requireUser }) delete userResult.user.password - const $clientToken = uuidRegex.test(clientToken) ? clientToken : crypto.randomUUID() + const $clientToken = clientToken || crypto.randomUUID() const accessToken = jwt.sign({ uuid: userResult.user.uuid, username: userResult.user.username, @@ -120,7 +120,7 @@ async function refreshToken({ previousAccessToken, clientToken, requireUser }) { await authRepository.invalidateClientSession(previousAccessToken, clientToken) - const $clientToken = uuidRegex.test(clientToken) ? clientToken : crypto.randomUUID() + const $clientToken = clientToken || crypto.randomUUID() const newAccessToken = jwt.sign({ uuid: userResult.user.uuid, username: userResult.user.username, diff --git a/services/sessionsService.js b/services/sessionsService.js index 469a003..9a60ebd 100644 --- a/services/sessionsService.js +++ b/services/sessionsService.js @@ -73,12 +73,12 @@ async function getProfile({ uuid, unsigned = false }) { const hasValidCape = !!activeCape const skinNode = hasValidSkin ? { - url: (process.env.TEXTURES_ENDPOINTS || `http://localhost:${process.env.WEB_PORT}/textures/`) + activeSkin.url, + url: (process.env.TEXTURES_ENDPOINTS || `http://localhost:${process.env.WEB_PORT}/textures`) + activeSkin.url, metadata: activeSkin.variant === "SLIM" ? { model: "slim" } : undefined } : undefined const capeNode = hasValidCape ? { - url: (process.env.TEXTURES_ENDPOINTS || `http://localhost:${process.env.WEB_PORT}/textures/`) + activeCape.url + url: (process.env.TEXTURES_ENDPOINTS || `http://localhost:${process.env.WEB_PORT}/textures`) + activeCape.url } : undefined const texturesObject = { diff --git a/services/userService.js b/services/userService.js index bffe811..3943ead 100644 --- a/services/userService.js +++ b/services/userService.js @@ -459,7 +459,7 @@ async function uploadSkin(uuid, fileObject, variant) { await fs.writeFile(targetPath, buffer) const newTextureUuid = crypto.randomUUID() - const textureUrl = `/texture/${hash}` + const textureUrl = `texture/${hash}` await userRepository.createTexture(newTextureUuid, hash, 'SKIN', textureUrl, null) }