Compare commits

...

11 Commits

Author SHA1 Message Date
Jonas Schäfer
85536d3748 Fix strange 308 error code when using slash-less invite
That seems to be some Quart-internal redirect which isn’t executed
correctly (probably due to our makeshift error handlers). So I
make this a proper redirect instead.
2021-02-06 15:06:15 +01:00
Jonas Schäfer
5b812c773d Fix footer on login page 2021-02-04 15:51:43 +01:00
Michał Mazur
fa61ee4e11 Update __init__.py
Wrong Polish language ISO code. That's probably why it doesn't work.
2021-02-04 14:37:51 +01:00
Jonas Schäfer
7402480c62 Allow / suffix on invite URLs
This makes them a bit more clickable in some user agents (think
email, xmpp) which have to rely on parsing to find and highlight
URLs.

Fixes #48.
2021-02-03 19:00:49 +01:00
Jonas Schäfer
a68a469319 Add extended trademark hints to the about page 2021-02-03 18:57:01 +01:00
Jonas Schäfer
961f285fa5 Add trademark info to the footer
Fixes #45.
2021-02-03 18:55:22 +01:00
Jonas Schäfer
7456295cb6 Make title red if running in debug
This (a) helps developers to not accidentally their production
server and (b) deters user from letting it run that way for long.
2021-02-03 18:50:36 +01:00
Jonas Schäfer
96f4b0d4f8 Make version info only available on admin or debug sessions 2021-02-03 18:47:21 +01:00
Jonas Schäfer
245434126e Bump version number for the next release 2021-02-03 18:44:18 +01:00
Jonas Schäfer
725dffc458 Reduce image size by approximately 65% 2021-02-03 18:36:31 +01:00
Jonas Schäfer
22783b837e Update readme screenshot 2021-02-03 18:30:38 +01:00
11 changed files with 39 additions and 42 deletions

View File

@@ -3,44 +3,28 @@ FROM debian:buster
ARG BUILD_SERIES=dev
ARG BUILD_ID=0
ENV DEBIAN_FRONTEND noninteractive
COPY requirements.txt /opt/snikket-web-portal/requirements.txt
COPY build-requirements.txt /opt/snikket-web-portal/build-requirements.txt
COPY Makefile /opt/snikket-web-portal/Makefile
COPY snikket_web/ /opt/snikket-web-portal/snikket_web
COPY babel.cfg /opt/snikket-web-portal/babel.cfg
# This Dockerfile attempts to strike a balance between image size and time it
# takes to do an incremental build on changes.
# Improvements welcome.
WORKDIR /opt/snikket-web-portal
RUN set -eu; \
export DEBIAN_FRONTEND=noninteractive ; \
apt-get update ; \
apt-get install -y --no-install-recommends \
python3 python3-pip python3-setuptools python3-wheel \
libpython3-dev \
make build-essential \
; \
apt-get clean ; rm -rf /var/lib/apt/lists
COPY requirements.txt /opt/snikket-web-portal/requirements.txt
COPY build-requirements.txt /opt/snikket-web-portal/build-requirements.txt
WORKDIR /opt/snikket-web-portal
RUN set -eu; \
pip3 install -r requirements.txt; \
pip3 install -r build-requirements.txt; \
rm -rf /root/.cache;
COPY Makefile /opt/snikket-web-portal/Makefile
COPY snikket_web/ /opt/snikket-web-portal/snikket_web
COPY babel.cfg /opt/snikket-web-portal/babel.cfg
# NOTE: abusing true(1) as a terrible way to disable a specific command. If
# one merged all the RUN commands into one, one would want to run the
# uninstall/remove commands there, but with the split up RUN commands it is
# rather pointless.
RUN set -eu; \
make; \
true pip3 uninstall -yr build-requirements.txt; \
true apt-get remove -y build-essential make libpython3-dev; \
true apt-get autoremove -y; \
pip3 uninstall -yr build-requirements.txt; \
apt-get remove -y build-essential make libpython3-dev; \
apt-get autoremove -y; \
pip3 install hypercorn; \
rm -rf /root/.cache; \
apt-get clean ; rm -rf /var/lib/apt/lists

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 421 KiB

View File

@@ -48,6 +48,7 @@ async def proc() -> typing.Dict[str, typing.Any]:
"text_to_css": colour.text_to_css,
"lang": infra.selected_locale(),
"user_info": user_info,
"is_in_debug_mode": current_app.debug,
}
@@ -148,7 +149,7 @@ class AppConfig:
"en",
"fr",
"id",
"po",
"pl",
], converter=autosplit)
apple_store_url = environ.var("")

