mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Redirects for legacy URLs
This commit is contained in:
parent
fab5424b7a
commit
1be07c21d9
@ -173,7 +173,7 @@ class Handler(object):
|
||||
prefer_basic_auth = {'auto':has_ssl, 'basic':True}.get(opts.auth_mode, 'digest')
|
||||
self.auth_controller = AuthController(user_credentials=ctx.user_manager, prefer_basic_auth=prefer_basic_auth)
|
||||
self.router = Router(ctx=ctx, url_prefix=opts.url_prefix, auth_controller=self.auth_controller)
|
||||
for module in ('content', 'ajax', 'code'):
|
||||
for module in ('content', 'ajax', 'code', 'legacy'):
|
||||
module = import_module('calibre.srv.' + module)
|
||||
self.router.load_routes(vars(module).itervalues())
|
||||
self.router.finalize()
|
||||
|
19
src/calibre/srv/legacy.py
Normal file
19
src/calibre/srv/legacy.py
Normal file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import,
|
||||
print_function)
|
||||
|
||||
|
||||
from calibre.srv.errors import HTTPRedirect
|
||||
from calibre.srv.routes import endpoint
|
||||
|
||||
@endpoint('/browse/{+rest=""}')
|
||||
def browse(ctx, rd, rest):
|
||||
raise HTTPRedirect(ctx.url_for('') or '/')
|
||||
|
||||
@endpoint('/mobile/{+rest=""}')
|
||||
def mobile(ctx, rd, rest):
|
||||
raise HTTPRedirect(ctx.url_for('') or '/')
|
||||
|
Loading…
x
Reference in New Issue
Block a user