diff --git a/backend/src/main/java/org/booklore/controller/KoboController.java b/backend/src/main/java/org/booklore/controller/KoboController.java index 590fb03ff..fa38737f3 100644 --- a/backend/src/main/java/org/booklore/controller/KoboController.java +++ b/backend/src/main/java/org/booklore/controller/KoboController.java @@ -39,7 +39,6 @@ import java.util.Set; @Tag(name = "Kobo Integration", description = "Endpoints for Kobo device and library integration") public class KoboController { - private String token; private final AppSettingService appSettingService; private final KoboServerProxy koboServerProxy; private final KoboInitializationService koboInitializationService; @@ -57,22 +56,22 @@ public class KoboController { return appSettingService.getAppSettings().getKoboSettings().isForwardToKoboStore(); } - @ModelAttribute - public void captureToken(@PathVariable("token") String token) { - this.token = token; - } - @Operation(summary = "Initialize Kobo resources", description = "Initialize Kobo resources for the device.") @ApiResponse(responseCode = "200", description = "Initialization successful") @GetMapping("/v1/initialization") - public ResponseEntity initialization() throws JacksonException { + public ResponseEntity initialization( + @PathVariable("token") String token + ) throws JacksonException { return koboInitializationService.initialize(token); } @Operation(summary = "Sync Kobo library", description = "Sync the user's Kobo library.") @ApiResponse(responseCode = "200", description = "Library synced successfully") @GetMapping("/v1/library/sync") - public ResponseEntity> syncLibrary(@AuthenticationPrincipal BookLoreUser user) { + public ResponseEntity> syncLibrary( + @PathVariable("token") String token, + @AuthenticationPrincipal BookLoreUser user + ) { return koboLibrarySyncService.syncLibrary(user, token); } @@ -125,7 +124,10 @@ public class KoboController { @Operation(summary = "Get book metadata", description = "Retrieve metadata for a book in the Kobo library.") @ApiResponse(responseCode = "200", description = "Metadata returned successfully") @GetMapping("/v1/library/{bookId}/metadata") - public ResponseEntity getBookMetadata(@Parameter(description = "Book ID") @PathVariable String bookId) { + public ResponseEntity getBookMetadata( + @PathVariable("token") String token, + @Parameter(description = "Book ID") @PathVariable String bookId + ) { if (StringUtils.isNumeric(bookId)) { KoboBookMetadata metadata = koboEntitlementService.getMetadataForBook(Long.parseLong(bookId), token);