This commit is contained in:
Geremia 2017-12-13 14:37:06 -07:00
parent a9589b8983
commit 7499637ce6

View File

@ -251,8 +251,19 @@ def mobile(ctx, rd):
@endpoint('/browse/{+rest=""}')
def browse(ctx, rd, rest):
raise HTTPRedirect(ctx.url_for(None))
def browse(ctx, rd, rest): # implementation of https://bugs.launchpad.net/calibre/+bug/1698411
if rest.find('book/') == 0:
redirect = ctx.url_for(None) + '#book_id=' + rest[5:] + "&panel=book_details"
from lxml import etree as ET
return html(ctx, rd, endpoint,
E.html(E.head(
ET.XML('<meta http-equiv="refresh" content="0;url=' + redirect + '"/>'),
ET.XML('<script language="javascript">' +
'window.location.href = "' + redirect + '"' +
'</script>'
))))
else:
raise HTTPRedirect(ctx.url_for(None))
@endpoint('/stanza/{+rest=""}')