package router // Register OPDS routes with device authentication // Devices must use their devices.auth_token (generated during device registration/approval) // Kobo devices store this token for both sync and OPDS catalog access // Returns 401 Unauthorized if device token is missing, invalid, or device sync is disabled func registerOPDSRoutes(cfg *Config) { e := cfg.Echo // Require device authentication for all OPDS endpoints opds := e.Group("/opds/devices") opds.Use(cfg.DeviceAuthMiddleware.Authenticate) opds.GET("/:deviceId/catalog", cfg.OPDSHandler.GetDeviceCatalog) opds.GET("/:deviceId/search", cfg.OPDSHandler.SearchDeviceCatalog) opds.GET("/:deviceId/nav", cfg.OPDSHandler.GetDeviceNavigation) opds.GET("/:deviceId/download/:bookId", cfg.OPDSHandler.DownloadBook) opds.GET("/:deviceId/cover/:bookId", cfg.OPDSHandler.GetCoverImage) opds.GET("/:deviceId/formats/:bookId", cfg.OPDSHandler.ListFormats) }