From da8ab9d488710886e9c6d82bcfbfdc9d89879a91 Mon Sep 17 00:00:00 2001 From: azures04 Date: Tue, 30 Dec 2025 13:41:19 +0100 Subject: [PATCH] Refactor API and schema paths, fix key usage and profile data Renamed 'mojangapi' directories to 'api' for both routes and schemas to standardize API structure. Updated serverService to use the correct public key (profilePropertyKeys) for server metadata. Fixed sessionsService to return full skin and cape data arrays instead of just the first element. --- .../minecraft/profile/lookup/bulk/byname.js | 0 routes/{mojangapi => api}/profile/lookup/name/[username].js | 0 routes/{mojangapi => api}/profiles/minecraft.js | 0 routes/{mojangapi => api}/user/profiles/[uuid]/names.js | 0 .../users/profiles/minecraft/[username].js | 0 .../minecraft/profile/lookup/bulk/byname.js | 0 .../{mojangapi => api}/profile/lookup/name/[username].js | 0 schemas/{mojangapi => api}/profiles/minecraft.js | 0 schemas/{mojangapi => api}/user/profiles/[uuid]/names.js | 0 .../users/profiles/minecraft/[username].js | 0 server.js | 2 +- services/serverService.js | 6 +++--- services/sessionsService.js | 6 +++--- 13 files changed, 7 insertions(+), 7 deletions(-) rename routes/{mojangapi => api}/minecraft/profile/lookup/bulk/byname.js (100%) rename routes/{mojangapi => api}/profile/lookup/name/[username].js (100%) rename routes/{mojangapi => api}/profiles/minecraft.js (100%) rename routes/{mojangapi => api}/user/profiles/[uuid]/names.js (100%) rename routes/{mojangapi => api}/users/profiles/minecraft/[username].js (100%) rename schemas/{mojangapi => api}/minecraft/profile/lookup/bulk/byname.js (100%) rename schemas/{mojangapi => api}/profile/lookup/name/[username].js (100%) rename schemas/{mojangapi => api}/profiles/minecraft.js (100%) rename schemas/{mojangapi => api}/user/profiles/[uuid]/names.js (100%) rename schemas/{mojangapi => api}/users/profiles/minecraft/[username].js (100%) diff --git a/routes/mojangapi/minecraft/profile/lookup/bulk/byname.js b/routes/api/minecraft/profile/lookup/bulk/byname.js similarity index 100% rename from routes/mojangapi/minecraft/profile/lookup/bulk/byname.js rename to routes/api/minecraft/profile/lookup/bulk/byname.js diff --git a/routes/mojangapi/profile/lookup/name/[username].js b/routes/api/profile/lookup/name/[username].js similarity index 100% rename from routes/mojangapi/profile/lookup/name/[username].js rename to routes/api/profile/lookup/name/[username].js diff --git a/routes/mojangapi/profiles/minecraft.js b/routes/api/profiles/minecraft.js similarity index 100% rename from routes/mojangapi/profiles/minecraft.js rename to routes/api/profiles/minecraft.js diff --git a/routes/mojangapi/user/profiles/[uuid]/names.js b/routes/api/user/profiles/[uuid]/names.js similarity index 100% rename from routes/mojangapi/user/profiles/[uuid]/names.js rename to routes/api/user/profiles/[uuid]/names.js diff --git a/routes/mojangapi/users/profiles/minecraft/[username].js b/routes/api/users/profiles/minecraft/[username].js similarity index 100% rename from routes/mojangapi/users/profiles/minecraft/[username].js rename to routes/api/users/profiles/minecraft/[username].js diff --git a/schemas/mojangapi/minecraft/profile/lookup/bulk/byname.js b/schemas/api/minecraft/profile/lookup/bulk/byname.js similarity index 100% rename from schemas/mojangapi/minecraft/profile/lookup/bulk/byname.js rename to schemas/api/minecraft/profile/lookup/bulk/byname.js diff --git a/schemas/mojangapi/profile/lookup/name/[username].js b/schemas/api/profile/lookup/name/[username].js similarity index 100% rename from schemas/mojangapi/profile/lookup/name/[username].js rename to schemas/api/profile/lookup/name/[username].js diff --git a/schemas/mojangapi/profiles/minecraft.js b/schemas/api/profiles/minecraft.js similarity index 100% rename from schemas/mojangapi/profiles/minecraft.js rename to schemas/api/profiles/minecraft.js diff --git a/schemas/mojangapi/user/profiles/[uuid]/names.js b/schemas/api/user/profiles/[uuid]/names.js similarity index 100% rename from schemas/mojangapi/user/profiles/[uuid]/names.js rename to schemas/api/user/profiles/[uuid]/names.js diff --git a/schemas/mojangapi/users/profiles/minecraft/[username].js b/schemas/api/users/profiles/minecraft/[username].js similarity index 100% rename from schemas/mojangapi/users/profiles/minecraft/[username].js rename to schemas/api/users/profiles/minecraft/[username].js diff --git a/server.js b/server.js index 537713b..1274077 100644 --- a/server.js +++ b/server.js @@ -164,4 +164,4 @@ app.use((err, req, res, next) => { app.listen(process.env.WEB_PORT || 3000, () => { logger.log(`Server listening at port : ${process.env.WEB_PORT.bold || 3000}`, ["WEB", "yellow"]) -}) \ No newline at end of file +}) diff --git a/services/serverService.js b/services/serverService.js index 383f6ac..6c1c039 100644 --- a/services/serverService.js +++ b/services/serverService.js @@ -4,14 +4,14 @@ const package = require("../package.json") function getServerMetadata(hostname) { const keys = certs.getKeys() - const publicKeyPEM = keys.playerCertificateKeys.public + const publicKeyPEM = keys.profilePropertyKeys.public const serverMeta = { meta: { serverName: process.env.SERVER_NAME || "Yggdrasil Server", implementationName: package.name, implementationVersion: package.version, - + "feature.legacy_skin_api": utils.isTrueFromDotEnv("SUPPORT_LEGACY_SKIN_API"), "feature.no_mojang_namespace": utils.isTrueFromDotEnv("SUPPORT_MOJANG_FALLBACK"), "feature.enable_mojang_anti_features": utils.isTrueFromDotEnv("SUPPORT_MOJANG_TELEMETRY_BLOCKER"), @@ -36,4 +36,4 @@ function getServerMetadata(hostname) { module.exports = { getServerMetadata -} \ No newline at end of file +} diff --git a/services/sessionsService.js b/services/sessionsService.js index c5c186b..2bc705f 100644 --- a/services/sessionsService.js +++ b/services/sessionsService.js @@ -64,8 +64,8 @@ async function getProfile({ uuid, unsigned = false }) { sessionRepository.getProfileActionsList(dbUser.uuid).catch(() => ({ data: [] })) ]) - const activeSkin = skinResult.data[0] - const activeCape = capeResult.data[0] + const activeSkin = skinResult.data + const activeCape = capeResult.data const profileActions = actionsResult.data || [] const isSkinBanned = profileActions.includes("USING_BANNED_SKIN") @@ -203,4 +203,4 @@ module.exports = { getBlockedServers, registerLegacySession, validateLegacySession, -} \ No newline at end of file +}