refactor(handlers): update all handlers for Echo v5 compatibility

Update all handler functions to use *echo.Context (pointer) instead of echo.Context (value) as required by Echo v5.

Changes across all handler files:
- analytics.go: Update handler signatures
- auth.go: Update authentication handler signatures
- book_matching.go: Update matching handler signatures
- collections.go: Update collection handler signatures
- collections_preview_test.go: Update test signatures
- commonhandlers.go: Update common handler signatures
- conflicts.go: Update conflict handler signatures
- context.go: Update context handler signatures
- dashboard.go: Update dashboard handler signatures
- devices.go: Update device handler signatures
- jobs.go: Update job handler signatures
- kobo.go: Update Kobo handler signatures
- koreader.go: Update Koreader handler signatures
- library.go: Update library handler signatures
- matching.go: Update matching handler signatures
- media.go: Update media handler signatures
- opds.go: Update OPDS handler signatures
- progress.go: Update progress handler signatures
- queue.go: Update queue handler signatures
- refresh_token.go: Update token handler signatures
- scanner.go: Update scanner handler signatures
- sidecar.go: Update sidecar handler signatures
- sync.go: Update sync handler signatures
- system_settings.go: Update settings handler signatures
- websocket.go: Update WebSocket handler signatures

All handlers now properly implement Echo v5's pointer-based context pattern.
This change is necessary for type safety and compatibility with Echo v5's
improved context handling and WebSocket support.
This commit is contained in:
2026-03-06 14:00:28 -05:00
parent 784326e2c4
commit 1e05470fbb
25 changed files with 213 additions and 213 deletions
+10 -10
View File
@@ -11,7 +11,7 @@ import (
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgtype"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v5"
)
type KOReaderHandler struct {
@@ -153,7 +153,7 @@ type KOReaderLibraryBook struct {
LastModified string `json:"last_modified"`
}
func (h *KOReaderHandler) SyncProgress(c echo.Context) error {
func (h *KOReaderHandler) SyncProgress(c *echo.Context) error {
device := c.Get("device").(database.Devices)
userID := device.UserID.Bytes
@@ -223,7 +223,7 @@ func (h *KOReaderHandler) SyncProgress(c echo.Context) error {
})
}
func (h *KOReaderHandler) resolveBookToMediaItem(c echo.Context, deviceID pgtype.UUID, userID pgtype.UUID, book KOReaderBookProgress) (pgtype.UUID, float64) {
func (h *KOReaderHandler) resolveBookToMediaItem(c *echo.Context, deviceID pgtype.UUID, userID pgtype.UUID, book KOReaderBookProgress) (pgtype.UUID, float64) {
ctx := c.Request().Context()
// Priority 1: UUID provided (highest confidence - 1.0)
@@ -307,7 +307,7 @@ func (h *KOReaderHandler) resolveBookToMediaItem(c echo.Context, deviceID pgtype
return pgtype.UUID{}, 0.0
}
func (h *KOReaderHandler) createDeviceFileAlias(c echo.Context, deviceID pgtype.UUID, mediaItemID pgtype.UUID, book KOReaderBookProgress) {
func (h *KOReaderHandler) createDeviceFileAlias(c *echo.Context, deviceID pgtype.UUID, mediaItemID pgtype.UUID, book KOReaderBookProgress) {
ctx := c.Request().Context()
if book.FilePath == "" {
@@ -341,7 +341,7 @@ func (h *KOReaderHandler) createDeviceFileAlias(c echo.Context, deviceID pgtype.
}
}
func (h *KOReaderHandler) handleCheckpointSync(c echo.Context, device database.Devices, userID pgtype.UUID, req KOReaderProgressRequest) error {
func (h *KOReaderHandler) handleCheckpointSync(c *echo.Context, device database.Devices, userID pgtype.UUID, req KOReaderProgressRequest) error {
booksEnqueued := 0
for _, book := range req.Books {
@@ -371,7 +371,7 @@ func (h *KOReaderHandler) handleCheckpointSync(c echo.Context, device database.D
})
}
func (h *KOReaderHandler) enqueueProgressForBook(c echo.Context, deviceID pgtype.UUID, userID pgtype.UUID, mediaItemID pgtype.UUID, book KOReaderBookProgress) error {
func (h *KOReaderHandler) enqueueProgressForBook(c *echo.Context, deviceID pgtype.UUID, userID pgtype.UUID, mediaItemID pgtype.UUID, book KOReaderBookProgress) error {
if h.queue == nil {
return fmt.Errorf("sync queue not available")
}
@@ -393,7 +393,7 @@ func (h *KOReaderHandler) enqueueProgressForBook(c echo.Context, deviceID pgtype
return h.queue.EnqueueProgress(update)
}
func (h *KOReaderHandler) updateProgressForBook(c echo.Context, userID pgtype.UUID, mediaItemID pgtype.UUID, book KOReaderBookProgress) error {
func (h *KOReaderHandler) updateProgressForBook(c *echo.Context, userID pgtype.UUID, mediaItemID pgtype.UUID, book KOReaderBookProgress) error {
ctx := c.Request().Context()
existingProgress, err := h.db.GetReadingProgress(ctx, database.GetReadingProgressParams{
@@ -557,7 +557,7 @@ func (h *KOReaderHandler) updateProgressForBook(c echo.Context, userID pgtype.UU
return err
}
func (h *KOReaderHandler) GetMetadata(c echo.Context) error {
func (h *KOReaderHandler) GetMetadata(c *echo.Context) error {
device := c.Get("device").(database.Devices)
userID := device.UserID.Bytes
@@ -667,7 +667,7 @@ func (h *KOReaderHandler) GetMetadata(c echo.Context) error {
return c.JSON(http.StatusOK, metadata)
}
func (h *KOReaderHandler) GetLibrary(c echo.Context) error {
func (h *KOReaderHandler) GetLibrary(c *echo.Context) error {
device := c.Get("device").(database.Devices)
userID := device.UserID.Bytes
@@ -731,7 +731,7 @@ func (h *KOReaderHandler) GetLibrary(c echo.Context) error {
})
}
func (h *KOReaderHandler) SyncBookmarks(c echo.Context) error {
func (h *KOReaderHandler) SyncBookmarks(c *echo.Context) error {
device := c.Get("device").(database.Devices)
userID := device.UserID.Bytes