MsRewards-Reborn/Flask/templates/vnc_post.html

45 lines
1.7 KiB
HTML
Raw Normal View History

{% extends "base.html" %}
{% block left_pannel %}override{% endblock %}
{% block content %}
2024-02-28 11:41:13 +01:00
{% if not current_user.is_authenticated %}
<button class="unselected" onclick="location.href = '/login';">login</button>
{% else %}
<link rel="stylesheet" href="{{ url_for('static', filename='node_modules/xterm/css/xterm.css') }}"/>
<script src="{{ url_for('static', filename='node_modules/xterm/lib/xterm.js') }}"></script>
2024-02-28 11:53:23 +01:00
<script src="{{ url_for('static', filename='node_modules/xterm-addon-fit/lib/xterm-addon-fit.js') }}"></script>
2024-02-28 14:17:55 +01:00
<script>
document.getElementsByClassName("content")[0].style.padding = "0 0"
</script>
<div style="height: 100%">
2024-02-28 11:41:13 +01:00
<div id="console" style="height: 100%; width: 20%; float:left;"></div>
2024-02-28 11:41:13 +01:00
2024-02-28 14:14:29 +01:00
<div style="height: 100%; width: 80%; float:left;">
<iframe src="/novnc/vnc.html?resize=scale&path=novnc/websockify&autoconnect=true&view_only"
width="100%" height="100%" frameborder="0"></iframe>
</div>
</div>
2024-02-28 11:41:13 +01:00
<script>
var term = new Terminal();
2024-02-28 12:09:32 +01:00
const fitAddon = new FitAddon.FitAddon();
2024-02-28 11:53:23 +01:00
term.loadAddon(fitAddon);
term.open(document.getElementById('console'));
2024-02-28 12:00:19 +01:00
fitAddon.fit()
2024-02-28 11:53:23 +01:00
document.getElementById("console").style.textAlign = "left"
2024-02-28 11:41:13 +01:00
const eventSource = new EventSource('/stream');
2024-02-28 11:41:13 +01:00
eventSource.onmessage = (event) => {
term.writeln(event.data)
};
2024-02-28 14:26:25 +01:00
addEventListener("resize", (event) => {
fitAddon.fit()
});
2024-02-28 11:41:13 +01:00
</script>
2024-02-28 11:41:13 +01:00
{% endif %}
2024-02-28 11:41:13 +01:00
{% endblock %}