diff --git a/mypy.ini b/mypy.ini index 07cdf21..be3d0eb 100644 --- a/mypy.ini +++ b/mypy.ini @@ -32,3 +32,6 @@ ignore_missing_imports = True [mypy-environ.*] ignore_missing_imports = True + +[mypy-babel.*] +ignore_missing_imports = True diff --git a/snikket_web/main.py b/snikket_web/main.py index a42297e..b7322ec 100644 --- a/snikket_web/main.py +++ b/snikket_web/main.py @@ -4,6 +4,8 @@ import typing from datetime import datetime, timedelta +import aiohttp + import quart import quart.flask_patch from quart import ( @@ -15,10 +17,12 @@ from quart import ( Response, ) +import babel import wtforms import flask_wtf +import flask_babel from flask_babel import lazy_gettext as _l, _ from . import xmpputil, _version @@ -44,6 +48,11 @@ class LoginForm(flask_wtf.FlaskForm): # type:ignore ) +@bp.route("/-") +async def index() -> quart.Response: + return redirect(url_for("index")) + + @bp.route("/login", methods=["GET", "POST"]) async def login() -> typing.Union[str, quart.Response]: if client.has_session and (await client.test_session()): @@ -69,17 +78,21 @@ async def login() -> typing.Union[str, quart.Response]: return await render_template("login.html", form=form) -@bp.route("/") -async def home() -> quart.Response: - if client.has_session: - return redirect(url_for('user.index')) - - return redirect(url_for('.login')) - - @bp.route("/meta/about.html") async def about() -> str: - return await render_template("about.html", version=_version.version) + extra_versions = {} + if current_app.debug: + extra_versions["Quart"] = quart.__version__ + extra_versions["aiohttp"] = aiohttp.__version__ + extra_versions["babel"] = babel.__version__ + extra_versions["wtforms"] = wtforms.__version__ + extra_versions["flask-wtf"] = flask_wtf.__version__ + + return await render_template( + "about.html", + version=_version.version, + extra_versions=extra_versions, + ) @bp.route("/meta/demo.html") diff --git a/snikket_web/templates/about.html b/snikket_web/templates/about.html index 022ad37..317858d 100644 --- a/snikket_web/templates/about.html +++ b/snikket_web/templates/about.html @@ -1,26 +1,31 @@ - - - - About Snikket - - - -
-
-

About Snikket

-

To learn more about Snikket, visit the Snikket website.

-

About this Server

-

This is the Snikket server {{ config["SNIKKET_DOMAIN"] }}.

-

Software Versions

-
Snikket Server (unknown)
-Snikket Web Portal ({{ version }})
- {#

Partial configuration

-
SNIKKET_DOMAIN = {{ config.get("SNIKKET_DOMAIN") | repr }}
-AVATAR_CACHE_TTL = {{ config.get("AVATAR_CACHE_TTL") | repr }}
-SECRET_KEY = <hidden>
-PROSODY_ENDPOINT = <hidden>
#} -

Back to main page -

-
- - +{% extends "base.html" %} +{% from "library.j2" import standard_button %} +{% block head_lead %} +About Snikket +{% endblock %} +{% block body %} +
+
+

{% trans %}About Snikket{% endtrans %}

+

{% trans snikket_url="https://snikket.org" %}To learn more about Snikket, visit the Snikket website.{% endtrans %}

+

{% trans %}About this Server{% endtrans %}

+

{% trans domain=config["SNIKKET_DOMAIN"] %}This is the Snikket server {{ domain }}.{% endtrans %}

+

{% trans %}Licenses{% endtrans %}

+

{% trans agpl_url="https://www.gnu.org/licenses/agpl.html" %}The web portal software is licensed under the terms of the Affero GNU General Public License, version 3.0 or later. The full terms of the license can be reviewed using the aforementioned link.{% endtrans %}

+

{% trans source_url="https://github.com/snikket-im/snikket-web-portal/" %}The source code of the web portal can be downloaded and viewed in its GitHub repository.{% endtrans %}

+

{% trans source_url="https://material.io/resources/icons/", apache20_url="https://www.apache.org/licenses/LICENSE-2.0.txt" %}The icons used in the web portal are Google’s Material Icons, made available by Google under the terms of the Apache 2.0 License.{% endtrans %}

+

{% trans %}Software Versions{% endtrans %}

+
Snikket Server (unknown)
+Snikket Web Portal ({{ version }})
+{%- if extra_versions -%}
+{% for name, version in extra_versions.items() %}
+{{ name }} ({{ version }}){% endfor %}
+{%- endif -%}
+

+ {%- call standard_button("back", url_for("index"), class="primary") -%} + {% trans %}Back to the main page{% endtrans %} + {%- endcall -%} +

+
+
+{% endblock %} diff --git a/snikket_web/templates/base.html b/snikket_web/templates/base.html index 769ea82..af4a1ef 100644 --- a/snikket_web/templates/base.html +++ b/snikket_web/templates/base.html @@ -6,6 +6,7 @@ {% block style %} + {% endblock %} {% block body %}{% endblock %} diff --git a/snikket_web/templates/unauth.html b/snikket_web/templates/unauth.html index a6767b5..fcb6936 100644 --- a/snikket_web/templates/unauth.html +++ b/snikket_web/templates/unauth.html @@ -1,9 +1,5 @@ {% extends "base.html" %} {% from "library.j2" import box, form_button %} -{% block style %} - -{{ super() }} -{% endblock %} {% block body %}
{{ config["SNIKKET_DOMAIN"] }}
@@ -13,6 +9,10 @@
{% block content %}{% endblock %}
{% endblock %} diff --git a/snikket_web/translations/de/LC_MESSAGES/messages.po b/snikket_web/translations/de/LC_MESSAGES/messages.po index 3c6c4aa..79c7b39 100644 --- a/snikket_web/translations/de/LC_MESSAGES/messages.po +++ b/snikket_web/translations/de/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: SnikketWeb 0.1.0\n" "Report-Msgid-Bugs-To: jonas@zombofant.net\n" -"POT-Creation-Date: 2021-01-21 16:56+0100\n" +"POT-Creation-Date: 2021-01-21 17:00+0100\n" "PO-Revision-Date: 2020-03-07 16:32+0100\n" "Last-Translator: Jonas Schäfer \n" "Language: de\n" @@ -86,19 +86,19 @@ msgstr "Gemeinschaft endgültig löschen" msgid "Main" msgstr "Kern" -#: snikket_web/main.py:33 +#: snikket_web/main.py:37 msgid "Address" msgstr "Adresse" -#: snikket_web/main.py:38 +#: snikket_web/main.py:42 msgid "Password" msgstr "Passwort" -#: snikket_web/main.py:43 +#: snikket_web/main.py:47 msgid "Sign in" msgstr "Anmelden" -#: snikket_web/main.py:64 +#: snikket_web/main.py:73 msgid "Invalid user name or password." msgstr "Benutzername oder Passwort falsch." @@ -152,6 +152,75 @@ msgstr "Profilsichtbarkeit" msgid "Incorrect password" msgstr "Ungültiges Passwort" +#: snikket_web/templates/about.html:9 +msgid "About Snikket" +msgstr "Über Snikket" + +#: snikket_web/templates/about.html:10 +#, python-format +msgid "" +"To learn more about Snikket, visit the Snikket website." +msgstr "" +"Um mehr über Snikket zu erfahren, kannst du die Snikket website besuchen" + +#: snikket_web/templates/about.html:11 +msgid "About this Server" +msgstr "Über diesen Server" + +#: snikket_web/templates/about.html:12 +#, python-format +msgid "This is the Snikket server %(domain)s." +msgstr "Dies ist der Snikket-Server %(domain)s." + +#: snikket_web/templates/about.html:13 +msgid "Licenses" +msgstr "Lizenzen" + +#: snikket_web/templates/about.html:14 +#, python-format +msgid "" +"The web portal software is licensed under the terms of the Affero GNU General Public License, version 3.0 or " +"later. The full terms of the license can be reviewed using the " +"aforementioned link." +msgstr "" +"Die Webportal-Software wird unter den Bedingungen der Affero GNU General Public License, Version 3.0 oder" +" neuer zur Verfügung gestellt. Die gesamten Nutzungsbedingungen " +"können unter dem vorherstehenden Link eingesehen werden." + +#: snikket_web/templates/about.html:15 +#, python-format +msgid "" +"The source code of the web portal can be downloaded and viewed in its GitHub repository." +msgstr "" +"Der Quelltext des Webportals kann aus dem GitHub-Repository der Software heruntergeladen und eingesehen " +"werden." + +#: snikket_web/templates/about.html:16 +#, python-format +msgid "" +"The icons used in the web portal are Google’s " +"Material Icons, made available by Google under the terms of the Apache 2.0 License." +msgstr "" +"Die im Webportal verwendeten Icons sind Google’s Material Icons, welche von Google " +"unter den Bedingungen der Apache 2.0 " +"Lizenz bereitgestellt werden." + +#: snikket_web/templates/about.html:17 +msgid "Software Versions" +msgstr "Softwareversionen" + +#: snikket_web/templates/about.html:26 +msgid "Back to the main page" +msgstr "Zurück zur Hauptseite" + #: snikket_web/templates/admin_circles.html:4 #: snikket_web/templates/admin_home.html:11 msgid "Manage circles" @@ -518,7 +587,7 @@ msgstr "Gib deine Snikket-Adresse und -Passwort ein um dein Konto zu verwalten." msgid "Login failed" msgstr "Anmeldung fehlgeschlagen" -#: snikket_web/templates/login.html:36 snikket_web/templates/unauth.html:16 +#: snikket_web/templates/login.html:36 snikket_web/templates/unauth.html:14 #, python-format msgid "A Snikket server" msgstr "Ein Snikket-Server" diff --git a/snikket_web/translations/en/LC_MESSAGES/messages.po b/snikket_web/translations/en/LC_MESSAGES/messages.po index fb4bfdb..6e4ef1f 100644 --- a/snikket_web/translations/en/LC_MESSAGES/messages.po +++ b/snikket_web/translations/en/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-01-21 16:56+0100\n" +"POT-Creation-Date: 2021-01-21 17:00+0100\n" "PO-Revision-Date: 2020-03-07 16:50+0100\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -86,19 +86,19 @@ msgstr "" msgid "Main" msgstr "" -#: snikket_web/main.py:33 +#: snikket_web/main.py:37 msgid "Address" msgstr "" -#: snikket_web/main.py:38 +#: snikket_web/main.py:42 msgid "Password" msgstr "" -#: snikket_web/main.py:43 +#: snikket_web/main.py:47 msgid "Sign in" msgstr "" -#: snikket_web/main.py:64 +#: snikket_web/main.py:73 #, fuzzy msgid "Invalid user name or password." msgstr "" @@ -154,6 +154,62 @@ msgstr "" msgid "Incorrect password" msgstr "" +#: snikket_web/templates/about.html:9 +msgid "About Snikket" +msgstr "" + +#: snikket_web/templates/about.html:10 +#, python-format +msgid "" +"To learn more about Snikket, visit the Snikket website." +msgstr "" + +#: snikket_web/templates/about.html:11 +msgid "About this Server" +msgstr "" + +#: snikket_web/templates/about.html:12 +#, python-format +msgid "This is the Snikket server %(domain)s." +msgstr "" + +#: snikket_web/templates/about.html:13 +msgid "Licenses" +msgstr "" + +#: snikket_web/templates/about.html:14 +#, python-format +msgid "" +"The web portal software is licensed under the terms of the Affero GNU General Public License, version 3.0 or " +"later. The full terms of the license can be reviewed using the " +"aforementioned link." +msgstr "" + +#: snikket_web/templates/about.html:15 +#, python-format +msgid "" +"The source code of the web portal can be downloaded and viewed in its GitHub repository." +msgstr "" + +#: snikket_web/templates/about.html:16 +#, python-format +msgid "" +"The icons used in the web portal are Google’s " +"Material Icons, made available by Google under the terms of the Apache 2.0 License." +msgstr "" + +#: snikket_web/templates/about.html:17 +msgid "Software Versions" +msgstr "" + +#: snikket_web/templates/about.html:26 +msgid "Back to the main page" +msgstr "" + #: snikket_web/templates/admin_circles.html:4 #: snikket_web/templates/admin_home.html:11 msgid "Manage circles" @@ -503,7 +559,7 @@ msgstr "" msgid "Login failed" msgstr "" -#: snikket_web/templates/login.html:36 snikket_web/templates/unauth.html:16 +#: snikket_web/templates/login.html:36 snikket_web/templates/unauth.html:14 #, python-format msgid "A Snikket server" msgstr "" @@ -599,3 +655,13 @@ msgstr "" #~ msgid "Log in" #~ msgstr "" +#~ msgid "" +#~ "This server software is licensed under" +#~ " the terms of the Affero GNU General Public " +#~ "License, version 3.0 or later. The" +#~ " full terms of the license can " +#~ "be reviewed using the aforementioned " +#~ "link." +#~ msgstr "" +