Update about page

- Show more software versions in debug mode (only)
- Add license links and information
This commit is contained in:
Jonas Schäfer
2021-01-21 17:01:04 +01:00
parent b6188ed29f
commit ff870ae71e
7 changed files with 209 additions and 52 deletions

View File

@@ -32,3 +32,6 @@ ignore_missing_imports = True
[mypy-environ.*]
ignore_missing_imports = True
[mypy-babel.*]
ignore_missing_imports = True

View File

@@ -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")

View File

@@ -1,26 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>About Snikket</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/app.css') }}">
</head>
<body>
<main>
<div class="box el-2">
<h1>About Snikket</h1>
<p>To learn more about Snikket, visit the <a href="https://snikket.org">Snikket website</a>.</p>
<h2>About this Server</h2>
<p>This is the Snikket server <em>{{ config["SNIKKET_DOMAIN"] }}</em>.</p>
<h3>Software Versions</h3>
<pre>Snikket Server (unknown)
Snikket Web Portal ({{ version }})</pre>
{# <h3>Partial configuration</h3>
<pre>SNIKKET_DOMAIN = {{ config.get("SNIKKET_DOMAIN") | repr }}
AVATAR_CACHE_TTL = {{ config.get("AVATAR_CACHE_TTL") | repr }}
SECRET_KEY = &lt;hidden&gt;
PROSODY_ENDPOINT = &lt;hidden&gt;</pre> #}
<p><a href="{{ url_for('.home') }}" class="button primary">Back to main page</a></pa>
</div>
</main>
</body>
</html>
{% extends "base.html" %}
{% from "library.j2" import standard_button %}
{% block head_lead %}
<title>About Snikket</title>
{% endblock %}
{% block body %}
<main>
<div class="box el-2">
<h1>{% trans %}About Snikket{% endtrans %}</h1>
<p>{% trans snikket_url="https://snikket.org" %}To learn more about Snikket, visit the <a href="{{ snikket_url}}">Snikket website</a>.{% endtrans %}</p>
<h2>{% trans %}About this Server{% endtrans %}</h2>
<p>{% trans domain=config["SNIKKET_DOMAIN"] %}This is the Snikket server <em>{{ domain }}</em>.{% endtrans %}</p>
<h3>{% trans %}Licenses{% endtrans %}</h3>
<p>{% trans agpl_url="https://www.gnu.org/licenses/agpl.html" %}The web portal software is licensed under the terms of the <a href="{{ agpl_url }}">Affero GNU General Public License, version 3.0 or later</a>. The full terms of the license can be reviewed using the aforementioned link.{% endtrans %}</p>
<p>{% trans source_url="https://github.com/snikket-im/snikket-web-portal/" %}The source code of the web portal can be downloaded and viewed in <a href="{{ source_url }}">its GitHub repository</a>.{% endtrans %}</p>
<p>{% 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 <a href="{{ source_url }}">Googles Material Icons</a>, made available by Google under the terms of the <a href="{{ apache20_url }}">Apache 2.0 License</a>.{% endtrans %}</p>
<h3>{% trans %}Software Versions{% endtrans %}</h3>
<pre>Snikket Server (unknown)
Snikket Web Portal ({{ version }})
{%- if extra_versions -%}
{% for name, version in extra_versions.items() %}
{{ name }} ({{ version }}){% endfor %}
{%- endif -%}</pre>
<p>
{%- call standard_button("back", url_for("index"), class="primary") -%}
{% trans %}Back to the main page{% endtrans %}
{%- endcall -%}
</p>
</div>
</main>
{% endblock %}

View File

@@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
{% block style %}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/common.css') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/app.css') }}">
{% endblock %}
</head>
<body{% if body_id | default(False) %} id="{{ body_id }}"{% endif %}{% if body_class | default(False) %} class="{{ body_class }}"{% endif %}>{% block body %}{% endblock %}</body>

View File

