diff --git a/README.md b/README.md index fadfc39..739a19d 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ - Private "bookmark" support - List support - Allows you to attach files to your notes - - Custom emojus + - Custom emojos - Cares about your privacy - The image upload endpoint strips EXIF meta data before storing the file - Every attachment/media is cached (or proxied) by the server diff --git a/app.py b/app.py index 58895e3..9ddb269 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,5 @@ import json +from werkzeug.exceptions import InternalServerError import logging import os import traceback @@ -214,6 +215,18 @@ def handle_task_error(error): return response +@app.errorhandler(InternalServerError) +def handle_500(e): + tb = "".join(traceback.format_tb(e.__traceback__)) + logger.error(f"caught error {e!r}, {tb}") + if not session.get("logged_in", False): + tb = None + + return render_template( + "error.html", code=500, status_text="Internal Server Error", tb=tb + ) + + # @app.errorhandler(Exception) # def handle_other_error(error): # logger.error( diff --git a/core/shared.py b/core/shared.py index 6a1048e..2d7eb5a 100644 --- a/core/shared.py +++ b/core/shared.py @@ -144,7 +144,8 @@ def _build_thread(data, include_children=True): # noqa: C901 data["_requested"] = True app.logger.info(f"_build_thread({data!r})") root_id = data["meta"].get( - MetaKey.THREAD_ROOT_PARENT.value, data["meta"][MetaKey.OBJECT_ID.value] + MetaKey.THREAD_ROOT_PARENT.value, + data["meta"].get(MetaKey.OBJECT_ID.value, data["meta"].get("remote_id")), ) replies = [data] diff --git a/templates/header.html b/templates/header.html index 708171c..766aa96 100644 --- a/templates/header.html +++ b/templates/header.html @@ -1,4 +1,3 @@ -{% if not request.path.startswith('/admin') %} -{% endif %} diff --git a/templates/lists.html b/templates/lists.html index 5ed5b6f..e2d0059 100644 --- a/templates/lists.html +++ b/templates/lists.html @@ -6,7 +6,6 @@ {% endblock %} {% block content %}
-{% include "header.html" %}

Lists and its members are private.

diff --git a/templates/lookup.html b/templates/lookup.html index 21a19a9..744caff 100644 --- a/templates/lookup.html +++ b/templates/lookup.html @@ -3,7 +3,6 @@ {% block title %}Lookup - {{ config.NAME }}{% endblock %} {% block content %}
-{% include "header.html" %}
diff --git a/templates/new.html b/templates/new.html index a41fe4a..fa74059 100644 --- a/templates/new.html +++ b/templates/new.html @@ -6,7 +6,6 @@ {% endblock %} {% block content %}
-{% include "header.html" %}
{% if thread %}

Replying to {{ content }}

diff --git a/templates/stream.html b/templates/stream.html index 1bc1947..452eb17 100644 --- a/templates/stream.html +++ b/templates/stream.html @@ -3,7 +3,6 @@ {% block title %}{% if request.path == url_for('admin.admin_stream') %}Stream{% elif actor_id %}Profile {{ actor.name }}{% else %}Notifications{% endif %} - {{ config.NAME }}{% endblock %} {% block content %}
-{% include "header.html" %}
{% if request.path == url_for('admin.admin_notifications') and unread_notifications_count %}