mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +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
|
- Private "bookmark" support
|
||||||
- List support
|
- List support
|
||||||
- Allows you to attach files to your notes
|
- Allows you to attach files to your notes
|
||||||
- Custom emojus
|
- Custom emojos
|
||||||
- Cares about your privacy
|
- Cares about your privacy
|
||||||
- The image upload endpoint strips EXIF meta data before storing the file
|
- The image upload endpoint strips EXIF meta data before storing the file
|
||||||
- Every attachment/media is cached (or proxied) by the server
|
- Every attachment/media is cached (or proxied) by the server
|
||||||
|
|
13
app.py
13
app.py
|
@ -1,4 +1,5 @@
|
||||||
import json
|
import json
|
||||||
|
from werkzeug.exceptions import InternalServerError
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -214,6 +215,18 @@ def handle_task_error(error):
|
||||||
return response
|
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)
|
# @app.errorhandler(Exception)
|
||||||
# def handle_other_error(error):
|
# def handle_other_error(error):
|
||||||
# logger.error(
|
# logger.error(
|
||||||
|
|
|
@ -144,7 +144,8 @@ def _build_thread(data, include_children=True): # noqa: C901
|
||||||
data["_requested"] = True
|
data["_requested"] = True
|
||||||
app.logger.info(f"_build_thread({data!r})")
|
app.logger.info(f"_build_thread({data!r})")
|
||||||
root_id = data["meta"].get(
|
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]
|
replies = [data]
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{% if not request.path.startswith('/admin') %}
|
|
||||||
<header id="header">
|
<header id="header">
|
||||||
|
|
||||||
<div class="h-card p-author">
|
<div class="h-card p-author">
|
||||||
|
@ -39,4 +38,3 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</header>
|
</header>
|
||||||
{% endif %}
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="container">
|
<div id="container">
|
||||||
{% include "header.html" %}
|
|
||||||
|
|
||||||
<div id="following">
|
<div id="following">
|
||||||
<p>Lists and its members are private.</p>
|
<p>Lists and its members are private.</p>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
{% block title %}Lookup - {{ config.NAME }}{% endblock %}
|
{% block title %}Lookup - {{ config.NAME }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="container">
|
<div id="container">
|
||||||
{% include "header.html" %}
|
|
||||||
<div style="margin-top:50px;">
|
<div style="margin-top:50px;">
|
||||||
|
|
||||||
<form id="lookup-form" method="GET">
|
<form id="lookup-form" method="GET">
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="container">
|
<div id="container">
|
||||||
{% include "header.html" %}
|
|
||||||
<div id="new">
|
<div id="new">
|
||||||
{% if thread %}
|
{% if thread %}
|
||||||
<h3 style="padding-bottom: 30px">Replying to {{ content }}</h3>
|
<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 title %}{% if request.path == url_for('admin.admin_stream') %}Stream{% elif actor_id %}Profile {{ actor.name }}{% else %}Notifications{% endif %} - {{ config.NAME }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="h-feed" id="container">
|
<div class="h-feed" id="container">
|
||||||
{% include "header.html" %}
|
|
||||||
<div id="admin">
|
<div id="admin">
|
||||||
|
|
||||||
{% if request.path == url_for('admin.admin_notifications') and unread_notifications_count %}
|
{% if request.path == url_for('admin.admin_notifications') and unread_notifications_count %}
|
||||||
|
|
Loading…
Reference in a new issue