preet / static /index.html
pabla1322's picture
Update static/index.html
b3355a2 verified
Raw
History Blame Contribute Delete
2.08 kB
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Ubuntu 24.04 LTS β€” Web Terminal</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.css"/>
<script src="https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.8.0/lib/xterm-addon-fit.js"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #1a1a1a; display: flex; flex-direction: column; height: 100vh; }
#header {
background: #2d2d2d;
color: #4CAF50;
padding: 10px 20px;
font-family: monospace;
font-size: 14px;
font-weight: bold;
border-bottom: 2px solid #4CAF50;
display: flex;
align-items: center;
gap: 10px;
}
.dot { width:12px; height:12px; border-radius:50%; }
.dot.green { background:#4CAF50; box-shadow:0 0 8px #4CAF50; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
#terminal-container { flex: 1; padding: 5px; overflow: hidden; }
</style>
</head>
<body>
<div id="header">
<div class="dot green"></div>
UBUNTU 24.04 LTS β€” WEB TERMINAL
</div>
<div id="terminal-container"></div>
<script>
const term = new Terminal({
fontFamily: 'monospace',
fontSize: 14,
theme: {
background: '#1a1a1a',
foreground: '#f0f0f0',
cursor: '#4CAF50',
},
cursorBlink: true,
scrollback: 5000,
});
const fitAddon = new FitAddon.FitAddon();
term.loadAddon(fitAddon);
term.open(document.getElementById('terminal-container'));
fitAddon.fit();
const ws = new WebSocket(location.href.replace(/^http/, 'ws').replace(/\/$/, '') + '/ws');
ws.onopen = () => term.write('\r\n\x1b[32m● Connected β€” real Ubuntu 24.04 shell\x1b[0m\r\n\r\n');
ws.onmessage = e => term.write(e.data);
ws.onclose = () => term.write('\r\n\x1b[31m● Connection closed. Refresh to reconnect.\x1b[0m\r\n');
term.onData(d => { if (ws.readyState === 1) ws.send(d); });
window.addEventListener('resize', () => fitAddon.fit());
</script>
</body>
</html>