Changes
Some checks failed
Some checks failed
This commit is contained in:
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
||||
module github.com/sorenisanerd/gotty
|
||||
module gitea.xs0.ru/forks/gotty
|
||||
|
||||
go 1.23
|
||||
|
||||
|
||||
@@ -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?';
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user