mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
admin: view log of activities sent and received
This commit is contained in:
parent
3038cb7118
commit
0fc16d503c
2 changed files with 40 additions and 2 deletions
|
@ -1,11 +1,11 @@
|
||||||
from flask import request, flash
|
from flask import request, flash
|
||||||
from flask_login import login_required, current_user
|
from flask_login import login_required, current_user
|
||||||
from flask_babel import _
|
from flask_babel import _
|
||||||
from sqlalchemy import text
|
from sqlalchemy import text, desc
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app.admin.forms import AdminForm
|
from app.admin.forms import AdminForm
|
||||||
from app.models import AllowedInstances, BannedInstances
|
from app.models import AllowedInstances, BannedInstances, ActivityPubLog
|
||||||
from app.utils import render_template, permission_required, set_setting, get_setting
|
from app.utils import render_template, permission_required, set_setting, get_setting
|
||||||
from app.admin import bp
|
from app.admin import bp
|
||||||
|
|
||||||
|
@ -41,3 +41,10 @@ def admin_home():
|
||||||
|
|
||||||
return render_template('admin/home.html', title=_('Admin settings'), form=form)
|
return render_template('admin/home.html', title=_('Admin settings'), form=form)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/activities', methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
@permission_required('change instance settings')
|
||||||
|
def admin_activities():
|
||||||
|
return render_template('admin/activities.html', title=_('ActivityPub Log'),
|
||||||
|
activities=ActivityPubLog.query.order_by(desc(ActivityPubLog.created_at)).all())
|
31
app/templates/admin/activities.html
Normal file
31
app/templates/admin/activities.html
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% from 'bootstrap/form.html' import render_form %}
|
||||||
|
|
||||||
|
{% block app_content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th>When</th>
|
||||||
|
<th>Direction</th>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Result</th>
|
||||||
|
<th>Message</th>
|
||||||
|
<th>JSON</th>
|
||||||
|
</tr>
|
||||||
|
{% for activity in activities %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ moment(activity.created_at).fromNow() }}</td>
|
||||||
|
<td>{{ activity.direction }}</td>
|
||||||
|
<td>{{ activity.activity_id }}</td>
|
||||||
|
<td>{{ activity.activity_type }}</td>
|
||||||
|
<td>{{ activity.result }}</td>
|
||||||
|
<td>{{ activity.exception_message }}</td>
|
||||||
|
<td><pre> </pre></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Add table
Reference in a new issue