WebHost: offer room owner log download link
This commit is contained in:
parent
28c5e9ee65
commit
42da24cb5e
|
@ -116,7 +116,11 @@ def display_log(room: UUID):
|
|||
if room is None:
|
||||
return abort(404)
|
||||
if room.owner == session["_id"]:
|
||||
return Response(_read_log(os.path.join("logs", str(room.id) + ".txt")), mimetype="text/plain;charset=UTF-8")
|
||||
file_path = os.path.join("logs", str(room.id) + ".txt")
|
||||
if os.path.exists(file_path):
|
||||
return Response(_read_log(file_path), mimetype="text/plain;charset=UTF-8")
|
||||
return "Log File does not exist."
|
||||
|
||||
return "Access Denied", 403
|
||||
|
||||
|
||||
|
|
|
@ -32,13 +32,18 @@
|
|||
{% endif %}
|
||||
{{ macros.list_patches_room(room) }}
|
||||
{% if room.owner == session["_id"] %}
|
||||
<form method=post>
|
||||
<div class="form-group">
|
||||
<label for="cmd"></label>
|
||||
<input class="form-control" type="text" id="cmd" name="cmd"
|
||||
placeholder="Server Command. /help to list them, list gets appended to log.">
|
||||
</div>
|
||||
</form>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<form method=post style="flex-grow: 1; margin-right: 1em;">
|
||||
<div class="form-group">
|
||||
<label for="cmd"></label>
|
||||
<input class="form-control" type="text" id="cmd" name="cmd"
|
||||
placeholder="Server Command. /help to list them, list gets appended to log.">
|
||||
</div>
|
||||
</form>
|
||||
<a href="{{ url_for("display_log", room=room.id) }}">
|
||||
Open Log File...
|
||||
</a>
|
||||
</div>
|
||||
<div id="logger"></div>
|
||||
<script type="application/ecmascript">
|
||||
let xmlhttp = new XMLHttpRequest();
|
||||
|
|
Loading…
Reference in New Issue