summaryrefslogtreecommitdiff
path: root/src/koszko_org_website/app.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/koszko_org_website/app.py')
-rw-r--r--src/koszko_org_website/app.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/koszko_org_website/app.py b/src/koszko_org_website/app.py
index b551f21..2d1501c 100644
--- a/src/koszko_org_website/app.py
+++ b/src/koszko_org_website/app.py
@@ -118,12 +118,23 @@ class Website(flask.Flask):
website_app = Website()
+redirected_to_main_page = {
+ PurePosixPath("qr.html"),
+ PurePosixPath("author.html"),
+ PurePosixPath("koszko.html")
+}
+
def show_page(lang_short: str, page_path: str) -> str:
- for segment in PurePosixPath(page_path).parts:
+ pure_page_path = PurePosixPath(page_path)
+
+ for segment in pure_page_path.parts:
if segment.startswith('__'):
flask.abort(404)
- effective_page_path = '__index.html' if page_path == '' else page_path
+ if pure_page_path in redirected_to_main_page:
+ return flask.redirect(f'/{lang_short}/')
+
+ effective_page_path = page_path if page_path else '__index.html'
app = t.cast(Website, flask.current_app)
app.koszko_install_translations(langs_short_2_long[lang_short])