Skip to content

Commit d667ce8

Browse files
committed
feat: WebSSH 上传下载文件 (by trzsz)
1 parent 6abc0fc commit d667ce8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

resource/template/dashboard-default/terminal.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{define "dashboard-default/terminal"}}
22
<!DOCTYPE html>
33
<html lang="{{.Conf.Language}}">
4+
45
<head>
56
<meta charset="UTF-8">
67
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -23,16 +24,19 @@
2324
background-color: black;
2425
}
2526
</style>
27+
2628
<body onresize="onResize()">
2729
<div id="terminal-container"></div>
2830
<script src="https://unpkg.com/xterm@5.3.0/lib/xterm.js"></script>
29-
<script src="https://unpkg.com/@xterm/addon-attach@0.11.0/lib/addon-attach.js"></script>
3031
<script src="https://unpkg.com/@xterm/addon-fit@0.10.0/lib/addon-fit.js"></script>
32+
<script src="https://unpkg.com/@xterm/addon-web-links@0.11.0/lib/addon-web-links.js"></script>
33+
<script src="https://unpkg.com/trzsz@1.1.5/lib/trzsz.js"></script>
3134
<script>
3235
let sendResizing = false;
3336

3437
function doResize() {
3538
fitAddon.fit()
39+
3640
const w = fitAddon.proposeDimensions();
3741
const prefix = new Int8Array([1]);
3842
const resizeMessage = new TextEncoder().encode(JSON.stringify({
@@ -70,10 +74,11 @@
7074
cursorBlink: true,
7175
});
7276
const socket = new WebSocket((window.location.protocol == 'https:' ? 'wss' : 'ws') + '://' + window.location.host + '/terminal/' + '{{.SessionID}}');
73-
const attachAddon = new AttachAddon.AttachAddon(socket);
77+
const trzszAddon = new TrzszAddon(socket);
78+
term.loadAddon(trzszAddon);
7479
const fitAddon = new FitAddon.FitAddon();
75-
term.loadAddon(attachAddon);
7680
term.loadAddon(fitAddon);
81+
7782
term.open(document.getElementById('terminal-container'));
7883

7984
socket.onopen = () => {
@@ -90,5 +95,6 @@
9095
}
9196
</script>
9297
</body>
98+
9399
</html>
94100
{{end}}

0 commit comments

Comments
 (0)