fix(kobo): add endpoints for devices to run with proxy off (#1052)
This commit is contained in:
@@ -227,6 +227,31 @@ public class KoboController {
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@Operation(summary = "Get user profile", description = "Get Kobo user configuration.")
|
||||
@ApiResponse(responseCode = "200", description = "Retrieved Kobo User configuration")
|
||||
@GetMapping("/v1/user/profile")
|
||||
public ResponseEntity<?> getUserProfile() {
|
||||
if (isForwardingToKoboStore()) {
|
||||
return koboServerProxy.proxyCurrentRequest(null, false);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.body(KoboUserProfile.builder().build());
|
||||
|
||||
}
|
||||
|
||||
@Operation(summary = "Get Kobo Deals", description = "Get promotional deals on Kobo entitlements.")
|
||||
@ApiResponse(responseCode = "200", description = "Deals Retrieved successfully")
|
||||
@GetMapping("/v1/deals")
|
||||
public ResponseEntity<?> getDeals() {
|
||||
if (isForwardingToKoboStore()) {
|
||||
return koboServerProxy.proxyCurrentRequest(null, false);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.body(KoboDeals.builder().build());
|
||||
|
||||
}
|
||||
|
||||
@Operation(summary = "Catch-all for Kobo API", description = "Catch-all endpoint for unhandled Kobo API requests.")
|
||||
@ApiResponse(responseCode = "200", description = "Request proxied successfully")
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.booklore.model.dto.kobo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import tools.jackson.databind.PropertyNamingStrategies;
|
||||
import tools.jackson.databind.annotation.JsonNaming;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class KoboDeals {
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class KoboDealEntry {
|
||||
private String id;
|
||||
}
|
||||
|
||||
|
||||
@Builder.Default
|
||||
private List<KoboDealEntry> deals = List.of();
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.booklore.model.dto.kobo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import tools.jackson.databind.PropertyNamingStrategies;
|
||||
import tools.jackson.databind.annotation.JsonNaming;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class KoboUserProfile {
|
||||
@Builder.Default
|
||||
private String affiliateName = "Grimmory";
|
||||
|
||||
@Builder.Default
|
||||
private boolean isOneStore = false;
|
||||
|
||||
@Builder.Default
|
||||
private boolean isChildAccount = false;
|
||||
|
||||
@Builder.Default
|
||||
private boolean isLibraryMigrated = true;
|
||||
|
||||
@Builder.Default
|
||||
private boolean vipMembershipPurchased = true;
|
||||
|
||||
@Builder.Default
|
||||
private boolean hasPurchased = true;
|
||||
|
||||
@Builder.Default
|
||||
private boolean hasPurchasedBook = true;
|
||||
|
||||
@Builder.Default
|
||||
private boolean hasPurchasedAudiobook = false;
|
||||
|
||||
@Builder.Default
|
||||
private boolean safeSearch = false;
|
||||
|
||||
@Builder.Default
|
||||
private boolean audiobooksEnabled = false;
|
||||
|
||||
@Builder.Default
|
||||
private boolean isOrangeAffiliated = false;
|
||||
|
||||
@Builder.Default
|
||||
private boolean isEligibleForOrangeDeal = false;
|
||||
|
||||
@Builder.Default
|
||||
private String platformId = "00000000-0000-0000-0000-000000000001";
|
||||
|
||||
@Builder.Default
|
||||
private String partnerId = "00000000-0000-0000-0000-000000000001";
|
||||
|
||||
@Builder.Default
|
||||
private String koboCrmOptInSettings = "ExplicitlyConsentedNo";
|
||||
|
||||
@Builder.Default
|
||||
private List<String> privatePermissions = List.of();
|
||||
|
||||
@Builder.Default
|
||||
private List<String> linkedAccounts = List.of();
|
||||
}
|
||||
@@ -32,7 +32,9 @@ public class KoboInitializationService {
|
||||
Map.entry("library_search", new String[]{"v1", "library", "search"}),
|
||||
Map.entry("library_sync", new String[]{"v1", "library", "sync"}),
|
||||
Map.entry("post_analytics_event", new String[]{"v1", "analytics", "event"}),
|
||||
Map.entry("reading_state", new String[]{"v1", "library", "{Ids}", "state"})
|
||||
Map.entry("reading_state", new String[]{"v1", "library", "{Ids}", "state"}),
|
||||
Map.entry("user_profile", new String[]{"v1", "user", "profile"}),
|
||||
Map.entry("deals", new String[]{"v1", "deals"})
|
||||
);
|
||||
|
||||
private boolean isForwardingToKoboStore() {
|
||||
|
||||
Reference in New Issue
Block a user