Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Server

Notices

Reply
 
Thread Tools Search this Thread
Old 10-28-2018, 01:28 PM   #1
Gnoop
Junior Member
Gnoop began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2018
Device: none
url-prefix missing on some AJAX calls to calibre-server

Hello,

I'm running Calibre Server as a headless service on a Windows Server. To make the URLs more user-friendly, it sits behind a reverse proxy that redirects all requests for HTTP://SERVER:PORT/* to HTTP://SERVER/BOOKS/* and I am using the "--url-prefix" argument to request that Calibre output URLs pointing to the redirected site.

This works fine for general browsing; I can go to the root of the site, select a library, and browse and download books as expected. However, when I try to use the conversion feature for a book (which I am very thankful for, BTW, as we are a multi-format household) it allows me to select conversion options but fails with a 404 error when I click the "start conversion" button.

Looking at the HTTP traffic for a session, I see the following:

http://SERVER/BOOKS/ajax-setup?1540746967583
http://SERVER/BOOKS/interface-data/update?1540746967830
http://SERVER/BOOKS/interface-data/b...&1540746967840
http://SERVER/BOOKS/conversion/book-...&1540746976371
http://SERVER/BOOKS/conversion/book-...&1540746979428

but the action of clicking the "start conversion" button makes a call to:

http://SERVER/conversion/start/8?lib...uthor_sort.asc

I had a quick look at the source code, and the endpoints defined in server/convert.py look sensible; my only thought was that there are two functions in server/routes.py called "url_for" and only one of them seems to explicitly add the url prefix.

Any suggestions?

Thanks for an incredibly useful program!
Gnoop is offline   Reply With Quote
Old 10-28-2018, 08:00 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
that should take care of it: https://github.com/kovidgoyal/calibr...5b972e8189625c
kovidgoyal is offline   Reply With Quote
Old 10-29-2018, 01:03 PM   #3
Gnoop
Junior Member
Gnoop began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2018
Device: none
A quick fix, and from the man himself! I am honored.

Thank you again for making such a useful program freely available.
Gnoop is offline   Reply With Quote
Old 11-11-2018, 06:10 AM   #4
Gnoop
Junior Member
Gnoop began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2018
Device: none
Well, it almost worked. I waited for the official release to install and test, and when I ran it the conversion made it past the first AJAX call and failed at the second.

I think the leading forward-slash needs to be removed also from Line 132 of src/pyj/book_list/convert_book.pyj:

ajax_send(f'/conversion/status/{conversion_data.job_id}', data, on_conversion_status, query=query)

Thanks again.
Gnoop is offline   Reply With Quote
Old 11-11-2018, 10:39 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Oops, sorry now done.
kovidgoyal is offline   Reply With Quote
Old 12-07-2018, 07:11 AM   #6
Gnoop
Junior Member
Gnoop began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2018
Device: none
...and I can confirm that it is now working in the released version 3.35.0.

I notice though that the converted book does not appear in the web catalog until the current browser session is closed and a new one established. Is this the intended behavior?

Thanks again.
Gnoop is offline   Reply With Quote
Old 12-07-2018, 07:23 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
you might need to hit refresh in the browser, shouldn't need to start a new session.
kovidgoyal is offline   Reply With Quote
Old 12-07-2018, 09:00 AM   #8
Gnoop
Junior Member
Gnoop began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2018
Device: none
OK, I didn't try F5; I just clicked on the 'x' to close the conversion dialog and then wandered around within the existing session looking but not finding the just-converted book.
Gnoop is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre server REST API (ajax) ZioNemo Calibre 3 10-27-2017 07:11 AM
Calibre companion, calibre-server, and url-prefix: A question for the dev duckpuppy Calibre Companion 4 10-10-2016 09:05 AM
Calibre GUI content server url-prefix ilovejedd Calibre 5 02-07-2012 11:07 PM
Content Server url prefix not working Caleb666 Calibre 3 09-04-2011 11:43 AM
Content Server --url-prefix danorum Calibre 8 12-12-2010 12:02 AM


All times are GMT -4. The time now is 01:48 PM.


MobileRead.com is a privately owned, operated and funded community.