Fix Kobo sync failure behind reverse proxy: rewrite library_sync URL in init response
The HandleInitRequest() function rewrites image URLs to point to the local Calibre-Web instance, but library_sync was left pointing to storeapi.kobo.com. This caused Kobo e-readers to call Kobo's servers for sync instead of the local server, resulting in no books being synced when running behind a reverse proxy.
This commit is contained in:
@@ -1101,6 +1101,8 @@ def HandleInitRequest():
|
||||
width="{width}",
|
||||
height="{height}",
|
||||
isGreyscale='false'))
|
||||
kobo_resources["library_sync"] = calibre_web_url + url_for("kobo.HandleSyncRequest",
|
||||
auth_token=kobo_auth.get_auth_token())
|
||||
else:
|
||||
kobo_resources["image_host"] = url_for("web.index", _external=True).strip("/")
|
||||
kobo_resources["image_url_quality_template"] = unquote(url_for("kobo.HandleCoverImageRequest",
|
||||
@@ -1118,6 +1120,9 @@ def HandleInitRequest():
|
||||
height="{height}",
|
||||
isGreyscale='false',
|
||||
_external=True))
|
||||
kobo_resources["library_sync"] = url_for("kobo.HandleSyncRequest",
|
||||
auth_token=kobo_auth.get_auth_token(),
|
||||
_external=True)
|
||||
|
||||
response = make_response(jsonify({"Resources": kobo_resources}))
|
||||
response.headers["x-kobo-apitoken"] = "e30="
|
||||
|
||||
Reference in New Issue
Block a user