Commit Graph
499 Commits
Author SHA1 Message Date
anthorob dad2e0356e Introduce multistage Docker build for optimized image size
Implemented a multistage Docker build, separating build and runtime stages to reduce the final image size and improve security. Adjusted `.dockerignore` to exclude unnecessary files from the build context and updated the base JRE image to use the build output efficiently.
2026-10-18 02:04:56 -04:00
anthorob d0ea0535e2 Add health checks and dependency conditions in docker-compose.yml
Introduced health checks for `netneutrality-db` to ensure proper readiness before dependent services start. Replaced static sleep in `startup.sh` with dynamic database availability checks, improving startup reliability and reducing downtime risks.
2026-10-18 01:53:10 -04:00
anthorob 78d6ade17a Optimize isUserDj logic 2026-10-18 01:49:46 -04:00
anthorob cb47a1622f Refactor MusicAccess permission checks
Reordered admin check in `MusicAccess` for efficiency by prioritizing it before role-related logic. This improves readability and minimizes unnecessary role lookups for admin users.
2026-10-14 08:32:32 -04:00
anthorob 545c09d502 clean 2026-10-14 08:24:33 -04:00
anthorob 6134c893ab fix 2026-10-14 08:12:12 -04:00
anthorob 91b6de708d Standardize guild API endpoints and add music access checks
Unified paths in guild-related endpoints to include consistent `{guildId}` structure, improving endpoint clarity and alignment with REST routing conventions. Added centralized `MusicAccess` utility to streamline music feature permission checks, replacing scattered logic in `MusicCommand`. Updated OpenAPI documentation and added tests for new and updated behaviors.
2026-10-14 08:02:31 -04:00
anthorob bedc8b9f02 Switch to MariaDBDialect in Hibernate configuration
Replaced `MySQLDialect` with `MariaDBDialect` in `hibernate.cfg.xml` to ensure compatibility with MariaDB. This change aligns the Hibernate dialect with the underlying database and avoids potential SQL compatibility issues.
2026-10-13 13:18:10 -04:00
anthorob abdd2d1656 Replace GitLab integration with Gitea in issue reporting
Migrated issue reporting functionality from GitLab to Gitea. Updated environment variables, dependencies, and configuration references to support Gitea. Introduced `GiteaClient` for communication with the Gitea API and refactored related code and tests to align with the new integration.
2026-10-13 13:16:54 -04:00
anthorob a23e3843ed Filter out public roles in guild routes 2026-10-09 13:16:54 -04:00
anthorob 1f126f29ad Switch to SIGTERM for graceful shutdown in startup.sh
Replaced the `curl` HTTP shutdown call with a `kill -TERM` signal to ensure the JVM shutdown hook executes cleanly. Added a `wait` command to block until the process finishes, enabling a more reliable and proper termination process.
2026-10-09 12:51:35 -04:00
anthorob e0ec43813d Add admin status check endpoint to guild routes
Introduced `/guilds/members/{guildId}/{userId}/admin` endpoint to determine if a guild member is an admin. Added `AdminStatusResponse` DTO and documented the new route with OpenAPI annotations. This feature allows for efficient admin status verification with fallback to REST fetch on cache miss.
2026-10-09 12:43:44 -04:00
anthorob 861b3f90e7 Refine VoteSkipService warnings and remove redundant announce calls
Updated the warning message in `VoteSkipService` to provide more precise feedback when attempting to vote on an empty queue. Removed an unnecessary `announce` call in `MusicRoutes`'s `resumePlayback` for cleaner and more concise code execution.
2026-10-09 03:16:09 -04:00
anthorob b7d19b6d56 Modify database URL to create missing databases
Updated the database connection URL to include the `createDatabaseIfNotExist=true` parameter. This ensures the database is automatically created if it does not already exist, improving usability and reducing manual configuration steps.
2026-10-09 02:41:02 -04:00
anthorob 4b006956b5 Add filters to Maven shade plugin configuration
Added filters to exclude specific files and artifacts from the shaded JAR to reduce unnecessary metadata and dependencies. These changes optimize the final build output and ensure a cleaner, more efficient artifact.
2026-10-04 15:18:45 -04:00
anthorob 2293629f6f Add logger configuration for Lavalink client
Introduced a dedicated logger `dev.arbjerg.lavalink` with `info` level and disabled additivity. Updated the log4j2 configuration to log Lavalink client activity to both console and rolling file appenders, ensuring better log separation and monitoring.
2026-10-04 15:13:15 -04:00
anthorob 5b1df7038c fix PermissionPrecondition 2026-10-04 15:05:11 -04:00
anthorob 88389f3db0 Remove redundant announce calls from MusicRoutes 2026-10-03 18:35:30 -04:00
anthorob c2a24f0133 Clear queue on leave operation
Added a call to `getQueueManager().clearQueue()` in the leave method of `MusicManager`. This ensures the queue is properly cleared when the bot disconnects from a guild, improving consistency and preventing leftover queue data.
2026-10-03 18:26:27 -04:00
anthorob db86c133e6 Add new endpoints for queue management and playback control
Introduced `/music/{guildId}/queue` DELETE, `/music/{guildId}/leave`, and `/music/{guildId}/shuffle` endpoints for enhanced queue and playback operations. Added corresponding DTOs (`DeleteQueueResponse`, `LeaveResponse`, `ShuffleResponse`) and updated `MusicRoutes` with OpenAPI documentation. These changes improve queue handling, bot disconnection, and randomization functionality for guilds.
2026-10-03 18:21:10 -04:00
anthorob 44b284fde8 Add GET /music/{guildId}/volume endpoint
Introduced a new endpoint to retrieve the current volume level for a guild's music player. Updated `MusicRoutes` and `MusicManager` with the necessary logic and added OpenAPI documentation for the route. This enhances API completeness by providing both read and write access to the volume setting.
2026-10-03 15:46:34 -04:00
anthorob 9812e6da41 Add DJ status check endpoint to music routes
Introduced `/music/{guildId}/dj/{userId}` endpoint to verify if a user has DJ permissions in a specific guild. Added `DjStatusResponse` DTO, integrated the logic into `MusicManager`, and provided OpenAPI documentation for the new route.
2026-10-03 14:34:32 -04:00
anthorob 30ff1602b2 Add seek and reorder queue functionality to music routes
Introduced `/music/{guildId}/seek` and `/music/{guildId}/queue/reorder` endpoints, enabling users to seek to a specific position in the currently playing track and reorder tracks in the queue. Added corresponding request/response DTOs and OpenAPI documentation. Updated `QueueManager` with a `reorder` method and added comprehensive unit tests for edge cases and validation.
2026-10-03 14:06:29 -04:00
anthorob 470f5a33aa Refactor music commands to return QueueActionResult
Replaced `CommandExecutionResult` with `QueueActionResult` in music-related commands, improving result clarity and alignment with queue-specific operations. Updated command logic, tests, and REST API endpoints to use the new result type, ensuring consistent handling and messaging.
2026-10-03 13:54:04 -04:00
anthorob 9cd1317659 Support bulk queuing with queueAll in /music/{guildId}/queue
Extended the queue endpoint to allow bulk queuing of all search candidates by specifying `queueAll=true`. Updated relevant request and response DTOs, OpenAPI documentation, and endpoint logic to handle bulk queuing while maintaining input validation for individual candidates.
2026-10-03 12:17:37 -04:00
anthorob 27aa0a1d55 Add artwork_url to music track summaries
Extended the music track summary object in `MusicRoutes` to include the `artwork_url` field. This provides front-end clients with direct access to track artwork, improving UI and metadata presentation.
2026-10-03 12:04:55 -04:00
anthorob 715c5a5fb9 Add search_id_ttl_seconds to pending music responses
Enhanced pending response bodies in `MusicRoutes` to include `search_id_ttl_seconds`, indicating the time-to-live for `search_id`. Updated `QueueResponse` DTO and comments to support the new field. Introduced `ttlSeconds` method in `PendingSearchResults` for consistent TTL retrieval across components.
2026-10-03 12:02:14 -04:00
anthorob cd83fcdae6 Handle unavailable audio node in MusicManager
Added a check for null `getLink()` in `MusicManager` before attempting connection to the audio channel. This ensures users receive a clear error message if the audio node is unavailable, improving error handling and user feedback.
2026-10-03 11:51:17 -04:00
anthorob 1dca5b898a Rename PlayRequest/PlayResponse to QueueRequest/QueueResponse
Updated DTOs and endpoint logic to reflect the separation of search result resolution and playback queuing. Adjusted references to `/play` and `/play/select` routes, replacing them with clearer `/search` and `/queue` endpoints in comments, documentation, and API definitions.
2026-10-03 11:23:59 -04:00
anthorob a605a834b4 Refactor REST API music playback flow
Replaced `/play` and `/play/select` endpoints with more streamlined `/search` and `/queue` routes. Updated `MusicManager` and related components to separate query resolution from playback queuing, requiring explicit confirmation for each candidate. Introduced `SearchRequest`, `SearchResultHandler`, and revamped `PlayOutcome` to improve clarity and flexibility.
2026-10-03 11:21:31 -04:00
anthorob 0e68886eb2 Honor explicit search prefixes in SourceFinder
Updated `SourceFinder` to respect explicit `ytsearch:`, `ytmsearch:`, and `scsearch:` prefixes regardless of the configured search engine. Added unit tests to ensure correct behavior and consistent identifier resolution when explicit prefixes are provided.
2026-10-03 09:45:00 -04:00
anthorob d53cbbecd4 Add REST-driven music playback and pause/resume support
Introduced `/music/{guildId}/play` and `/music/{guildId}/play/select/{searchId}` POST routes for initiating and selecting music playback via the REST API. Added `/music/{guildId}/pause` and `/music/{guildId}/resume` POST routes to control playback state. Updated the music system with `RestTrackLoadingHandler`, `PlayOutcome`, `PendingSearchResults`, and DTOs for OpenAPI integration. Enhanced `MusicManager` to support REST-driven play requests with robust error handling and improved track loading logic.
2026-10-02 21:17:36 -04:00
anthorob 6d62a38b0b Add configurable music search engine support
Introduced a configurable `MUSIC_SEARCH_ENGINE` option for determining the default search engine used for non-URL queries (YouTube, YouTube Music, or SoundCloud). Updated `SourceFinder` and related components to support this feature, enhanced query resolution logic, and improved flexibility in music searches. Added `SourceFinderTest` for thorough unit test coverage, ensuring correct behavior across search engines.
2026-10-02 10:52:08 -04:00
anthorob 22621e3912 Add /music/sources endpoint to list playable music sources
Introduced a new GET route `/music/sources` to retrieve supported music source types. Added `MusicSourceResponse` DTO for OpenAPI schema integration and implemented filtering logic to exclude unsupported types. Updated `MusicRoutes` to register the new endpoint.
2026-09-30 20:56:37 -04:00
anthorob 88298380f8 Add logging configuration endpoints for guilds
Introduced `/guilds/config/{guildId}`, `/guilds/debug/{guildId}`, `/guilds/logging/{guildId}`, and `/guilds/log-channel/{guildId}` endpoints to manage guild-level logging settings via API. Updated `GuildService` with methods for handling debug, logging mode, and log channel configuration. Integrated new routes into `GuildRoutes` and updated OpenAPI schemas with corresponding DTOs.
2026-09-30 12:43:45 -04:00
anthorob 0f96051fd0 Add music API endpoints and update OpenAPI responses
Introduced `/music/*` routes for managing music player actions via HTTP, including status, queue, skip, stop, volume control, and vote-skip functionality. Refactored settings and guild routes to use new `Response` DTOs for precise OpenAPI schema definitions. Updated `WebApi` to register music routes and ensure proper integration with the existing `MusicService` logic.
2026-09-30 05:20:35 -04:00
anthorob e9c6f403e5 refactor 2026-09-30 01:33:19 -04:00
anthorob 0145383dfd refactor 2026-09-29 13:07:02 -04:00
anthorob 9c8da6ab7b missing 2026-09-29 12:02:53 -04:00
anthorob 41276c40f6 Add setting types and validation for guild settings
Introduced `SettingType` to categorize guild settings and enforce validation rules for each type (e.g., integer, boolean, percentage, enum). Updated `GSettings` to include type and allowed values, enhanced `/settings/catalog` to expose additional metadata, and added robust validation logic to reject invalid setting updates. Verified backward compatibility and minimal impact on existing settings.
2026-09-29 12:02:36 -04:00
anthorob 57b8e4669b Introduce a pluggable logging system with LogSink interfaces
Added adaptable logging capabilities using `LogSink` implementations, including Log4j, Sentry, and Discord debug channel handlers. Centralized exception handling in `LogHandler`, introducing methods for registering and deregistering custom sinks. Implemented `LoggedException` to encapsulate exceptions with optional context and message, and refactored existing logging logic for modularity, fail-safety, and extensibility.
2026-09-29 12:02:27 -04:00
anthorob 60d7a66b42 Introduce timezone support and configurable settings for music bot
Added support for timezone-specific formatting, leveraging the new `TimeUtils` utility. Enhanced music bot functionality with configurable settings such as idle timeout, vote-skip threshold, DJ role, and more. Refactored configuration commands for modularity and added safe fallbacks for invalid configurations.
2026-09-29 10:41:09 -04:00
anthorob a8b353ea73 Add OpenAPI-based API documentation and new endpoints
Integrated OpenAPI and Swagger plugins for comprehensive API documentation. Added new routes, including settings management (`/settings/*`), guild metadata endpoints (`/guilds/*`), and detailed action status handling. Updated database schema to support guild metadata persistence, revised command subcommand handling for better modularity, and enhanced API key-based authentication for all routes.
2026-09-29 10:32:28 -04:00
anthorob 35fc415d91 Improve argument parsing in MessageCommandContext
Revised argument parsing to handle edge cases like text concatenation, invalid numeric input, and mention handling more robustly. Introduced utility methods for validating argument input and resolving mentions to improve readability and maintainability. Added tests (`UsageValidatorTest`) to verify proper execution of subcommand and argument validation.
2026-09-26 10:47:21 -04:00
anthorob ffc15e8044 Remove outdated Udio plugin references and related code 2026-09-26 02:41:02 -04:00
anthorob 38bbf01e9f update gitignore 2026-09-25 12:54:06 -04:00
anthorob 6abda9196b deprecated api 2026-09-25 12:51:18 -04:00
anthorob bceab4b2b9 Refactor repository layer using Jakarta Data
Replaced custom repository logic with Jakarta Data interfaces to reduce boilerplate and enhance compile-time query validation. Removed `AbstractRepository` and introduced `TransactionRunner` for consistent transactional support. Updated all repository facades to delegate query operations to generated interfaces while retaining the same API, ensuring backward compatibility. Added dependencies for `jakarta.data-api` and Hibernate's `hibernate-processor` for annotation-based query generation. Verified functional parity and improved testability across the repository layer.
2026-09-25 12:48:48 -04:00
anthorob 677b3f8013 Remove JpaUtils and refactor repository access
Eliminated the static `JpaUtils` utility and transitioned to explicit repository management for improved modularity and testability. Updated `GuildService`, `TaskManagerImpl`, and related classes to use dependency-injected repositories. Simplified configuration by aligning repository definitions with existing service patterns and ensuring proper session handling through `SessionManager`. Verified that all affected components function as expected after refactoring.
2026-09-25 12:17:19 -04:00
anthorob 62de32ecfc Migrate from Gson and org.json to Jackson
Replaced Gson and org.json usage across the codebase with a unified Jackson-based implementation through a shared `Json` utility. Updated all JSON serialization and deserialization logic (`GsonJsonMapper`, HTTP client, task persistence, command handling, tests) to use Jackson's `ObjectMapper`. Removed the outdated dependencies from `pom.xml` and verified symmetry in payload serialization.
2026-09-25 08:18:43 -04:00