forked from newthuhole/hole_thu_backend
举报内容仅自己和管理员可见
This commit is contained in:
4
hole.py
4
hole.py
@@ -454,7 +454,7 @@ def delete():
|
|||||||
|
|
||||||
@app.route('/_api/v1/systemlog')
|
@app.route('/_api/v1/systemlog')
|
||||||
def system_log():
|
def system_log():
|
||||||
require_token()
|
u = require_token()
|
||||||
|
|
||||||
ss = Syslog.query.order_by(db.desc('timestamp')).limit(100).all()
|
ss = Syslog.query.order_by(db.desc('timestamp')).limit(100).all()
|
||||||
|
|
||||||
@@ -462,7 +462,7 @@ def system_log():
|
|||||||
'start_time': app.config['START_TIME'],
|
'start_time': app.config['START_TIME'],
|
||||||
'salt': look(app.config['SALT']),
|
'salt': look(app.config['SALT']),
|
||||||
'tmp_token': tmp_token(),
|
'tmp_token': tmp_token(),
|
||||||
'data': list(map(map_syslog, ss))
|
'data': [map_syslog(s,u) for s in ss]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
utils.py
4
utils.py
@@ -73,10 +73,10 @@ def map_comment(p, name):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def map_syslog(s):
|
def map_syslog(s, u=None):
|
||||||
return {
|
return {
|
||||||
'type': s.log_type,
|
'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),
|
'user': look(s.name_hash),
|
||||||
'timestamp': s.timestamp
|
'timestamp': s.timestamp
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user