Commit Graph
95 Commits
Author SHA1 Message Date
azures04 dbcb436c9f Refactor skin selection logic and remove DB trigger
Removed the 'unique_active_skin' database trigger from setupDatabase and updated setSkin in userRepository to handle skin selection logic in application code. This change centralizes the logic for ensuring only one active skin per user, improving maintainability and error handling.
2026-01-23 23:07:10 +01:00
azures04 aea0b7b016 Delete skins.js 2026-01-23 22:58:02 +01:00
azures04 11f930c3d8 Update skins.js 2026-01-23 22:56:37 +01:00
azures04 b82c06165a Update skins.js 2026-01-23 22:54:54 +01:00
azures04 48ea9f708b Expand skin upload schema and simplify texture storage
Updated the skin upload schema to accept both JSON and multipart/form-data content types, and to allow requests without a URL. Simplified the texture storage path in userService.js by removing subdirectory partitioning based on hash.
2026-01-23 22:52:00 +01:00
azures04 3f64c2c897 Update userService.js 2026-01-23 21:49:47 +01:00
azures04 c1dbfc58aa Update userService.js 2026-01-23 21:48:45 +01:00
azures04 65f2f26325 Update userService.js 2026-01-23 21:42:18 +01:00
azures04 f9270c1f9c Update userService.js 2026-01-23 21:41:32 +01:00
azures04 6f3231aee7 Update userService.js 2026-01-23 21:40:06 +01:00
azures04 4a0fcf65f3 Update userRepository.js 2026-01-23 21:38:54 +01:00
azures04 cc8e581cbe Update userRepository.js 2026-01-23 21:38:21 +01:00
azures04 b4ae5fa4d9 Update index.js 2026-01-23 21:33:13 +01:00
azures04 7018e8c497 Update userRepository.js 2026-01-23 21:30:41 +01:00
azures04 8e0a1ab673 Update userRepository.js 2026-01-23 21:29:37 +01:00
azures04 e089957db7 Update userRepository.js 2026-01-23 21:28:54 +01:00
azures04 c8812c5153 Add getSkins and getCapes methods to user modules
Introduces getSkins and getCapes functions in both userRepository and userService to retrieve player skins and capes from the database. These methods return structured data for use in higher-level application logic.
2026-01-23 21:27:45 +01:00
azures04 66db52e7c8 Update server.js 2026-01-19 20:37:12 +01:00
azures04 21fd655a1f Update register.js 2026-01-19 20:35:58 +01:00
azures04 074a5dc04b Update register.js 2026-01-19 20:35:19 +01:00
azures04 6cf822e603 Update register.js 2026-01-19 20:34:51 +01:00
azures04 535c21b971 register 2026-01-19 20:34:07 +01:00
azures04 44a9ff12b1 register 2026-01-19 20:31:13 +01:00
azures04 f5df40f264 Update register.html 2026-01-19 20:28:56 +01:00
azures04 caa318f2c7 register 2026-01-19 20:26:58 +01:00
azures04 d6ac0fd8b4 r 2026-01-19 20:26:05 +01:00
azures04 6666025726 Update register.html 2026-01-19 20:24:30 +01:00
azures04 57aeb47ed1 Update register.html 2026-01-19 20:19:19 +01:00
azures04 4975f7e191 Add static registration page and static file serving
Added a new registration HTML page under data/static/register.html and introduced a static file serving route in routes/static.js. Minor adjustments were made to authRepository.js and userRepository.js to update module imports. This enables serving static assets and provides a registration UI.
2026-01-19 02:47:55 +01:00
azures04 c96e728228 fixed cape upload 2026-01-18 23:47:29 +01:00
azures04 308c3b5479 fixed cape upload 2026-01-18 23:34:40 +01:00
azures04 086468405a fixed cape upload 2026-01-18 23:32:32 +01:00
azures04 0b8ab9f194 Update databaseGlobals.js 2026-01-18 23:18:58 +01:00
azures04 01e0b94d35 Add composite primary key to player_capes and update messages
Added a composite primary key (playerUuid, assetHash) to the player_capes table for better data integrity. Updated userRepository.js to use English messages for cape assignment and removal operations.
2026-01-18 23:16:11 +01:00
azures04 0049ae8ec6 Update server.js 2026-01-18 23:10:31 +01:00
azures04 9469822ef9 Update [hash].js 2026-01-18 23:10:13 +01:00
azures04 99598f2b7a Update [hash].js 2026-01-18 23:06:40 +01:00
azures04 85ba96cb6f Update [hash].js 2026-01-18 23:05:59 +01:00
azures04 ac6eca3f31 Update [hash].js 2026-01-18 23:03:05 +01:00
azures04 53e58bdb30 Log header validation result in server.js
Added a console.log statement to output the result of header validation in the request handler. Also fixed a minor formatting issue in the cape texture schema file.
2026-01-18 23:00:59 +01:00
azures04 adddbadbf3 Update [hash].js 2026-01-18 22:58:43 +01:00
azures04 b15595ecb1 Update [hash].js 2026-01-18 22:54:03 +01:00
azures04 aacfca136c Update databaseGlobals.js 2026-01-18 21:52:01 +01:00
azures04 9ac904ba08 Update capes.js 2026-01-18 21:39:35 +01:00
azures04 fab7066ee3 Update [hash].js 2026-01-18 21:38:39 +01:00
azures04 86490ebd2d Update [hash].js 2026-01-18 21:35:55 +01:00
azures04 dd04b2014a Update server.js 2026-01-18 21:30:42 +01:00
azures04 83d46425b3 Update adminService.js 2026-01-18 21:26:40 +01:00
azures04 7eac539598 Update adminService.js 2026-01-18 21:25:40 +01:00
azures04 9a6b119d37 Update adminService.js 2026-01-18 21:24:35 +01:00
azures04 d8318f874f Update adminService.js 2026-01-18 21:23:56 +01:00
azures04 487bd08141 Update adminService.js 2026-01-18 21:21:42 +01:00
azures04 30a0ac3927 Update adminService.js 2026-01-18 21:19:32 +01:00
azures04 21cf0f49e6 Update server.js 2026-01-18 21:18:50 +01:00
azures04 a31be145cc Update adminService.js 2026-01-18 21:04:08 +01:00
azures04 0e0f176e50 Update login.js 2026-01-18 21:01:46 +01:00
azures04 86349bcf4f Add admin login and password change endpoints
Introduces POST /login and PATCH /password routes for admin authentication and password management. Adds corresponding schema validation for login and password change, enforces stricter password requirements, and updates adminService with JWT-based profile retrieval and improved token handling.
2026-01-18 19:38:24 +01:00
azures04 d590ecce6d Fixed '_' char in column name in admin repo 2026-01-18 19:04:24 +01:00
azures04 617e60cf75 Fix admin permissions table name and seed default permissions
Corrects the table name from 'apiAdministrators_permissions' to 'apiAdministratorsPermissions' in adminRepository.js for consistency with the database schema. Also seeds default permissions into 'apiAdministratorsPermissionsList' during database setup.
2026-01-18 18:55:22 +01:00
azures04 f1a482c58f Moved cosmectics schemas to valid location 2026-01-18 18:27:12 +01:00
azures04 69ad2c8f83 Update server.js 2026-01-18 18:05:23 +01:00
azures04 71627c7041 Centralize and standardize database error handling
Introduced a new handleDBError utility in modules/utils.js to centralize database error logging and throwing. Refactored all repositories to use this utility, replacing repetitive error handling and logger calls with a single function call for improved maintainability and consistency.
2026-01-18 18:04:10 +01:00
azures04 88f8ee57e1 Update userRepository.js 2026-01-18 15:45:22 +01:00
azures04 bfc98243d0 Update databaseGlobals.js 2026-01-18 15:42:24 +01:00
azures04 c6afafca2a Refactor cape selection logic and remove trigger
Removed the 'unique_active_cape' database trigger and updated the showCape function to manually ensure only one cape is selected per player. This change centralizes the selection logic in application code for better maintainability and error handling.
2026-01-18 15:40:00 +01:00
azures04 b6b7cf7fe0 Update sessionsService.js 2026-01-14 23:56:31 +01:00
azures04 ffa23e35b0 Update .env.example 2026-01-11 21:15:40 +01:00
azures04 c5b6f6c107 Add Discord OAuth2 account linking and login support
Introduces Discord OAuth2 integration for account association and login, including new routes for linking, unlinking, and authenticating via Discord. Adds supporting services, repositories, and schema validation for the OAuth2 flow. Refactors database schema and queries for consistency, and updates dependencies to include required OAuth2 libraries.
2026-01-11 21:03:12 +01:00
azures04 5b81f57adb Rename deleteGlobalCape to deleteCape
Refactored the function and route handler from deleteGlobalCape to deleteCape for consistency and clarity in naming. Updated all references accordingly.
2026-01-05 05:07:53 +01:00
azures04 bfad2a39c1 Add player action logging for admin operations
Introduces a new addPlayerAction method in adminRepository and logPlayerAction in adminService to record admin actions on player accounts. Updates relevant admin routes to log actions such as bans, unbans, forced name changes, and skin resets. Also improves error messages in adminService for consistency and clarity.
2026-01-05 05:06:06 +01:00
azures04 439094013d Add admin API, permissions, and player management routes
Introduces admin database tables, repository, and service for managing administrators and permissions. Adds new admin routes for banning players, managing cosmetics (capes), changing player passwords and usernames, and handling player textures. Updates user and session services to support admin actions and permission checks. Adds related schema validation for new endpoints.
2026-01-05 04:44:56 +01:00
azures04 da8ab9d488 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.
2025-12-30 13:41:19 +01:00
azures04 36a9a0b193 fix sessionService 2025-12-30 07:40:21 +01:00
azures04 9b36c85974 Add legacy skin and cape routes, improve error handling
Introduces legacy routes for Minecraft skins and capes to support older endpoints. Enhances error handling in sessionsRepository for missing skins/capes, adds getActiveSkin and getActiveCape to sessionsService, and improves error logging in server.js.
2025-12-29 22:02:52 +01:00
azures04 80fb6c6cd4 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.
2025-12-29 01:21:21 +01:00
azures04 947192d997 Update package.json 2025-12-28 23:28:03 +01:00
azures04 3cd42103e5 Add legacy authentication and session routes
Introduces legacy endpoints for login, joinserver, and checkserver, along with their input validation schemas. Updates sessionsService with joinLegacyServer to support legacy session handling. This enables compatibility with legacy clients requiring these authentication flows.
2025-12-28 23:19:38 +01:00
azures04 e8f58e63cd Refactor texture handling and update route structure
Moved sessionserver routes to correct directory and removed subdirectory logic from texture file lookup. Updated texture URLs to remove leading slashes and fixed endpoint concatenation. Added default textures for Alex and Steve.
2025-12-28 22:22:54 +01:00
azures04 a3eb5ee70c Added authlib support 2025-12-28 22:10:14 +01:00
azures04 a7cf6ad5a1 Update logger.js 2025-12-28 21:46:02 +01:00
azures04 064703878c Update .env.example 2025-12-28 21:43:40 +01:00
azures04 fd4b98ccfd Update utils.js 2025-12-28 21:11:36 +01:00
azures04 5cfadfd7ac Add validation schemas and improve texture handling
Introduces zod-based validation schemas for Minecraft and Mojang API endpoints. Refactors texture route to support hash-based file serving and removes the old static texture route. Updates database schema for player properties and adds an event to clean expired certificates. Improves ValidationError formatting, adjusts skin/cape URL construction, and adds SSRF protection for skin uploads.
2025-12-28 09:02:10 +01:00
azures04 1fe46a03fd Add skin upload and texture management endpoints
Introduces endpoints and logic for uploading Minecraft skins via file or URL, storing textures, and managing player skins. Adds new repository and service methods for texture registration and retrieval, updates authorization handling, and uses process.cwd() for data paths. Also includes static serving of textures and rate limiting for skin uploads.
2025-12-28 07:49:31 +01:00
azures04 5dd1de1521 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.
2025-12-28 07:15:24 +01:00
azures04 228345c859 Add AccountsAPIError class and productvoucher route
Introduces a custom AccountsAPIError class for consistent error handling and serialization. Adds a new /productvoucher/giftcode route that returns a 404 error response for unimplemented endpoints.
2025-12-25 17:54:40 +01:00
azures04 97ae0c43f0 Move serverKeys initialization into signProfileData
Relocated the serverKeys variable from module scope to inside the signProfileData function to ensure keys are fetched at the time of signing. This improves encapsulation and may help with key rotation or dynamic key management.
2025-12-25 01:41:01 +01:00
azures04 10e4f3f038 Add public keys and blocked servers routes
Introduces two new routes: one for serving public keys from the certificates manager at /minecraftservices/publickeys, and another for listing blocked servers from the sessions service at /sessionsserver/blockedservers. These endpoints provide necessary data for authentication and server validation processes.
2025-12-24 19:08:38 +01:00
azures04 3d0f5c54af Add session join schema and enhance error serialization
Introduces a Zod schema for the Minecraft session join endpoint, validating accessToken, selectedProfile, and serverId. Updates ValidationError to support serialization via YggdrasilError and SessionError for improved error formatting.
2025-12-24 04:54:53 +01:00
azures04 2519d8078a Refactor logger usage and add userRepository module
Replaces custom logger instantiation with a shared logger import across modules and routes. Moves player property and privilege management from authRepository to a new userRepository, expanding userRepository with additional user management functions (ban, unban, preferences, privileges, bans). Updates service and route files to use userRepository where appropriate. Adds new session join route and schema, and utility for UUID formatting.
2025-12-24 04:22:43 +01:00
azures04 80bca31d9a Add session server routes and SessionError class
Introduces new session server endpoints for hasJoined and profile lookup, adds a SessionError class for improved error handling, and updates error exports. Also renames sessionRepository and sessionService files to sessionsRepository and sessionsService for consistency, and sets max listeners in logger.
2025-12-24 02:35:04 +01:00
azures04 64d632eac9 Add session service with profile and session management
Introduces sessionService.js providing functions for legacy session registration and validation, profile retrieval with skin/cape data, server join handling, and blocked server listing. Integrates with auth and session repositories and includes error handling for various session operations.
2025-12-24 01:20:52 +01:00
azures04 bdb6457d1d Add session repository and profile signing utility
Introduces sessionRepository.js with functions for managing client and server sessions, blocked servers, skins, capes, and profile actions. Adds signProfileData to utils.js for signing profile data, and updates README project name.
2025-12-23 16:17:40 +01:00
azures04 0b1662d8ca Initial project structure and core modules
Add environment example, update .gitignore, and switch license to AGPL v3. Introduce error handling classes, ESLint config, and main modules for database, logging, certificate management, and utility functions. Add authentication routes, schemas, and service layer for a modular REST API. Update README and set up repository structure for further development.
2025-12-23 15:59:43 +01:00
azures04 4e822b4868 Initial commit 2025-12-22 14:04:38 +01:00