summaryrefslogtreecommitdiff
path: root/src/jwebmail/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/jwebmail/__init__.py')
-rw-r--r--src/jwebmail/__init__.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/jwebmail/__init__.py b/src/jwebmail/__init__.py
index c8be663..0298467 100644
--- a/src/jwebmail/__init__.py
+++ b/src/jwebmail/__init__.py
@@ -4,7 +4,7 @@ import sys
from os import environ
from babel import parse_locale
-from flask import Flask, abort, g
+from flask import Flask, abort, g, redirect, url_for
from flask_babel import Babel, get_locale
from flask_login import LoginManager, login_required
from jinja2 import ChainableUndefined
@@ -20,7 +20,6 @@ from .webmail import (
login,
logout,
move,
- rawmail,
readmail,
sendmail,
writemail,
@@ -35,7 +34,7 @@ else:
toml_read_file = dict(load=toml_load, text=True)
-__version__ = "2.0.0.dev5"
+__version__ = "2.1.0.dev0"
def validate_config(app):
@@ -111,10 +110,14 @@ def create_app():
def route(app):
- app.add_url_rule("/", view_func=login, methods=["GET", "POST"])
+ app.add_url_rule(
+ "/",
+ endpoint="root",
+ view_func=lambda: redirect(url_for("login", lang_code=get_locale().language)),
+ )
+
app.add_url_rule("/<lang_code>/", view_func=login, methods=["GET", "POST"])
- app.add_url_rule("/about", view_func=about)
app.add_url_rule("/<lang_code>/about", view_func=about)
app.add_url_rule("/<lang_code>/logout", view_func=logout)
@@ -131,14 +134,15 @@ def route(app):
"/<lang_code>/read/<folder>/<msgid>", endpoint="read", view_func=lr_readmail
)
- lr_rawmail = login_required(rawmail)
- app.add_url_rule("/raw/<msgid>", endpoint="raw", view_func=lr_rawmail)
- app.add_url_rule("/raw/<folder>/<msgid>", endpoint="raw", view_func=lr_rawmail)
-
lr_writemail = login_required(writemail)
app.add_url_rule("/<lang_code>/write", endpoint="write", view_func=lr_writemail)
app.add_url_rule(
- "/write", endpoint="send", view_func=login_required(sendmail), methods=["POST"]
+ "/<lang_code>/write",
+ endpoint="send",
+ view_func=login_required(sendmail),
+ methods=["POST"],
)
- app.add_url_rule("/move/<folder>", view_func=login_required(move), methods=["POST"])
+ app.add_url_rule(
+ "/<lang_code>/move/<folder>", view_func=login_required(move), methods=["POST"]
+ )