From c70f13d069ff5be06415f30b1833c24db654aedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Thu, 4 Dec 2025 06:16:00 +0300 Subject: [PATCH] add contact information to config --- app/__init__.py | 8 +++++++- app/constants.py | 9 +++++++-- app/routes/app.py | 5 ----- app/routes/guides.py | 13 +++++++++++++ app/templates/base.html | 4 +--- app/templates/common/footer.html | 6 ++++++ app/templates/common/macros.html | 2 +- app/templates/{ => guides}/babycode.html | 1 - app/templates/guides/contact.html | 13 +++++++++++++ app/templates/users/delete_page.html | 2 +- config/pyrom_config.toml | 5 +++++ data/static/css/style.css | 10 ++++++++++ data/static/css/theme-otomotone.css | 10 ++++++++++ data/static/css/theme-peachy.css | 10 ++++++++++ sass/_default.scss | 6 ++++++ 15 files changed, 90 insertions(+), 14 deletions(-) create mode 100644 app/routes/guides.py create mode 100644 app/templates/common/footer.html rename app/templates/{ => guides}/babycode.html (99%) create mode 100644 app/templates/guides/contact.html diff --git a/app/__init__.py b/app/__init__.py index 49180ce..1fc6341 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -8,7 +8,7 @@ from .constants import ( PermissionLevel, permission_level_string, InfoboxKind, InfoboxHTMLClass, REACTION_EMOJI, MOTD_BANNED_TAGS, - SIG_BANNED_TAGS, + SIG_BANNED_TAGS, STRICT_BANNED_TAGS, ) from .lib.babycode import babycode_to_html, EMOJI, BABYCODE_VERSION from datetime import datetime @@ -149,6 +149,7 @@ def create_app(): from app.routes.api import bp as api_bp from app.routes.posts import bp as posts_bp from app.routes.hyperapi import bp as hyperapi_bp + from app.routes.guides import bp as guides_bp app.register_blueprint(app_bp) app.register_blueprint(topics_bp) app.register_blueprint(threads_bp) @@ -157,6 +158,7 @@ def create_app(): app.register_blueprint(api_bp) app.register_blueprint(posts_bp) app.register_blueprint(hyperapi_bp) + app.register_blueprint(guides_bp) app.config['SESSION_COOKIE_SECURE'] = True @@ -212,6 +214,10 @@ def create_app(): def babycode_filter(markup): return babycode_to_html(markup).result + @app.template_filter('babycode_strict') + def babycode_strict_filter(markup): + return babycode_to_html(markup, STRICT_BANNED_TAGS).result + @app.template_filter('extract_h2') def extract_h2(content): import re diff --git a/app/constants.py b/app/constants.py index eff5cd9..b88b073 100644 --- a/app/constants.py +++ b/app/constants.py @@ -48,11 +48,16 @@ REACTION_EMOJI = [ ] MOTD_BANNED_TAGS = [ - 'img', 'spoiler', '@mention' + 'img', 'spoiler', '@mention', ] SIG_BANNED_TAGS = [ - '@mention' + '@mention', +] + +STRICT_BANNED_TAGS = [ + 'img', 'spoiler', '@mention', + 'big', 'small', 'center', 'right', 'color', ] def permission_level_string(perm): diff --git a/app/routes/app.py b/app/routes/app.py index 4937d08..5db25cd 100644 --- a/app/routes/app.py +++ b/app/routes/app.py @@ -5,8 +5,3 @@ bp = Blueprint("app", __name__, url_prefix = "/") @bp.route("/") def index(): return redirect(url_for("topics.all_topics")) - - -@bp.route("/babycode") -def babycode_guide(): - return render_template('babycode.html') diff --git a/app/routes/guides.py b/app/routes/guides.py new file mode 100644 index 0000000..515d7ab --- /dev/null +++ b/app/routes/guides.py @@ -0,0 +1,13 @@ +from flask import Blueprint, render_template + +bp = Blueprint('guides', __name__, url_prefix='/guides/') + + +@bp.get('/babycode') +def babycode(): + return render_template('guides/babycode.html') + + +@bp.get('/contact') +def contact(): + return render_template('guides/contact.html') diff --git a/app/templates/base.html b/app/templates/base.html index e02ff72..fc1ea87 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -23,9 +23,7 @@ {% endif %} {% endwith %} {% block content %}{% endblock %} - + {% include 'common/footer.html' %} diff --git a/app/templates/common/footer.html b/app/templates/common/footer.html new file mode 100644 index 0000000..aa81040 --- /dev/null +++ b/app/templates/common/footer.html @@ -0,0 +1,6 @@ + diff --git a/app/templates/common/macros.html b/app/templates/common/macros.html index bc45a75..0ae3232 100644 --- a/app/templates/common/macros.html +++ b/app/templates/common/macros.html @@ -99,7 +99,7 @@ - babycode guide + babycode guide {% if banned_tags %}
Forbidden tags:
diff --git a/app/templates/babycode.html b/app/templates/guides/babycode.html similarity index 99% rename from app/templates/babycode.html rename to app/templates/guides/babycode.html index 144aa59..c89a22c 100644 --- a/app/templates/babycode.html +++ b/app/templates/guides/babycode.html @@ -1,4 +1,3 @@ - {% extends 'base.html' %} {% block title %}babycode guide{% endblock %} {% block content %} diff --git a/app/templates/guides/contact.html b/app/templates/guides/contact.html new file mode 100644 index 0000000..3b87591 --- /dev/null +++ b/app/templates/guides/contact.html @@ -0,0 +1,13 @@ +{% extends 'base.html' %} +{% block title %}contact us{% endblock %} +{% block content %} +
+

Contact

+ {% if config.ADMIN_CONTACT_INFO %} +

The administrators of {{ config.SITE_NAME }} provide the following contact information:

+
{{ config.ADMIN_CONTACT_INFO | babycode_strict | safe }}
+ {% else %} +

The administrators of {{ config.SITE_NAME }} did not provide any contact information.

+ {% endif %} +
+{% endblock %} diff --git a/app/templates/users/delete_page.html b/app/templates/users/delete_page.html index e0d715d..8e90a66 100644 --- a/app/templates/users/delete_page.html +++ b/app/templates/users/delete_page.html @@ -4,7 +4,7 @@