diff --git a/src/calibre/srv/handler.py b/src/calibre/srv/handler.py index ea5c63e507..c657be4300 100644 --- a/src/calibre/srv/handler.py +++ b/src/calibre/srv/handler.py @@ -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() diff --git a/src/calibre/srv/legacy.py b/src/calibre/srv/legacy.py new file mode 100644 index 0000000000..4eb0b9b741 --- /dev/null +++ b/src/calibre/srv/legacy.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPLv3 Copyright: 2016, Kovid Goyal + +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 '/') +