A few renames and minor cleanups

This commit is contained in:
Soren Hansen
2025-08-02 22:21:12 -07:00
parent c761b53d41
commit 2bee116ca3
9 changed files with 1052 additions and 361 deletions

View File

@@ -1,6 +1,6 @@
import { ConnectionFactory } from "./websocket";
import { Terminal, WebTTY, protocols } from "./webtty";
import { OurXterm } from "./xterm";
import { GoTTYXterm } from "./xterm";
// @TODO remove these
declare var gotty_auth_token: string;
@@ -11,7 +11,7 @@ const elem = document.getElementById("terminal")
if (elem !== null) {
var term: Terminal;
term = new OurXterm(elem);
term = new GoTTYXterm(elem);
const httpsEnabled = window.location.protocol == "https:";
const queryArgs = (gotty_ws_query_args === "") ? "" : "?" + gotty_ws_query_args;

View File

@@ -4,7 +4,7 @@ import { WebLinksAddon } from 'xterm-addon-web-links';
import { WebglAddon } from 'xterm-addon-webgl';
import { ZModemAddon } from "./zmodem";
export class OurXterm {
export class GoTTYXterm {
// The HTMLElement that contains our terminal
elem: HTMLElement;

View File

@@ -1,6 +1,6 @@
import { Component, ComponentChildren, createRef, render } from "preact";
import { ITerminalAddon, Terminal } from "xterm";
import { Browser, Detection, Offer, Sentry, Session } from 'zmodem.js/src/zmodem_browser';
import { Browser, Detection, Offer, Sentry, Session } from "zmodem.js";
import { Button, MyModal } from "./MyModal";
export class ZModemAddon implements ITerminalAddon {
@@ -209,15 +209,17 @@ export class SendFileModal extends Component<SendFileModalProps, SendFileModalSt
send() {
Browser.send_files(this.props.session,
this.filePickerRef.current!.files, {
on_offer_response: (f, xfer) => { this.setState({ state: "started" }) },
}).then(() => {
this.setState({ state: "done" })
this.props.session.close()
on_offer_response: (f, xfer) => {
this.setState({ state: "started" })
},
}
).then(() => {
this.setState({ state: "done" });
this.props.session.close();
if (this.props.onFinish !== undefined) {
this.props.onFinish();
}
})
.catch(e => console.log(e));
}).catch(e => console.log(e));
}
render() {