fix: improve log rendering by removing unnecessary replacements and ensure safe HTML output

This commit is contained in:
Kamil
2024-12-10 21:48:18 +00:00
parent 79c9554ce2
commit 01cc78eb93
2 changed files with 3 additions and 2 deletions

View File

@@ -123,7 +123,7 @@ def view_logs():
if log_name == 'beat' and os.path.exists('/var/log/jellyplist_beat.log'): if log_name == 'beat' and os.path.exists('/var/log/jellyplist_beat.log'):
with open('/var/log/jellyplist_beat.log', 'r',encoding='utf-8') as f: with open('/var/log/jellyplist_beat.log', 'r',encoding='utf-8') as f:
logs = f.readlines() logs = f.readlines()
return render_template('admin/logview.html', logs=str.join('',logs).replace('<',"_").replace('>',"_"),name=log_name) return render_template('admin/logview.html', logs=str.join('',logs),name=log_name)
@app.route('/admin/setloglevel', methods=['POST']) @app.route('/admin/setloglevel', methods=['POST'])
@functions.jellyfin_admin_required @functions.jellyfin_admin_required

View File

@@ -116,8 +116,9 @@
}, },
}); });
let editor = monaco.editor.create(document.getElementById('editor'), { let editor = monaco.editor.create(document.getElementById('editor'), {
value: `{{ logs }}`, value: `{{logs | safe }}`,
language: 'jellyplistLog', language: 'jellyplistLog',
readOnly: true, readOnly: true,
minimap: { enabled: false }, minimap: { enabled: false },