mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 05:04:27 +00:00
Custom 500 and thread bugfix
This commit is contained in:
parent
0fa6159c47
commit
efc59f7e07
8 changed files with 16 additions and 8 deletions
|
@ -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
|
||||
|
|
13
app.py
13
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(
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{% if not request.path.startswith('/admin') %}
|
||||
<header id="header">
|
||||
|
||||
<div class="h-card p-author">
|
||||
|
@ -39,4 +38,3 @@
|
|||
</div>
|
||||
|
||||
</header>
|
||||
{% endif %}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
{% endblock %}
|
||||
{% block content %}
|
||||
<div id="container">
|
||||
{% include "header.html" %}
|
||||
|
||||
<div id="following">
|
||||
<p>Lists and its members are private.</p>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
{% block title %}Lookup - {{ config.NAME }}{% endblock %}
|
||||
{% block content %}
|
||||
<div id="container">
|
||||
{% include "header.html" %}
|
||||
<div style="margin-top:50px;">
|
||||
|
||||
<form id="lookup-form" method="GET">
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
{% endblock %}
|
||||
{% block content %}
|
||||
<div id="container">
|
||||
{% include "header.html" %}
|
||||
<div id="new">
|
||||
{% if thread %}
|
||||
<h3 style="padding-bottom: 30px">Replying to {{ content }}</h3>
|
||||
|
|
|
@ -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 %}
|
||||
<div class="h-feed" id="container">
|
||||
{% include "header.html" %}
|
||||
<div id="admin">
|
||||
|
||||
{% if request.path == url_for('admin.admin_notifications') and unread_notifications_count %}
|
||||
|
|
Loading…
Reference in a new issue