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

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
/*!
* Bootstrap v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Bootstrap v5.3.7 (https://getbootstrap.com/)
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

File diff suppressed because one or more lines are too long

View File

@@ -26,7 +26,7 @@ bootstrap
MIT
The MIT License (MIT)
Copyright (c) 2011-2023 The Bootstrap Authors
Copyright (c) 2011-2025 The Bootstrap Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -278,28 +278,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
jsx-runtime
MIT
The MIT License (MIT)
Copyright (c) 2015-present Jason Miller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
preact
MIT

1311
js/package-lock.json generated

File diff suppressed because it is too large Load Diff

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() {

48
js/typings/zmodem.d.ts vendored Normal file
View File

@@ -0,0 +1,48 @@
declare module 'zmodem.js' {
export function send(data: Buffer): Promise<void>;
export function receive(): Promise<Buffer>;
export interface SendFilesOptions {
on_offer_response?: (file: File, xfer: any) => void;
}
export interface SentryOptions {
to_terminal: (data: Uint8Array) => void;
on_detect: (detection: Detection) => void;
sender: (data: Uint8Array) => void;
on_retract: () => void;
}
export interface FileDetails {
name: string;
size: number;
}
export class Browser {
static save_to_disk(payloads: any, filename: string): void;
static send_files(session: Session, files: FileList | null, options?: SendFilesOptions): Promise<void>;
}
export class Detection {
confirm(): Session;
}
export class Offer {
accept(): Promise<any>;
skip(): void;
get_details(): FileDetails;
get_offset(): number;
}
export class Sentry {
constructor(options: SentryOptions);
consume(data: Uint8Array): void;
}
export class Session {
type: "send" | "receive";
on(event: string, callback: (...args: any[]) => void): void;
start(): void;
close(): void;
}
}