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:
|
if room is None:
|
||||||
return abort(404)
|
return abort(404)
|
||||||
if room.owner == session["_id"]:
|
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
|
return "Access Denied", 403
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,18 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ macros.list_patches_room(room) }}
|
{{ macros.list_patches_room(room) }}
|
||||||
{% if room.owner == session["_id"] %}
|
{% if room.owner == session["_id"] %}
|
||||||
<form method=post>
|
<div style="display: flex; align-items: center;">
|
||||||
<div class="form-group">
|
<form method=post style="flex-grow: 1; margin-right: 1em;">
|
||||||
<label for="cmd"></label>
|
<div class="form-group">
|
||||||
<input class="form-control" type="text" id="cmd" name="cmd"
|
<label for="cmd"></label>
|
||||||
placeholder="Server Command. /help to list them, list gets appended to log.">
|
<input class="form-control" type="text" id="cmd" name="cmd"
|
||||||
</div>
|
placeholder="Server Command. /help to list them, list gets appended to log.">
|
||||||
</form>
|
</div>
|
||||||
|
</form>
|
||||||
|
<a href="{{ url_for("display_log", room=room.id) }}">
|
||||||
|
Open Log File...
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<div id="logger"></div>
|
<div id="logger"></div>
|
||||||
<script type="application/ecmascript">
|
<script type="application/ecmascript">
|
||||||
let xmlhttp = new XMLHttpRequest();
|
let xmlhttp = new XMLHttpRequest();
|
||||||
|
|
Loading…
Reference in New Issue