View File

@@ -1,4 +1,4 @@
version_info = (0, 1, 0, "a0")
version_info = (0, 1, 1, "a0")
version = (
".".join(map(str, version_info[:3])) +
(f"-{version_info[3]}" if version_info[3] else "")

View File

@@ -48,6 +48,11 @@ def context() -> typing.Mapping[str, typing.Any]:
@bp.route("/<id_>")
async def view_old(id_: str) -> quart.Response:
return redirect(url_for(".view", id_=id_))
@bp.route("/<id_>/")
async def view(id_: str) -> str:
try:
invite = await client.get_public_invite_by_id(id_)

View File

@@ -79,8 +79,11 @@ async def login() -> typing.Union[str, quart.Response]:
@bp.route("/meta/about.html")
async def about() -> str:
version = None
extra_versions = {}
if current_app.debug:
if current_app.debug or client.is_admin_session:
version = _version.version
extra_versions["Quart"] = quart.__version__
extra_versions["aiohttp"] = aiohttp.__version__
extra_versions["babel"] = babel.__version__
@@ -89,7 +92,7 @@ async def about() -> str:
return await render_template(
"about.html",
version=_version.version,
version=version,
extra_versions=extra_versions,
)

View File

@@ -67,6 +67,10 @@ div#topbar {
font-size: $_top-h-size;
line-height: 1.5;
body.debug & {
color: red;
}
@media screen and (max-width: $small-screen-threshold) {
font-size: $_top-h-small-size;
}
@@ -134,22 +138,20 @@ body > footer {
background-color: $gray-100;
color: $gray-800;
padding: 0 $w-l1;
font-size: 92.21079115%;
ul {
display: block;
padding: 0;
margin: 0;
list-style-type: none;
text-align: center;
line-height: 1.6267076567643135;
}
li {
display: inline-block;
margin: $w-l1 0;
}
li:before {
content: '';
padding-right: $w-s2;
display: block;
margin: $w-s1 0;
}
a, a:visited, a:hover, a:active, a:focus {

View File

@@ -3,5 +3,7 @@
{#- -#}
<li>{% trans about_url=url_for('main.about') %}A <a href="{{ about_url }}">Snikket</a> service{% endtrans %}</li>
{#- -#}
<li>{% trans %}“Snikket” and the parrot logo are trademarks of Snikket Community Interest Company.{% endtrans %}</li>
{#- -#}
</ul>
</footer>

View File

@@ -14,10 +14,12 @@
<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 %}Trademarks{% endtrans %}</h3>
<p>{% trans trademarks_url="https://snikket.org/about/trademarks/" %}“Snikket” and the parrot logo are trademarks of Snikket Community Interest Company. For more information about the trademarks, visit the <a href="{{ trademarks_url }}">Snikket Trademarks information page</a>.{% endtrans %}
<h3>{% trans %}Software Versions{% endtrans %}</h3>
<pre>Snikket Server
Domain: {{ config["SNIKKET_DOMAIN"] }}
Snikket Web Portal ({{ version }})
Snikket Web Portal{% if version %} ({{ version }}){% endif %}
{%- if extra_versions -%}
{% for name, version in extra_versions.items() %}
{{ name }} ({{ version }}){% endfor %}

View File

@@ -16,5 +16,5 @@
<meta name="msapplication-TileColor" content="#fbd308">
<meta name="theme-color" content="#fbd308">
</head>
<body{% if body_id | default(False) %} id="{{ body_id }}"{% endif %}{% if body_class | default(False) %} class="{{ body_class }}"{% endif %}{% if onload | default(False) %} onload="{{ onload }}"{% endif %}>{% block body %}{% endblock %}</body>
<body{% if body_id | default(False) %} id="{{ body_id }}"{% endif %} class="{% if is_in_debug_mode %}debug{% endif %}{% if body_class | default(False) %} {{ body_class }}{% endif %}"{% if onload | default(False) %} onload="{{ onload }}"{% endif %}>{% block body %}{% endblock %}</body>
</html>

View File

@@ -32,7 +32,5 @@
</div>
</from>
</div></main></div>
<footer>
<ul><li>{% trans about_url=url_for('.about') %}A <a href="{{ about_url }}">Snikket</a> service{% endtrans %}</li></ul>
</footer>
{%- include "_footer.html" -%}
{% endblock %}