From 5ea1ebc6d11f46768eb18879a289b3d5d9e946b1 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Thu, 16 Dec 2021 13:09:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BE=E6=8A=A5=E5=86=85=E5=AE=B9=E4=BB=85?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E5=92=8C=E7=AE=A1=E7=90=86=E5=91=98=E5=8F=AF?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hole.py | 4 ++-- utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hole.py b/hole.py index bebfd16..ad4432e 100644 --- a/hole.py +++ b/hole.py @@ -454,7 +454,7 @@ def delete(): @app.route('/_api/v1/systemlog') def system_log(): - require_token() + u = require_token() ss = Syslog.query.order_by(db.desc('timestamp')).limit(100).all() @@ -462,7 +462,7 @@ def system_log(): 'start_time': app.config['START_TIME'], 'salt': look(app.config['SALT']), 'tmp_token': tmp_token(), - 'data': list(map(map_syslog, ss)) + 'data': [map_syslog(s,u) for s in ss] } diff --git a/utils.py b/utils.py index 7d9c479..9824d7d 100644 --- a/utils.py +++ b/utils.py @@ -73,10 +73,10 @@ def map_comment(p, name): ] -def map_syslog(s): +def map_syslog(s, u=None): return { 'type': s.log_type, - 'detail': s.log_detail, + 'detail': s.log_detail if check_can_del(u.name, s.name_hash) else '', 'user': look(s.name_hash), 'timestamp': s.timestamp }