Add Minecraft services API routes and user service
Introduces new routes under /minecraftservices and /mojangapi for profile, skin, cape, blocklist, privileges, and certificate management. Adds a comprehensive userService module to handle user-related operations, and extends userRepository with methods for username changes, skin/cape management, blocking, and profile lookups. Refactors username availability logic into authService, updates error handling, and improves logger and utility functions. Also updates route handlers to use consistent return statements and enhances route registration logging.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const fs = require("node:fs")
|
||||
const path = require("node:path")
|
||||
const utils = require("./utils")
|
||||
require("colors")
|
||||
require("dotenv").config({
|
||||
quiet: true
|
||||
@@ -42,7 +43,7 @@ function write($stream, level, color, content, extraLabels = []) {
|
||||
|
||||
function createLogger(root) {
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
const fileName = (/false/).test(process.env.IS_PROD.toLowerCase()) ? new Date().toLocaleString("fr-FR", { timeZone: "UTC" }).replace(/[\/:]/g, "-").replace(/ /g, "_") : "DEV-LOG"
|
||||
const fileName = utils.isTrueFromDotEnv("IS_PROD") ? new Date().toLocaleString("fr-FR", { timeZone: "UTC" }).replace(/[\/:]/g, "-").replace(/ /g, "_") : "DEV-LOG"
|
||||
|
||||
const logsDir = path.join(root, "logs")
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
const path = require("node:path")
|
||||
const logger = require("./logger")
|
||||
const crypto = require("node:crypto")
|
||||
const certificatesManager = require("./certificatesManager")
|
||||
|
||||
@@ -53,8 +51,13 @@ function addDashesToUUID(uuid) {
|
||||
)
|
||||
}
|
||||
|
||||
function isTrueFromDotEnv(key) {
|
||||
return (process.env[key] || "").trim().toLowerCase() === "true"
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getRegistrationCountryFromIp,
|
||||
signProfileData,
|
||||
addDashesToUUID,
|
||||
signProfileData
|
||||
isTrueFromDotEnv,
|
||||
getRegistrationCountryFromIp,
|
||||
}
|
||||
Reference in New Issue
Block a user