From 77cbce717d4d87b09f33b23c9c523dd97b90acec Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Thu, 10 Sep 2020 02:35:12 +0200 Subject: [PATCH] add pgp key option --- example_config.py | 2 ++ server.py | 6 +++++- templates/contact.html | 35 +++++++++++++++++++++++++++-------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/example_config.py b/example_config.py index 4eefd50..7b8bec9 100644 --- a/example_config.py +++ b/example_config.py @@ -60,3 +60,5 @@ DISABLE_MAIN_LINKS = False NAVBAR_LINKS = [ ("Navbar-Item1", "/target"), ("Navbar-Item2", "/target2") ] IMPRESSUM_IS_CONTACT = True + +PGP_PUB_KEY_FILE = None diff --git a/server.py b/server.py index 3f219ed..0af9a91 100755 --- a/server.py +++ b/server.py @@ -431,7 +431,11 @@ def init(): @app.route("/contact") def contact(): - return flask.render_template("contact.html", conf=app.config) + key=None + if app.config['PGP_PUB_KEY_FILE']: + with open(os.path.join(app.config["CONTENT_DIR"], app.config['PGP_PUB_KEY_FILE'])) as f: + key = f.read().strip() + return flask.render_template("contact.html", conf=app.config, PGP_KEY=key) @app.route("/contact-api", methods=['POST']) def contactAPI(): diff --git a/templates/contact.html b/templates/contact.html index d3a902f..ba62779 100644 --- a/templates/contact.html +++ b/templates/contact.html @@ -12,7 +12,7 @@ - + {% include 'navbar.html' %} {% include 'progress_window.html' %}
@@ -25,13 +25,13 @@
-
+
-
+
@@ -51,26 +51,45 @@
-
-
- Send +
-
+
  • Wir freuen uns auf ihre Nachricht!


    {% if conf['CONTACT_EMAIL'] %}

    Selbsverständlich können sie uns auch per Mail kontaktieren.


    - {{ conf['CONTACT_EMAIL'] }} + {{ conf['CONTACT_EMAIL'] }} + {% endif %} + {% if PGP_KEY %} + + + PGP Key {% endif %}