diff --git a/app/classes/web/base_handler.py b/app/classes/web/base_handler.py index c06e8afc..89ad88ce 100644 --- a/app/classes/web/base_handler.py +++ b/app/classes/web/base_handler.py @@ -17,6 +17,22 @@ bearer_pattern = re.compile(r"^Bearer ", flags=re.IGNORECASE) class BaseHandler(tornado.web.RequestHandler): + nobleach = {bool, type(None)} + redactables = ("pass", "api") + + helper: Helpers + controller: Controller + translator: Translation + + # noinspection PyAttributeOutsideInit + def initialize( + self, helper=None, controller=None, tasks_manager=None, translator=None + ): + self.helper = helper + self.controller = controller + self.tasks_manager = tasks_manager + self.translator = translator + def set_default_headers(self) -> None: """ Fix CORS @@ -38,22 +54,6 @@ class BaseHandler(tornado.web.RequestHandler): self.set_status(204) self.finish() - nobleach = {bool, type(None)} - redactables = ("pass", "api") - - helper: Helpers - controller: Controller - translator: Translation - - # noinspection PyAttributeOutsideInit - def initialize( - self, helper=None, controller=None, tasks_manager=None, translator=None - ): - self.helper = helper - self.controller = controller - self.tasks_manager = tasks_manager - self.translator = translator - def get_remote_ip(self): remote_ip = ( self.request.headers.get("X-Real-IP") diff --git a/app/classes/web/public_handler.py b/app/classes/web/public_handler.py index 66e95bbb..1d35e706 100644 --- a/app/classes/web/public_handler.py +++ b/app/classes/web/public_handler.py @@ -32,18 +32,15 @@ class PublicHandler(BaseHandler): error = bleach.clean(self.get_argument("error", "Invalid Login!")) error_msg = bleach.clean(self.get_argument("error_msg", "")) - try: - page_data = { - "version": self.helper.get_version_string(), - "error": error, - "lang": self.helper.get_setting("language"), - "lang_page": self.helper.get_lang_page( - self.helper.get_setting("language") - ), - "query": "", - } - except: - self.redirect("/public/login.html") + + page_data = { + "version": self.helper.get_version_string(), + "error": error, + "lang": self.helper.get_setting("language"), + "lang_page": self.helper.get_lang_page(self.helper.get_setting("language")), + "query": "", + } + if self.request.query: page_data["query"] = self.request.query diff --git a/app/classes/web/tornado_handler.py b/app/classes/web/tornado_handler.py index 32385ab5..9394fa42 100644 --- a/app/classes/web/tornado_handler.py +++ b/app/classes/web/tornado_handler.py @@ -179,7 +179,7 @@ class Webserver: xsrf_cookies=True, autoreload=False, log_function=self.log_function, - login_url="/login", + login_url="/public/login", default_handler_class=PublicHandler, static_handler_class=CustomStaticHandler, serve_traceback=debug_errors, @@ -205,7 +205,7 @@ class Webserver: autoreload=False, log_function=self.log_function, default_handler_class=HTTPHandler, - login_url="/login", + login_url="/public/login", serve_traceback=debug_errors, ) diff --git a/app/frontend/templates/base.html b/app/frontend/templates/base.html index dfed94d2..0ef79be5 100755 --- a/app/frontend/templates/base.html +++ b/app/frontend/templates/base.html @@ -15,7 +15,7 @@ + href="https://cdn.datatables.net/v/bs4/dt-1.10.22/fh-3.1.7/r-2.2.6/sc-2.0.3/sp-1.2.2/datatables.min.css" /> @@ -67,7 +67,7 @@ {% include notify.html %} @@ -158,7 +158,7 @@ + src="https://cdn.datatables.net/v/bs4/dt-1.10.22/fh-3.1.7/r-2.2.6/sc-2.0.3/sp-1.2.2/datatables.min.js"> @@ -315,8 +315,8 @@ x.remove() } bootbox.confirm({ - title: '{% raw translate("error", "eulaTitle", data['lang']) %}', - message: '{% raw translate("error", "eulaMsg", data['lang']) %}

EULA

{% raw translate("error", "eulaAgree", data['lang']) %}', + title: "{% raw translate('error', 'eulaTitle', data['lang']) %}", + message: "{% raw translate('error', 'eulaMsg', data['lang']) %}

EULA

{% raw translate('error', 'eulaAgree', data['lang']) %}", buttons: { confirm: { label: 'Yes', @@ -450,7 +450,7 @@ console.log('%c[Crafty Controller] %cReady for JS!', 'font-weight: 900; color: #800080;', 'font-weight: 900; color: #eee;'); $('#support_logs').click(function () { var dialog = bootbox.dialog({ - message: '

{{ translate('notify', 'preparingLogs', data['lang']) }}

', + message: "

{{ translate('notify', 'preparingLogs', data['lang']) }}

", closeButton: false }); setTimeout(function () { diff --git a/app/frontend/templates/panel/server_backup.html b/app/frontend/templates/panel/server_backup.html index c5887e4f..eb820086 100644 --- a/app/frontend/templates/panel/server_backup.html +++ b/app/frontend/templates/panel/server_backup.html @@ -283,7 +283,7 @@ function restore_backup(filename, id) { var token = getCookie("_xsrf") var dialog = bootbox.dialog({ - message: ' {{ translate('serverBackups', 'restoring', data['lang']) }}', + message: " {{ translate('serverBackups', 'restoring', data['lang']) }}", closeButton: false });