mirror of
https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
synced 2025-06-12 22:24:47 +02:00
c'est une bien meilleure manière de faire.
This commit is contained in:
@ -7,21 +7,24 @@
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<iframe id="iframe" src="{{url_for('static', filename='logs/dev.txt')}}" width="100%" height="80%"></iframe>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="20%" height="90%">
|
||||
<div id="console"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
var myIframe = document.getElementById('iframe');
|
||||
<script>
|
||||
const consoleElement = document.getElementById('console');
|
||||
const eventSource = new EventSource('/stream');
|
||||
|
||||
myIframe.addEventListener("load", async () => {
|
||||
myIframe.contentDocument.body.innerHTML = myIframe.contentDocument.body.innerHTML + '<style>html{color:white;}</style>';
|
||||
await delay(2000);
|
||||
document.getElementById('iframe').contentWindow.location.reload();
|
||||
});
|
||||
|
||||
window.setInterval(function() {
|
||||
document.getElementById('iframe').contentWindow.scrollTo(0, myIframe.contentDocument.body.scrollHeight);
|
||||
}, 500);
|
||||
|
||||
</script>
|
||||
eventSource.onmessage = (event) => {
|
||||
const newOutput = document.createElement('div');
|
||||
newOutput.textContent = event.data;
|
||||
consoleElement.appendChild(newOutput);
|
||||
};
|
||||
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
Reference in New Issue
Block a user