updated codestyle
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make-Without-sqlite3 (push) Successful in 6s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake-Without-sqlite3 (push) Successful in 9s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson-Without-sqlite3 (push) Successful in 7s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make-Without-sqlite3 (push) Successful in 6s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake-Without-sqlite3 (push) Successful in 9s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson-Without-sqlite3 (push) Successful in 7s
This commit is contained in:
1 parent
193779bd13
commit
36aa1bea2a
12 files changed
+18657
-4237
No files matched your search
+187
-168
@@ -1,176 +1,195 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Terminal</title>
|
||||
<link rel="stylesheet" href="xterm.css">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background-color: #1e1e1e;
|
||||
color: #fff;
|
||||
font-family: Arial, sans-serif;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#terminal-container {
|
||||
flex: 1;
|
||||
border: 1px solid #333;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.status {
|
||||
padding: 10px;
|
||||
border-radius: 3px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.connected { background-color: #2d5a2d; }
|
||||
.disconnected { background-color: #5a2d2d; }
|
||||
.connecting { background-color: #5a5a2d; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Web Terminal</h1>
|
||||
<div class="status connecting" id="status">Connecting...</div>
|
||||
<div id="terminal-container"></div>
|
||||
<head>
|
||||
<title>Web Terminal</title>
|
||||
<link rel="stylesheet" href="xterm.css" />
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background-color: #1e1e1e;
|
||||
color: #fff;
|
||||
font-family: Arial, sans-serif;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
<script src="xterm.js"></script>
|
||||
<script src="xterm-addon-fit.js"></script>
|
||||
<script>
|
||||
class WebTerminal {
|
||||
constructor() {
|
||||
this.terminal = new Terminal({
|
||||
cursorBlink: true,
|
||||
theme: {
|
||||
background: '#000000',
|
||||
foreground: '#ffffff',
|
||||
cursor: '#ffffff'
|
||||
}
|
||||
});
|
||||
|
||||
this.fitAddon = new FitAddon.FitAddon();
|
||||
this.terminal.loadAddon(this.fitAddon);
|
||||
|
||||
this.ws = null;
|
||||
this.reconnectAttempts = 0;
|
||||
this.maxReconnectAttempts = 5;
|
||||
this.reconnectDelay = 3000;
|
||||
|
||||
this.init();
|
||||
#terminal-container {
|
||||
flex: 1;
|
||||
border: 1px solid #333;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
init() {
|
||||
const terminalContainer = document.getElementById('terminal-container');
|
||||
this.terminal.open(terminalContainer);
|
||||
this.fitAddon.fit();
|
||||
|
||||
this.terminal.writeln('Welcome to Web Terminal');
|
||||
this.terminal.writeln('Connecting to server...');
|
||||
|
||||
this.connect();
|
||||
|
||||
// Handle terminal input
|
||||
this.terminal.onData((data) => {
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
this.ws.send(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Handle resize
|
||||
window.addEventListener('resize', () => {
|
||||
this.fitAddon.fit();
|
||||
this.sendResize();
|
||||
});
|
||||
|
||||
// Handle page unload
|
||||
window.addEventListener('beforeunload', () => {
|
||||
if (this.ws) {
|
||||
this.ws.close();
|
||||
}
|
||||
});
|
||||
|
||||
.status {
|
||||
padding: 10px;
|
||||
border-radius: 3px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
connect() {
|
||||
this.updateStatus('Connecting...', 'connecting');
|
||||
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const wsUrl = `${protocol}//${window.location.host}/ws`;
|
||||
|
||||
this.ws = new WebSocket(wsUrl);
|
||||
|
||||
this.ws.onopen = () => {
|
||||
console.log('WebSocket connected');
|
||||
|
||||
.connected {
|
||||
background-color: #2d5a2d;
|
||||
}
|
||||
.disconnected {
|
||||
background-color: #5a2d2d;
|
||||
}
|
||||
.connecting {
|
||||
background-color: #5a5a2d;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Web Terminal</h1>
|
||||
<div class="status connecting" id="status">Connecting...</div>
|
||||
<div id="terminal-container"></div>
|
||||
|
||||
<script src="xterm.js"></script>
|
||||
<script src="xterm-addon-fit.js"></script>
|
||||
<script>
|
||||
class WebTerminal {
|
||||
constructor() {
|
||||
this.terminal = new Terminal({
|
||||
cursorBlink: true,
|
||||
theme: {
|
||||
background: "#000000",
|
||||
foreground: "#ffffff",
|
||||
cursor: "#ffffff",
|
||||
},
|
||||
});
|
||||
|
||||
this.fitAddon = new FitAddon.FitAddon();
|
||||
this.terminal.loadAddon(this.fitAddon);
|
||||
|
||||
this.ws = null;
|
||||
this.reconnectAttempts = 0;
|
||||
this.updateStatus('Connected', 'connected');
|
||||
this.terminal.clear();
|
||||
this.sendResize();
|
||||
};
|
||||
|
||||
this.ws.onmessage = (event) => {
|
||||
if (typeof event.data === 'string') {
|
||||
this.terminal.write(event.data);
|
||||
} else {
|
||||
// Handle binary data
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
const data = new Uint8Array(reader.result);
|
||||
this.terminal.write(data);
|
||||
};
|
||||
reader.readAsArrayBuffer(event.data);
|
||||
}
|
||||
};
|
||||
|
||||
this.ws.onclose = (event) => {
|
||||
console.log('WebSocket disconnected:', event.code, event.reason);
|
||||
this.updateStatus('Disconnected', 'disconnected');
|
||||
|
||||
if (this.reconnectAttempts < this.maxReconnectAttempts) {
|
||||
this.reconnectAttempts++;
|
||||
const delay = this.reconnectDelay * this.reconnectAttempts;
|
||||
this.terminal.write(`\r\nConnection lost. Reconnecting in ${delay/1000}s...\r\n`);
|
||||
|
||||
setTimeout(() => {
|
||||
this.connect();
|
||||
}, delay);
|
||||
} else {
|
||||
this.terminal.write('\r\nFailed to reconnect. Please refresh the page.\r\n');
|
||||
}
|
||||
};
|
||||
|
||||
this.ws.onerror = (error) => {
|
||||
console.error('WebSocket error:', error);
|
||||
this.updateStatus('Connection Error', 'disconnected');
|
||||
};
|
||||
}
|
||||
|
||||
sendResize() {
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
const dimensions = this.terminal;
|
||||
const resizeMsg = {
|
||||
cols: dimensions.cols,
|
||||
rows: dimensions.rows
|
||||
this.maxReconnectAttempts = 5;
|
||||
this.reconnectDelay = 3000;
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
const terminalContainer =
|
||||
document.getElementById("terminal-container");
|
||||
this.terminal.open(terminalContainer);
|
||||
this.fitAddon.fit();
|
||||
|
||||
this.terminal.writeln("Welcome to Web Terminal");
|
||||
this.terminal.writeln("Connecting to server...");
|
||||
|
||||
this.connect();
|
||||
|
||||
// Handle terminal input
|
||||
this.terminal.onData((data) => {
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
this.ws.send(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Handle resize
|
||||
window.addEventListener("resize", () => {
|
||||
this.fitAddon.fit();
|
||||
this.sendResize();
|
||||
});
|
||||
|
||||
// Handle page unload
|
||||
window.addEventListener("beforeunload", () => {
|
||||
if (this.ws) {
|
||||
this.ws.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
connect() {
|
||||
this.updateStatus("Connecting...", "connecting");
|
||||
|
||||
const protocol =
|
||||
window.location.protocol === "https:" ? "wss:" : "ws:";
|
||||
const wsUrl = `${protocol}//${window.location.host}/ws`;
|
||||
|
||||
this.ws = new WebSocket(wsUrl);
|
||||
|
||||
this.ws.onopen = () => {
|
||||
console.log("WebSocket connected");
|
||||
this.reconnectAttempts = 0;
|
||||
this.updateStatus("Connected", "connected");
|
||||
this.terminal.clear();
|
||||
this.sendResize();
|
||||
};
|
||||
this.ws.send(JSON.stringify(resizeMsg));
|
||||
|
||||
this.ws.onmessage = (event) => {
|
||||
if (typeof event.data === "string") {
|
||||
this.terminal.write(event.data);
|
||||
} else {
|
||||
// Handle binary data
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
const data = new Uint8Array(reader.result);
|
||||
this.terminal.write(data);
|
||||
};
|
||||
reader.readAsArrayBuffer(event.data);
|
||||
}
|
||||
};
|
||||
|
||||
this.ws.onclose = (event) => {
|
||||
console.log(
|
||||
"WebSocket disconnected:",
|
||||
event.code,
|
||||
event.reason,
|
||||
);
|
||||
this.updateStatus("Disconnected", "disconnected");
|
||||
|
||||
if (
|
||||
this.reconnectAttempts < this.maxReconnectAttempts
|
||||
) {
|
||||
this.reconnectAttempts++;
|
||||
const delay =
|
||||
this.reconnectDelay * this.reconnectAttempts;
|
||||
this.terminal.write(
|
||||
`\r\nConnection lost. Reconnecting in ${delay / 1000}s...\r\n`,
|
||||
);
|
||||
|
||||
setTimeout(() => {
|
||||
this.connect();
|
||||
}, delay);
|
||||
} else {
|
||||
this.terminal.write(
|
||||
"\r\nFailed to reconnect. Please refresh the page.\r\n",
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
this.ws.onerror = (error) => {
|
||||
console.error("WebSocket error:", error);
|
||||
this.updateStatus("Connection Error", "disconnected");
|
||||
};
|
||||
}
|
||||
|
||||
sendResize() {
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
const dimensions = this.terminal;
|
||||
const resizeMsg = {
|
||||
cols: dimensions.cols,
|
||||
rows: dimensions.rows,
|
||||
};
|
||||
this.ws.send(JSON.stringify(resizeMsg));
|
||||
}
|
||||
}
|
||||
|
||||
updateStatus(text, className) {
|
||||
const status = document.getElementById("status");
|
||||
status.textContent = text;
|
||||
status.className = `status ${className}`;
|
||||
}
|
||||
}
|
||||
|
||||
updateStatus(text, className) {
|
||||
const status = document.getElementById('status');
|
||||
status.textContent = text;
|
||||
status.className = `status ${className}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize terminal when page loads
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
new WebTerminal();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
// Initialize terminal when page loads
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
new WebTerminal();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,2 +1,73 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),l=o-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),a=s-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-r;return{cols:Math.max(2,Math.floor(a/t.css.cell.width)),rows:Math.max(1,Math.floor(l/t.css.cell.height))}}}})(),e})()));
|
||||
//# sourceMappingURL=xterm-addon-fit.js.map
|
||||
!(function (e, t) {
|
||||
"object" == typeof exports && "object" == typeof module
|
||||
? (module.exports = t())
|
||||
: "function" == typeof define && define.amd
|
||||
? define([], t)
|
||||
: "object" == typeof exports
|
||||
? (exports.FitAddon = t())
|
||||
: (e.FitAddon = t());
|
||||
})(self, () =>
|
||||
(() => {
|
||||
"use strict";
|
||||
var e = {};
|
||||
return (
|
||||
(() => {
|
||||
var t = e;
|
||||
(Object.defineProperty(t, "__esModule", { value: !0 }),
|
||||
(t.FitAddon = void 0),
|
||||
(t.FitAddon = class {
|
||||
activate(e) {
|
||||
this._terminal = e;
|
||||
}
|
||||
dispose() {}
|
||||
fit() {
|
||||
const e = this.proposeDimensions();
|
||||
if (!e || !this._terminal || isNaN(e.cols) || isNaN(e.rows))
|
||||
return;
|
||||
const t = this._terminal._core;
|
||||
(this._terminal.rows === e.rows &&
|
||||
this._terminal.cols === e.cols) ||
|
||||
(t._renderService.clear(),
|
||||
this._terminal.resize(e.cols, e.rows));
|
||||
}
|
||||
proposeDimensions() {
|
||||
if (!this._terminal) return;
|
||||
if (
|
||||
!this._terminal.element ||
|
||||
!this._terminal.element.parentElement
|
||||
)
|
||||
return;
|
||||
const e = this._terminal._core,
|
||||
t = e._renderService.dimensions;
|
||||
if (0 === t.css.cell.width || 0 === t.css.cell.height) return;
|
||||
const r =
|
||||
0 === this._terminal.options.scrollback
|
||||
? 0
|
||||
: e.viewport.scrollBarWidth,
|
||||
i = window.getComputedStyle(
|
||||
this._terminal.element.parentElement,
|
||||
),
|
||||
o = parseInt(i.getPropertyValue("height")),
|
||||
s = Math.max(0, parseInt(i.getPropertyValue("width"))),
|
||||
n = window.getComputedStyle(this._terminal.element),
|
||||
l =
|
||||
o -
|
||||
(parseInt(n.getPropertyValue("padding-top")) +
|
||||
parseInt(n.getPropertyValue("padding-bottom"))),
|
||||
a =
|
||||
s -
|
||||
(parseInt(n.getPropertyValue("padding-right")) +
|
||||
parseInt(n.getPropertyValue("padding-left"))) -
|
||||
r;
|
||||
return {
|
||||
cols: Math.max(2, Math.floor(a / t.css.cell.width)),
|
||||
rows: Math.max(1, Math.floor(l / t.css.cell.height)),
|
||||
};
|
||||
}
|
||||
}));
|
||||
})(),
|
||||
e
|
||||
);
|
||||
})(),
|
||||
);
|
||||
//# sourceMappingURL=xterm-addon-fit.js.map
|
||||
+37
-15
@@ -79,7 +79,7 @@
|
||||
.xterm .composition-view {
|
||||
/* TODO: Composition position got messed up somewhere */
|
||||
background: #000;
|
||||
color: #FFF;
|
||||
color: #fff;
|
||||
display: none;
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
@@ -166,33 +166,55 @@
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.xterm-underline-1 { text-decoration: underline; }
|
||||
.xterm-underline-2 { text-decoration: double underline; }
|
||||
.xterm-underline-3 { text-decoration: wavy underline; }
|
||||
.xterm-underline-4 { text-decoration: dotted underline; }
|
||||
.xterm-underline-5 { text-decoration: dashed underline; }
|
||||
.xterm-underline-1 {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.xterm-underline-2 {
|
||||
text-decoration: double underline;
|
||||
}
|
||||
.xterm-underline-3 {
|
||||
text-decoration: wavy underline;
|
||||
}
|
||||
.xterm-underline-4 {
|
||||
text-decoration: dotted underline;
|
||||
}
|
||||
.xterm-underline-5 {
|
||||
text-decoration: dashed underline;
|
||||
}
|
||||
|
||||
.xterm-overline {
|
||||
text-decoration: overline;
|
||||
}
|
||||
|
||||
.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
|
||||
.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
|
||||
.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
|
||||
.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
|
||||
.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
|
||||
.xterm-overline.xterm-underline-1 {
|
||||
text-decoration: overline underline;
|
||||
}
|
||||
.xterm-overline.xterm-underline-2 {
|
||||
text-decoration: overline double underline;
|
||||
}
|
||||
.xterm-overline.xterm-underline-3 {
|
||||
text-decoration: overline wavy underline;
|
||||
}
|
||||
.xterm-overline.xterm-underline-4 {
|
||||
text-decoration: overline dotted underline;
|
||||
}
|
||||
.xterm-overline.xterm-underline-5 {
|
||||
text-decoration: overline dashed underline;
|
||||
}
|
||||
|
||||
.xterm-strikethrough {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.xterm-screen .xterm-decoration-container .xterm-decoration {
|
||||
z-index: 6;
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
|
||||
z-index: 7;
|
||||
.xterm-screen
|
||||
.xterm-decoration-container
|
||||
.xterm-decoration.xterm-decoration-top-layer {
|
||||
z-index: 7;
|
||||
}
|
||||
|
||||
.xterm-decoration-overview-ruler {
|
||||
|
||||
+14698
-2
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user