Skip to content

Commit

Permalink
bump xterm to v5 (butlerx#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
butlerx authored Oct 1, 2022
1 parent 027a005 commit 4adf2e3
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 53 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@
"toastify-js": "^1.9.1",
"url-value-parser": "^2.1.0",
"winston": "^3.3.3",
"xterm": "^4.19.0",
"xterm-addon-fit": "^0.5.0",
"xterm-addon-image": "^0.1.0",
"xterm-addon-web-links": "^0.6.0",
"xterm": "^5.0.0",
"xterm-addon-fit": "^0.6.0",
"xterm-addon-image": "^0.2.0",
"xterm-addon-web-links": "^0.7.0",
"yargs": "^15.4.1"
},
"devDependencies": {
Expand Down
20 changes: 11 additions & 9 deletions src/client/wetty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import _ from 'lodash';
import { dom, library } from '@fortawesome/fontawesome-svg-core';
import { faCogs } from '@fortawesome/free-solid-svg-icons';

import { FileDownloader } from './wetty/download.js';
import { disconnect } from './wetty/disconnect.js';
import { mobileKeyboard } from './wetty/mobile.js';
import { overlay } from './shared/elements.js';
import { socket } from './wetty/socket.js';
import { verifyPrompt } from './shared/verify.js';
import { terminal, Term } from './wetty/term.js';
import { FlowControlClient } from './wetty/flowcontrol.js';
import { FileDownloader } from './wetty/download';
import { disconnect } from './wetty/disconnect';
import { mobileKeyboard } from './wetty/mobile';
import { overlay } from './wetty/disconnect/elements';
import { socket } from './wetty/socket';
import { verifyPrompt } from './wetty/disconnect/verify';
import { terminal, Term } from './wetty/term';
import { FlowControlClient } from './wetty/flowcontrol';

// Setup for fontawesome
library.add(faCogs);
Expand Down Expand Up @@ -50,7 +50,9 @@ socket.on('connect', () => {
}
if (remainingData) {
if (fcClient.needsCommit(remainingData.length)) {
term.write(remainingData, () => socket.emit('commit', fcClient.ackBytes));
term.write(remainingData, () =>
socket.emit('commit', fcClient.ackBytes),
);
} else {
term.write(remainingData);
}
Expand Down
4 changes: 2 additions & 2 deletions src/client/wetty/disconnect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';
import { verifyPrompt } from '../shared/verify.js';
import { overlay } from '../shared/elements.js';
import { verifyPrompt } from './disconnect/verify';
import { overlay } from './disconnect/elements';

export function disconnect(reason: string): void {
if (_.isNull(overlay)) return;
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions src/client/wetty/term.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import { FitAddon } from 'xterm-addon-fit';
import { WebLinksAddon } from 'xterm-addon-web-links';
import { ImageAddon } from 'xterm-addon-image';

import type { Options } from './term/confiruragtion/shared/options';
import { loadOptions } from './term/confiruragtion/load';
import { configureTerm } from './term/confiruragtion.js';
import { terminal as termElement } from '../shared/elements.js';
import type { Options } from './term/options';
import { loadOptions } from './term/load';
import { configureTerm } from './term/confiruragtion';
import { terminal as termElement } from './disconnect/elements';

export class Term extends Terminal {
socket: Socket;
fitAddon: FitAddon;
loadOptions: () => Options;

constructor(socket: Socket) {
super();
super({ allowProposedApi: true });
this.socket = socket;
this.fitAddon = new FitAddon();
this.loadAddon(this.fitAddon);
Expand Down
10 changes: 5 additions & 5 deletions src/client/wetty/term/confiruragtion.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Term } from '../term';
import type { Options } from './confiruragtion/shared/options';
import type { Options } from './options';
import { copySelected, copyShortcut } from './confiruragtion/clipboard';
import { onInput, setOptions } from './confiruragtion/editor';
import { editor } from '../../shared/elements';
import { loadOptions } from './confiruragtion/load';
import { onInput } from './confiruragtion/editor';
import { editor } from '../disconnect/elements';
import { loadOptions } from './load';

export function configureTerm(term: Term): void {
const options = loadOptions();
try {
setOptions(term, options);
term.options = options.xterm;
} catch {
/* Do nothing */
}
Expand Down
14 changes: 3 additions & 11 deletions src/client/wetty/term/confiruragtion/editor.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { Term } from '../../term';
import { editor } from '../../../shared/elements';
import type { Options } from './shared/options';
import { editor } from '../../disconnect/elements';
import type { Options } from '../options';

export const onInput = (term: Term, updated: Options) => {
try {
const updatedConf = JSON.stringify(updated, null, 2);
if (localStorage.options === updatedConf) return;
setOptions(term, updated);
term.options = updated.xterm;
if (
!updated.wettyFitTerminal &&
updated.xterm.cols != null &&
Expand All @@ -21,11 +21,3 @@ export const onInput = (term: Term, updated: Options) => {
editor.classList.add('error');
}
};

export function setOptions(term: Term, { xterm }: Options) {
Object.keys(xterm).forEach(key => {
if (key === 'cols' || key === 'rows') return;
const value = xterm[key];
term.setOption(key, value);
});
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import type { XTerm, Options } from './shared/options';
import type { XTerm, Options } from './options';

export const defaultOptions: Options = {
xterm: { fontSize: 14 },
Expand Down
File renamed without changes.
32 changes: 16 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6996,25 +6996,25 @@ xmlhttprequest-ssl@~2.0.0:
resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz#91360c86b914e67f44dce769180027c0da618c67"
integrity sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==

xterm-addon-fit@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/xterm-addon-fit/-/xterm-addon-fit-0.5.0.tgz#2d51b983b786a97dcd6cde805e700c7f913bc596"
integrity sha512-DsS9fqhXHacEmsPxBJZvfj2la30Iz9xk+UKjhQgnYNkrUIN5CYLbw7WEfz117c7+S86S/tpHPfvNxJsF5/G8wQ==
xterm-addon-fit@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/xterm-addon-fit/-/xterm-addon-fit-0.6.0.tgz#142e1ce181da48763668332593fc440349c88c34"
integrity sha512-9/7A+1KEjkFam0yxTaHfuk9LEvvTSBi0PZmEkzJqgafXPEXL9pCMAVV7rB09sX6ATRDXAdBpQhZkhKj7CGvYeg==

xterm-addon-image@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/xterm-addon-image/-/xterm-addon-image-0.1.0.tgz#ead96aa224f5fcbfb45da2907f02368fe92985e6"
integrity sha512-xMvcEQ2rVUIXbbj5BRhznrZU24CRaMiSo8l2HH/E1FeE+G+KKduoF6mwja856/n4ekZ7K0ALZmmyDsbZODhDqQ==
xterm-addon-image@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/xterm-addon-image/-/xterm-addon-image-0.2.0.tgz#47f58a522c7d21c7b2fc7a2d18aff324461974f1"
integrity sha512-rGbwUcwnJQqN1LTdEhqUS83xtBpApUWOJISjN/Efbg8TplqdXsHOVDmEcnLvhBn5cCzAZIqD2OZaan1+cI7mWA==

xterm-addon-web-links@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.6.0.tgz#0296cb6c99588847894670d998c9ea6a6aeb26ee"
integrity sha512-H6XzjWWZu8FBo+fnYpxdPk9w5M6drbsvwPEJZGRS38MihiQaVFpKlCMKdfRgDbKGE530tw1yH54rhpZfHgt2/A==
xterm-addon-web-links@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.7.0.tgz#dceac36170605f9db10a01d716bd83ee38f65c17"
integrity sha512-6PqoqzzPwaeSq22skzbvyboDvSnYk5teUYEoKBwMYvhbkwOQkemZccjWHT5FnNA8o1aInTc4PRYAl4jjPucCKA==

xterm@^4.19.0:
version "4.19.0"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.19.0.tgz#c0f9d09cd61de1d658f43ca75f992197add9ef6d"
integrity sha512-c3Cp4eOVsYY5Q839dR5IejghRPpxciGmLWWaP9g+ppfMeBChMeLa1DCA+pmX/jyDZ+zxFOmlJL/82qVdayVoGQ==
xterm@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0.tgz#0af50509b33d0dc62fde7a4ec17750b8e453cc5c"
integrity sha512-tmVsKzZovAYNDIaUinfz+VDclraQpPUnAME+JawosgWRMphInDded/PuY0xmU5dOhyeYZsI0nz5yd8dPYsdLTA==

y18n@^4.0.0:
version "4.0.3"
Expand Down

0 comments on commit 4adf2e3

Please sign in to comment.