From 426d2b9b701f6a6d48ea6bf21812dcad7496713d Mon Sep 17 00:00:00 2001 From: lilly Date: Mon, 18 Nov 2024 21:43:28 +0100 Subject: [PATCH 1/4] fix start_db script credentials --- scripts/start_db.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/start_db.sh b/scripts/start_db.sh index 35d05bdd..977f8f3d 100755 --- a/scripts/start_db.sh +++ b/scripts/start_db.sh @@ -4,9 +4,9 @@ D=$(realpath $(dirname $0)/..) mkdir -p "$D/db-data" exec podman run \ --rm \ - -e POSTGRES_DB=mafiasi-dashboard \ - -e POSTGRES_USER=mafiasi-dashboard \ - -e POSTGRES_PASSWORD=mafiasi-dashboard \ + -e POSTGRES_DB=mafiasi_dashboard \ + -e POSTGRES_USER=mafiasi_dashboard \ + -e POSTGRES_PASSWORD=mafiasi_dashboard \ -v "$D/db-data:/var/lib/postgresql/data" \ -p 5432:5432 \ $@ \ From 656440d384b35dc399eff4475d890406eb055af1 Mon Sep 17 00:00:00 2001 From: lilly Date: Mon, 18 Nov 2024 21:43:53 +0100 Subject: [PATCH 2/4] update README.md to include a smal Developing section --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 3d0fb452..89194399 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,22 @@ pipenv run ./manage.py runserver If you are interested you can see how we deploy this service on our kubernetes cluster via `kustomization.yml`. The format is [kustomize](https://kustomize.io/). + +## Developing + +The dashboard application has been modularized and the default development configuration enables only those modules which can function in a local environment (i.e. no LDAP integration). + +Once dependencies have been installed (with pipenv), you must start a database with the provided `/scripts/start_db.sh` script. +This will bring up a postgres database that is persistet into the projects repository (but gitignored). + +Afterwards, a webserver can be brought up with either of the following commands: + +```shell +# directly on your system +./manage.py migrate +./manage.py runserver + +# in a podman container +podman build . -t mafiasi-dashboard +podman run -it --net=host -v (realpath .):/app/src/ --env-file .env.dev mafiasi-dashboard /app/src/manage.py runserver +``` From 554a8573d9a17a2d29335288c2d4c8bd38dfccae Mon Sep 17 00:00:00 2001 From: lilly Date: Mon, 18 Nov 2024 22:42:26 +0100 Subject: [PATCH 3/4] add stabile political message to dashboard --- locale/de_DE/LC_MESSAGES/django.po | 28 +++++++++--------- locale/en_US/LC_MESSAGES/django.po | 29 ++++++++++--------- locale/en_Uwu/LC_MESSAGES/django.po | 24 ++++++++-------- locale/fr_FR/LC_MESSAGES/django.po | 28 +++++++++--------- mafiasi/base/static/css/main.css | 20 +++++++++++++ mafiasi/base/static/js/stabile_message.mjs | 10 +++++++ mafiasi/base/templates/base.html | 6 ++++ mafiasi/base/templatetags/stabile_message.py | 30 ++++++++++++++++++++ 8 files changed, 123 insertions(+), 52 deletions(-) create mode 100644 mafiasi/base/static/js/stabile_message.mjs create mode 100644 mafiasi/base/templatetags/stabile_message.py diff --git a/locale/de_DE/LC_MESSAGES/django.po b/locale/de_DE/LC_MESSAGES/django.po index 21050648..9cbb8b3e 100644 --- a/locale/de_DE/LC_MESSAGES/django.po +++ b/locale/de_DE/LC_MESSAGES/django.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Mafiasi\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 09:35+0200\n" +"POT-Creation-Date: 2024-11-18 22:47+0100\n" "PO-Revision-Date: 2024-09-03 23:52+0200\n" "Last-Translator: Markus Neblung \n" "Language-Team: \n" @@ -39,51 +39,51 @@ msgstr "" "Bitte versuche es später nochmal. Falls das Problem bestehen bleibt, schaue " "auf unsere Fehlermeldeseite." -#: mafiasi/base/templates/base.html:47 +#: mafiasi/base/templates/base.html:48 msgid "Disable surprise" msgstr "Überraschung abschalten" -#: mafiasi/base/templates/base.html:57 +#: mafiasi/base/templates/base.html:58 msgid "Groups" msgstr "Gruppen" -#: mafiasi/base/templates/base.html:65 +#: mafiasi/base/templates/base.html:66 #: mafiasi/mailinglist/templates/mailinglist/show_list.html:46 msgid "Settings" msgstr "Einstellungen" -#: mafiasi/base/templates/base.html:68 +#: mafiasi/base/templates/base.html:69 #, python-format msgid "Logged in as %(username)s" msgstr "Angemeldet als %(username)s" -#: mafiasi/base/templates/base.html:71 +#: mafiasi/base/templates/base.html:72 msgid "Logout" msgstr "Abmelden" -#: mafiasi/base/templates/base.html:77 +#: mafiasi/base/templates/base.html:78 #: mafiasi/registration/templates/registration/request_account.html:38 #: mafiasi/registration/templates/registration/request_account.html:77 msgid "Register" msgstr "Registrieren" -#: mafiasi/base/templates/base.html:79 +#: mafiasi/base/templates/base.html:80 msgid "Login" msgstr "Login" -#: mafiasi/base/templates/base.html:108 +#: mafiasi/base/templates/base.html:109 msgid "Imprint" msgstr "Impressum" -#: mafiasi/base/templates/base.html:110 +#: mafiasi/base/templates/base.html:111 msgid "Data privacy statement" msgstr "Datenschutzerklärung" -#: mafiasi/base/templates/base.html:112 +#: mafiasi/base/templates/base.html:113 msgid "Technical info" msgstr "Technik" -#: mafiasi/base/templates/base.html:114 +#: mafiasi/base/templates/base.html:115 #: mafiasi/base/templates/base/problems.html:4 msgid "Problems?" msgstr "Probleme?" @@ -1563,7 +1563,9 @@ msgstr "Mensa" msgid "" "Look at what is available in the canteens and filter according to diet, " "allergens, etc." -msgstr "Schaue was es in den Mensen zu essen gibt und filtere nach Ernährungsweise, Allergenen usw." +msgstr "" +"Schaue was es in den Mensen zu essen gibt und filtere nach Ernährungsweise, " +"Allergenen usw." #: mafiasi/modulkompass/apps.py:11 msgid "Modulkompass" diff --git a/locale/en_US/LC_MESSAGES/django.po b/locale/en_US/LC_MESSAGES/django.po index 7906bfdc..b98b16e5 100644 --- a/locale/en_US/LC_MESSAGES/django.po +++ b/locale/en_US/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Mafiasi\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 09:35+0200\n" +"POT-Creation-Date: 2024-11-18 22:47+0100\n" "PO-Revision-Date: 2024-01-18 22:42+0100\n" "Last-Translator: Markus Neblung \n" "Language-Team: \n" @@ -31,51 +31,51 @@ msgid "" "href=\"%(problems_url)s\">problem reporting page." msgstr "" -#: mafiasi/base/templates/base.html:47 +#: mafiasi/base/templates/base.html:48 msgid "Disable surprise" msgstr "" -#: mafiasi/base/templates/base.html:57 +#: mafiasi/base/templates/base.html:58 msgid "Groups" msgstr "" -#: mafiasi/base/templates/base.html:65 +#: mafiasi/base/templates/base.html:66 #: mafiasi/mailinglist/templates/mailinglist/show_list.html:46 msgid "Settings" msgstr "" -#: mafiasi/base/templates/base.html:68 +#: mafiasi/base/templates/base.html:69 #, python-format msgid "Logged in as %(username)s" msgstr "" -#: mafiasi/base/templates/base.html:71 +#: mafiasi/base/templates/base.html:72 msgid "Logout" msgstr "" -#: mafiasi/base/templates/base.html:77 +#: mafiasi/base/templates/base.html:78 #: mafiasi/registration/templates/registration/request_account.html:38 #: mafiasi/registration/templates/registration/request_account.html:77 msgid "Register" msgstr "" -#: mafiasi/base/templates/base.html:79 +#: mafiasi/base/templates/base.html:80 msgid "Login" msgstr "" -#: mafiasi/base/templates/base.html:108 +#: mafiasi/base/templates/base.html:109 msgid "Imprint" msgstr "" -#: mafiasi/base/templates/base.html:110 +#: mafiasi/base/templates/base.html:111 msgid "Data privacy statement" msgstr "" -#: mafiasi/base/templates/base.html:112 +#: mafiasi/base/templates/base.html:113 msgid "Technical info" msgstr "" -#: mafiasi/base/templates/base.html:114 +#: mafiasi/base/templates/base.html:115 #: mafiasi/base/templates/base/problems.html:4 msgid "Problems?" msgstr "" @@ -1421,8 +1421,9 @@ msgstr "Canteen" msgid "" "Look at what is available in the canteens and filter according to diet, " "allergens, etc." -msgstr "Look at what is available in the canteens and filter according to diet, " - "allergens, etc." +msgstr "" +"Look at what is available in the canteens and filter according to diet, " +"allergens, etc." #: mafiasi/modulkompass/apps.py:11 msgid "Modulkompass" diff --git a/locale/en_Uwu/LC_MESSAGES/django.po b/locale/en_Uwu/LC_MESSAGES/django.po index b10ce52b..5b2620a2 100644 --- a/locale/en_Uwu/LC_MESSAGES/django.po +++ b/locale/en_Uwu/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Mafiasi\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 09:35+0200\n" +"POT-Creation-Date: 2024-11-18 22:47+0100\n" "PO-Revision-Date: 2024-01-09 22:14+0000\n" "Last-Translator: kritzl \n" "Language-Team: \n" @@ -42,51 +42,51 @@ msgstr "" "again later. If the problem persists, see our problem reporting page." -#: mafiasi/base/templates/base.html:47 +#: mafiasi/base/templates/base.html:48 msgid "Disable surprise" msgstr "Me no like this mess ._." -#: mafiasi/base/templates/base.html:57 +#: mafiasi/base/templates/base.html:58 msgid "Groups" msgstr "frens" -#: mafiasi/base/templates/base.html:65 +#: mafiasi/base/templates/base.html:66 #: mafiasi/mailinglist/templates/mailinglist/show_list.html:46 msgid "Settings" msgstr "Change me >﹏<" -#: mafiasi/base/templates/base.html:68 +#: mafiasi/base/templates/base.html:69 #, python-format msgid "Logged in as %(username)s" msgstr "U is %(username)s" -#: mafiasi/base/templates/base.html:71 +#: mafiasi/base/templates/base.html:72 msgid "Logout" msgstr "Bye bye 👋" -#: mafiasi/base/templates/base.html:77 +#: mafiasi/base/templates/base.html:78 #: mafiasi/registration/templates/registration/request_account.html:38 #: mafiasi/registration/templates/registration/request_account.html:77 msgid "Register" msgstr "Become fren <3" -#: mafiasi/base/templates/base.html:79 +#: mafiasi/base/templates/base.html:80 msgid "Login" msgstr "Get inside" -#: mafiasi/base/templates/base.html:108 +#: mafiasi/base/templates/base.html:109 msgid "Imprint" msgstr "Pawprint" -#: mafiasi/base/templates/base.html:110 +#: mafiasi/base/templates/base.html:111 msgid "Data privacy statement" msgstr "How me uses ur data" -#: mafiasi/base/templates/base.html:112 +#: mafiasi/base/templates/base.html:113 msgid "Technical info" msgstr "Complicated thingies" -#: mafiasi/base/templates/base.html:114 +#: mafiasi/base/templates/base.html:115 #: mafiasi/base/templates/base/problems.html:4 msgid "Problems?" msgstr "Problems?" diff --git a/locale/fr_FR/LC_MESSAGES/django.po b/locale/fr_FR/LC_MESSAGES/django.po index 680fdf64..77313635 100644 --- a/locale/fr_FR/LC_MESSAGES/django.po +++ b/locale/fr_FR/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Mafiasi\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 09:35+0200\n" +"POT-Creation-Date: 2024-11-18 22:47+0100\n" "PO-Revision-Date: 2024-09-03 23:54+0200\n" "Last-Translator: Markus Neblung \n" "Language-Team: \n" @@ -39,51 +39,51 @@ msgstr "" "problème persiste, consultez notre page de " "rapports d'incidents ." -#: mafiasi/base/templates/base.html:47 +#: mafiasi/base/templates/base.html:48 msgid "Disable surprise" msgstr "Désactiver la surprise" -#: mafiasi/base/templates/base.html:57 +#: mafiasi/base/templates/base.html:58 msgid "Groups" msgstr "Groupes" -#: mafiasi/base/templates/base.html:65 +#: mafiasi/base/templates/base.html:66 #: mafiasi/mailinglist/templates/mailinglist/show_list.html:46 msgid "Settings" msgstr "Paramètres" -#: mafiasi/base/templates/base.html:68 +#: mafiasi/base/templates/base.html:69 #, python-format msgid "Logged in as %(username)s" msgstr "Connecté en tant que %(username)s" -#: mafiasi/base/templates/base.html:71 +#: mafiasi/base/templates/base.html:72 msgid "Logout" msgstr "Déconnecter" -#: mafiasi/base/templates/base.html:77 +#: mafiasi/base/templates/base.html:78 #: mafiasi/registration/templates/registration/request_account.html:38 #: mafiasi/registration/templates/registration/request_account.html:77 msgid "Register" msgstr "Enregistrez-Vous" -#: mafiasi/base/templates/base.html:79 +#: mafiasi/base/templates/base.html:80 msgid "Login" msgstr "Connectez-Vouz" -#: mafiasi/base/templates/base.html:108 +#: mafiasi/base/templates/base.html:109 msgid "Imprint" msgstr "Empreinte" -#: mafiasi/base/templates/base.html:110 +#: mafiasi/base/templates/base.html:111 msgid "Data privacy statement" msgstr "Politique de confidentialité" -#: mafiasi/base/templates/base.html:112 +#: mafiasi/base/templates/base.html:113 msgid "Technical info" msgstr "Information technique" -#: mafiasi/base/templates/base.html:114 +#: mafiasi/base/templates/base.html:115 #: mafiasi/base/templates/base/problems.html:4 msgid "Problems?" msgstr "Problèmes?" @@ -1572,7 +1572,9 @@ msgstr "Cantine" msgid "" "Look at what is available in the canteens and filter according to diet, " "allergens, etc." -msgstr "Regarde ce qu'il y a à manger dans les restaurants universitaires et filtre en fonction du régime alimentaire, des allergènes, etc." +msgstr "" +"Regarde ce qu'il y a à manger dans les restaurants universitaires et filtre " +"en fonction du régime alimentaire, des allergènes, etc." #: mafiasi/modulkompass/apps.py:11 msgid "Modulkompass" diff --git a/mafiasi/base/static/css/main.css b/mafiasi/base/static/css/main.css index 0ca2504e..1983f7a7 100644 --- a/mafiasi/base/static/css/main.css +++ b/mafiasi/base/static/css/main.css @@ -81,6 +81,26 @@ body { border-radius: 10px; } +/* ------- Stabile Message ------*/ +#stabile-message { + position: fixed; + bottom: 1vw; + left: auto; + right: 1vw; + margin: 0; + cursor: pointer; + user-select: none; + + border: none; + padding: 10px 16px; + background: #23527c; + color: white; + border-radius: 4px; + letter-spacing: 0ch; + font-size: large; + font-style: normal; +} + /* ------- MISC -------*/ .clickable { cursor: pointer; diff --git a/mafiasi/base/static/js/stabile_message.mjs b/mafiasi/base/static/js/stabile_message.mjs new file mode 100644 index 00000000..f40a6414 --- /dev/null +++ b/mafiasi/base/static/js/stabile_message.mjs @@ -0,0 +1,10 @@ +document.addEventListener("DOMContentLoaded", () => { + const dialog = document.getElementById("stabile-message"); + + // close dialog when clicked + const close = () => dialog.style.display = "none"; + dialog.addEventListener("click", close); + + // alternatively, also close dialog after 20 seconds + setTimeout(close, 20 * 1000); +}) diff --git a/mafiasi/base/templates/base.html b/mafiasi/base/templates/base.html index 0e68bf4f..6f65561a 100644 --- a/mafiasi/base/templates/base.html +++ b/mafiasi/base/templates/base.html @@ -2,6 +2,7 @@ {% load group_tags %} {% load settings_value %} {% load static %} +{% load stabile_message %} {% value_from_settings BANNER_IMG as banner_img %} {% value_from_settings FAVICON_PATH as favicon_path %} @@ -129,11 +130,16 @@

{% block ptitle %}{% endblock %}

{% endif %} + + + {% block js %} {% endblock js %} diff --git a/mafiasi/base/templatetags/stabile_message.py b/mafiasi/base/templatetags/stabile_message.py new file mode 100644 index 00000000..1f244767 --- /dev/null +++ b/mafiasi/base/templatetags/stabile_message.py @@ -0,0 +1,30 @@ +import random + +from django import template + +register = template.Library() + + +possible_texts = [ + "Du bist die Brandmauer gegen Rechts", + "„Unpolitisch“ ist politisch", + "Die AfD ist die mit Abstand größte Gefahr für unsere Gesellschaft! #AfDVerbotJetzt", + "Sich an Antifaschismus stören ist so 1933", + "Dieser Service wird nicht von Faschisten betrieben", + "Menschenrechte statt rechte Menschen", + "Kein Mensch ist illegal", + "„Nie wieder“ ist immer, nicht nur alle 4 Jahre beim Kreuzchen machen", + "Kein Platz für Rassismus", + "Trans rights are human rights", + "Trans rights or riot nights", + "Die Brandmauer ist überall. Auch im Studium!", + "Nazis morden, der Staat schiebt ab – das ist das gleiche Rassistenpack", + "AfDler verpisst euch – keiner vermisst euch", + "Seenotrettung ist kein Verbrechen", + "Nein heißt Nein, No means No, wer das sagt der meints auch so", +] + + +@register.simple_tag +def stabile_message() -> str: + return random.choice(possible_texts) From 2f4c659d7b5c0f587e99f29efefc31e922e1f0db Mon Sep 17 00:00:00 2001 From: lilly Date: Mon, 18 Nov 2024 23:07:32 +0100 Subject: [PATCH 4/4] fix nginx .mjs mime type --- docker/nginx.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker/nginx.conf b/docker/nginx.conf index f83112c6..f354d898 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -2,6 +2,12 @@ server { listen 8000; server_name default_server; + # nginx currently does not know about the .mjs extensions mime type so we teach it here + include mime.types; + types { + application/javascript mjs; + } + client_max_body_size 1G; location /static {