|
1 | | -import parser from "yargs-parser"; |
2 | | -import http from "iso-http"; |
3 | | -import git from "git"; |
| 1 | +import parser from "https://unpkg.com/yargs-parser@22.0.0/browser.js"; |
| 2 | +import http from "https://cdn.jsdelivr.net/npm/isomorphic-git@latest/http/web/index.js"; |
| 3 | +import git from "https://cdn.jsdelivr.net/npm/isomorphic-git@latest/+esm"; |
| 4 | +import { Terminal } from "https://cdn.jsdelivr.net/npm/@xterm/xterm@latest/+esm"; |
4 | 5 |
|
5 | 6 | /** |
6 | 7 | * @typedef {import("yargs-parser").Arguments} argv |
@@ -64,17 +65,18 @@ let path = `/home/${sessionStorage.getItem("currAcc")}/`; |
64 | 65 | const HISTORY_LIMIT = 1000; |
65 | 66 | const HISTORY_FILE = ".bash_history"; |
66 | 67 |
|
67 | | -const term = new Terminal(); |
| 68 | +const term = new Terminal({ |
| 69 | + theme: { |
| 70 | + background: "#000000", |
| 71 | + cursor: "#ffffff", |
| 72 | + selection: "#444444", |
| 73 | + }, |
| 74 | + cursorBlink: true, |
| 75 | +}); |
68 | 76 | document.addEventListener("DOMContentLoaded", async () => { |
69 | 77 | term.open(document.getElementById("term")); |
70 | 78 | term.writeln(`TerbiumOS [Version: ${tb.system.version()}]`); |
71 | 79 | term.writeln(`Type 'help' for a list of commands.`); |
72 | | - term.setOption("theme", { |
73 | | - background: "#000000", |
74 | | - cursor: "#ffffff", |
75 | | - selection: "#444444", |
76 | | - }); |
77 | | - term.setOption("cursorBlink", true); |
78 | 80 | window.term = term; |
79 | 81 |
|
80 | 82 | // Load command history |
@@ -158,8 +160,10 @@ document.addEventListener("DOMContentLoaded", async () => { |
158 | 160 | * @returns {void} |
159 | 161 | */ |
160 | 162 | function resizeTerm() { |
161 | | - const cols = Math.floor(window.innerWidth / term._core._renderService.dimensions.actualCellWidth); |
162 | | - const rows = Math.floor(window.innerHeight / term._core._renderService.dimensions.actualCellHeight); |
| 163 | + const charWidth = term._core._renderService.dimensions.css.cell.width; |
| 164 | + const charHeight = term._core._renderService.dimensions.css.cell.height; |
| 165 | + const cols = Math.floor(window.innerWidth / charWidth); |
| 166 | + const rows = Math.floor(window.innerHeight / charHeight); |
163 | 167 | term.resize(cols, rows); |
164 | 168 | } |
165 | 169 | setTimeout(resizeTerm, 50); |
@@ -200,7 +204,7 @@ async function handleCommand(name, args) { |
200 | 204 | scriptRes = await fetch(scriptPaths[0]); |
201 | 205 | } catch { |
202 | 206 | try { |
203 | | - scriptRes = await fetch(scriptPathss[1]); |
| 207 | + scriptRes = await fetch(scriptPaths[1]); |
204 | 208 | } catch (error) { |
205 | 209 | displayError(`Failed to fetch script: ${error.message}`); |
206 | 210 | createNewCommandInput(); |
|
0 commit comments