@@ -1,9 +1,5 @@
{% extends "base.html" %}
{% from "library.j2" import box, form_button %}
{% block style %}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/app.css') }}">
{{ super() }}
{% endblock %}
{% block body %}
<div id="topbar" class="{% block topbar_classes %}{% endblock %}">
<header><a href="{{ url_for('.index') }}"><span>{{ config["SNIKKET_DOMAIN"] }}</span></a></header>
@@ -13,6 +9,10 @@
</div>
<div id="mwrap"><main>{% block content %}{% endblock %}</main></div>
<footer>
<ul><li>{% trans about_url=url_for('main.about') %}A <a href="{{ about_url }}">Snikket</a> server{% endtrans %}</li></ul>
<ul>
{#- -#}
<li>{% trans about_url=url_for('main.about') %}A <a href="{{ about_url }}">Snikket</a> server{% endtrans %}</li>
{#- -#}
</ul>
</footer>
{% endblock %}

View File

@@ -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 <jonas@zombofant.net>\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 <a "
"href=\"%(snikket_url)s\">Snikket website</a>."
msgstr ""
"Um mehr über Snikket zu erfahren, kannst du die <a "
"href=\"%(snikket_url)s\">Snikket website</a> 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 <em>%(domain)s</em>."
msgstr "Dies ist der Snikket-Server <em>%(domain)s</em>."
#: 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 <a "
"href=\"%(agpl_url)s\">Affero GNU General Public License, version 3.0 or "
"later</a>. The full terms of the license can be reviewed using the "
"aforementioned link."
msgstr ""
"Die Webportal-Software wird unter den Bedingungen der <a "
"href=\"%(agpl_url)s\">Affero GNU General Public License, Version 3.0 oder"
" neuer</a> 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 <a "
"href=\"%(source_url)s\">its GitHub repository</a>."
msgstr ""
"Der Quelltext des Webportals kann aus dem <a href=\"%(source_url)s"
"\">GitHub-Repository der Software</a> heruntergeladen und eingesehen "
"werden."
#: snikket_web/templates/about.html:16
#, python-format
msgid ""
"The icons used in the web portal are <a href=\"%(source_url)s\">Googles "
"Material Icons</a>, made available by Google under the terms of the <a "
"href=\"%(apache20_url)s\">Apache 2.0 License</a>."
msgstr ""
"Die im Webportal verwendeten Icons sind <a "
"href=\"%(source_url)s\">Googles Material Icons</a>, welche von Google "
"unter den Bedingungen der <a href=\"%(apache20_url)s\">Apache 2.0 "
"Lizenz</a> 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 <a href=\"%(about_url)s\">Snikket</a> server"
msgstr "Ein <a href=\"%(about_url)s\">Snikket</a>-Server"

View File

@@ -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 <EMAIL@ADDRESS>\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 <a "
"href=\"%(snikket_url)s\">Snikket website</a>."
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 <em>%(domain)s</em>."
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 <a "
"href=\"%(agpl_url)s\">Affero GNU General Public License, version 3.0 or "
"later</a>. 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 <a "
"href=\"%(source_url)s\">its GitHub repository</a>."
msgstr ""
#: snikket_web/templates/about.html:16
#, python-format
msgid ""
"The icons used in the web portal are <a href=\"%(source_url)s\">Googles "
"Material Icons</a>, made available by Google under the terms of the <a "
"href=\"%(apache20_url)s\">Apache 2.0 License</a>."
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 <a href=\"%(about_url)s\">Snikket</a> server"
msgstr ""
@@ -599,3 +655,13 @@ msgstr ""
#~ msgid "Log in"
#~ msgstr ""
#~ msgid ""
#~ "This server software is licensed under"
#~ " the terms of the <a "
#~ "href=\"%(agpl_url)s\">Affero GNU General Public "
#~ "License, version 3.0 or later</a>. The"
#~ " full terms of the license can "
#~ "be reviewed using the aforementioned "
#~ "link."
#~ msgstr ""