Changes
Some checks failed
Unit and Build Tests / bundle-up-to-date (push) Has been cancelled
Unit and Build Tests / cross-compile-test (push) Has been cancelled
pre-release / Pre Release Docker (push) Has been cancelled
Quick build test / quick-build-test (push) Has been cancelled

This commit is contained in:
2025-11-19 21:30:49 +03:00
parent 4606fadaa9
commit 4b995d970b
2 changed files with 9 additions and 2 deletions

2
go.mod
View File

@@ -1,4 +1,4 @@
module github.com/sorenisanerd/gotty
module gitea.xs0.ru/forks/gotty
go 1.23

View File

@@ -9,13 +9,16 @@ declare var gotty_ws_query_args: string;
const elem = document.getElementById("terminal")
function stripns(pd) { if (pd.substring(pd.length-1) == '/') { return pd; } else { return stripns(pd.substring(0,pd.length-1)); } }
if (elem !== null) {
var term: Terminal;
term = new GoTTYXterm(elem);
const httpsEnabled = window.location.protocol == "https:";
const queryArgs = (gotty_ws_query_args === "") ? "" : "?" + gotty_ws_query_args;
const url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws' + queryArgs;
const pathdir = stripns(window.location.pathname);
const url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + pathdir + 'ws' + queryArgs;
const args = window.location.search;
const factory = new ConnectionFactory(url, protocols);
const wt = new WebTTY(term, factory, args, gotty_auth_token);
@@ -28,4 +31,8 @@ if (elem !== null) {
closer();
term.close();
});
window.addEventListener("beforeunload", (e) => {
return 'No no no Ctrl-W is pressed. Or did you REALLY mean to close this tab?';
});
};