2021-10-04 13:03:26 +10:30
|
|
|
{{ define "content" }}
|
2021-06-02 23:42:29 +09:30
|
|
|
|
2022-04-04 19:10:07 +09:30
|
|
|
<main role="main" class="inner DAU" x-data="logs()" x-init="get_logs()">
|
2021-06-08 22:19:54 +09:30
|
|
|
<h1 class="DAU-heading">Logs</h1>
|
2021-06-02 23:42:29 +09:30
|
|
|
<p class="lead">Discord-auto-upload logs</p>
|
|
|
|
|
2021-06-06 17:15:38 +09:30
|
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm">
|
2022-04-04 19:10:07 +09:30
|
|
|
<button type="button" @click="debug = !debug" class="btn btn-primary" x-text="debug ? 'debug' : 'no debug'"></button>
|
2021-06-06 17:15:38 +09:30
|
|
|
</div>
|
|
|
|
<div class="col-sm">
|
2022-04-04 19:10:07 +09:30
|
|
|
<button type="button" @click="scroll = !scroll" class="btn btn-primary" x-text="scroll ? 'auto-scroll' : 'no scroll'"></button>
|
2021-06-06 17:15:38 +09:30
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-04-04 19:10:07 +09:30
|
|
|
<pre id="logs" x-text="text" class="text-left pre-scrollable">
|
2021-06-03 19:36:48 +09:30
|
|
|
</pre>
|
2021-06-02 23:42:29 +09:30
|
|
|
</main>
|
|
|
|
|
2021-10-04 13:03:26 +10:30
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ define "js" }}
|
|
|
|
|
2021-06-02 23:42:29 +09:30
|
|
|
<script>
|
2022-04-04 19:10:07 +09:30
|
|
|
function logs() {
|
|
|
|
return {
|
|
|
|
text: '', scroll: true, debug: false,
|
|
|
|
get_logs() {
|
|
|
|
fetch('/rest/logs?' + new URLSearchParams({ debug: this.debug ? "1" : "0" }))
|
|
|
|
.then(response => response.text())
|
|
|
|
.then(text => {
|
|
|
|
console.log(text);
|
|
|
|
this.text = text;
|
|
|
|
if (this.scroll) {
|
|
|
|
document.getElementById('logs').scrollTop =10000;
|
|
|
|
}
|
|
|
|
let self = this;
|
|
|
|
setTimeout(function() { self.get_logs(); }, 1000)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
2021-06-06 17:15:38 +09:30
|
|
|
}
|
2021-06-02 23:42:29 +09:30
|
|
|
</script>
|
2021-10-04 13:03:26 +10:30
|
|
|
|
|
|
|
{{ end }}
|