feat(router): add system settings routes and handler wiring

Router configuration updates:
- Add SystemSettingsHandler to Config struct
- Register GET /api/libraries/scan-settings (admin-only)
- Register PUT /api/libraries/scan-settings (admin-only)
- Wire SystemSettingsHandler in main.go

These routes replace per-user scan settings endpoints with
system-wide admin-only endpoints.
This commit is contained in:
2026-02-09 20:10:30 -05:00
parent 4488ed5d16
commit 938e5eed53
2 changed files with 26 additions and 21 deletions
+4
View File
@@ -49,6 +49,10 @@ func registerLibraryRoutes(cfg *Config) {
return cfg.MediaHandler.ListMediaItems(c) return cfg.MediaHandler.ListMediaItems(c)
}) })
// System scan settings (admin-only)
adminLibrary.GET("/scan-settings", cfg.SystemSettingsHandler.GetScanSettings)
adminLibrary.PUT("/scan-settings", cfg.SystemSettingsHandler.UpdateScanSettings)
// User library visibility control // User library visibility control
userLibrary := library.Group("/visibility") userLibrary := library.Group("/visibility")
userLibrary.GET("", cfg.LibraryHandler.GetUserVisibleLibraries) userLibrary.GET("", cfg.LibraryHandler.GetUserVisibleLibraries)
+22 -21
View File
@@ -31,27 +31,28 @@ func (cv *CustomValidator) Validate(i interface{}) error {
// Config holds all dependencies needed for route registration // Config holds all dependencies needed for route registration
type Config struct { type Config struct {
Echo *echo.Echo Echo *echo.Echo
Queries *database.Queries Queries *database.Queries
Cfg *config.Config Cfg *config.Config
DBPool interface{} // pgxpool.Pool interface DBPool interface{} // pgxpool.Pool interface
AuthHandler *handlers.AuthHandler AuthHandler *handlers.AuthHandler
LibraryHandler *handlers.LibraryHandler LibraryHandler *handlers.LibraryHandler
DeviceHandler *handlers.DeviceHandler DeviceHandler *handlers.DeviceHandler
MediaHandler *handlers.MediaHandler MediaHandler *handlers.MediaHandler
SearchHandler *handlers.SearchHandler SearchHandler *handlers.SearchHandler
MatchingHandler *handlers.MatchingHandler MatchingHandler *handlers.MatchingHandler
KOReaderHandler *handlers.KOReaderHandler KOReaderHandler *handlers.KOReaderHandler
WSHandler *handlers.WSHandler WSHandler *handlers.WSHandler
ConflictHandler *handlers.ConflictHandler ConflictHandler *handlers.ConflictHandler
AnalyticsHandler *handlers.AnalyticsHandler AnalyticsHandler *handlers.AnalyticsHandler
QueueHandler *handlers.QueueHandler QueueHandler *handlers.QueueHandler
CollectionHandler *handlers.CollectionHandler CollectionHandler *handlers.CollectionHandler
OPDSHandler *handlers.OPDSHandler OPDSHandler *handlers.OPDSHandler
ConnManager *sync.ConnectionManager SystemSettingsHandler *handlers.SystemSettingsHandler
QueueProcessor *sync.SyncQueueProcessor ConnManager *sync.ConnectionManager
DeviceAuthMiddleware *middleware.DeviceAuthMiddleware QueueProcessor *sync.SyncQueueProcessor
LoginTracker *ratelimit.LoginAttemptTracker DeviceAuthMiddleware *middleware.DeviceAuthMiddleware
LoginTracker *ratelimit.LoginAttemptTracker
} }
// createJWTMiddleware creates a JWT middleware with proper user context setup // createJWTMiddleware creates a JWT middleware with proper user context setup