azures04 587146d322 Initial project structure and core files
Add base project files including environment example, license, README, .gitignore, error classes, ESLint config, database modules, texture assets, repositories, routes, schemas, services, and server entry point. This establishes the foundational structure for a Yggdrasil-compatible REST API with modular error handling, database setup, and route organization.
2026-01-05 04:42:39 +01:00

36 lines
1.1 KiB
JavaScript

const express = require("express")
const router = express.Router()
const crypto = require("crypto")
const authService = require("../../services/authService")
const sessionsService = require("../../services/sessionsService")
const logger = require("../../modules/logger")
router.all("/", async (req, res) => {
const { user, password } = { ...req.query, ...req.body }
try {
const result = await authService.authenticate({
identifier: user,
password,
clientToken: "",
requireUser: false
})
const profile = result.response.selectedProfile
const sessionId = crypto.randomBytes(16).toString("hex")
await sessionsService.registerLegacySession({
uuid: profile.id,
sessionId
})
logger.log(`Legacy Login: ${user}`, ["AUTH", "green"])
const timestamp = Date.now()
return res.send(`${timestamp}:deprecated:${profile.name}:${sessionId}:${profile.id}`)
} catch (err) {
return res.send("Bad login")
}
})
module.exports = router