chore: back to attach addon

This commit is contained in:
naiba 2024-08-21 23:42:05 +08:00
parent fd85f599ba
commit 64da3c7438

View File

@ -63,6 +63,7 @@
<script src="https://unpkg.com/xterm@5.3.0/lib/xterm.js"></script> <script src="https://unpkg.com/xterm@5.3.0/lib/xterm.js"></script>
<script src="https://unpkg.com/@xterm/addon-fit@0.10.0/lib/addon-fit.js"></script> <script src="https://unpkg.com/@xterm/addon-fit@0.10.0/lib/addon-fit.js"></script>
<script src="https://unpkg.com/@xterm/addon-web-links@0.11.0/lib/addon-web-links.js"></script> <script src="https://unpkg.com/@xterm/addon-web-links@0.11.0/lib/addon-web-links.js"></script>
<script src="https://unpkg.com/@xterm/addon-attach@0.11.0/lib/addon-attach.js"></script>
<script> <script>
let sendResizing = false; let sendResizing = false;
@ -106,7 +107,9 @@
cursorBlink: true, cursorBlink: true,
}); });
const socket = new WebSocket((window.location.protocol == 'https:' ? 'wss' : 'ws') + '://' + window.location.host + '/terminal/' + '{{.SessionID}}'); const socket = new WebSocket((window.location.protocol == 'https:' ? 'wss' : 'ws') + '://' + window.location.host + '/terminal/' + '{{.SessionID}}');
socket.binaryType = 'arraybuffer';
const attachAddon = new AttachAddon.AttachAddon(socket);
term.loadAddon(attachAddon);
const fitAddon = new FitAddon.FitAddon(); const fitAddon = new FitAddon.FitAddon();
term.loadAddon(fitAddon); term.loadAddon(fitAddon);