Skip to content

Commit 07e7b20

Browse files
v2.2.1 Stable
v2.2.1
2 parents 88c6c38 + fe3b357 commit 07e7b20

11 files changed

Lines changed: 123 additions & 230 deletions

File tree

bootstrap.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { TServer } from "./server";
66
import { version } from "./package.json";
77
import open from "open";
88
import { exec } from "child_process";
9+
import AdmZip from "adm-zip";
910

1011
consola.info("Bootstrapping TerbiumOS [v" + version + "]");
1112

@@ -39,13 +40,29 @@ export async function BuildApps() {
3940
if (data.name !== "Browser") {
4041
data.config.src = data.config.src.replace(`/apps/${data.name.toLowerCase()}.tapp/`, `/fs/apps/system/${data.name.toLowerCase()}.tapp/`);
4142
data.config.icon = data.config.icon.replace(`/apps/${data.name.toLowerCase()}.tapp/`, `/fs/apps/system/${data.name.toLowerCase()}.tapp/`);
43+
} else {
44+
return;
4245
}
4346
result.push({ name: data.name, config: data.config });
4447
}
4548
} catch (t) {
46-
consola.error(`Error parsing ${indexFilePath}:`, t.message);
49+
consola.error(`Error parsing ${indexFilePath}:`, t instanceof Error ? t.message : String(t));
4750
}
4851
}
52+
} else if (i.name.endsWith(".tapp.zip")) {
53+
const zipPath = path.join(dir, i.name);
54+
try {
55+
const zip = new AdmZip(zipPath);
56+
const configEntry = zip.getEntry(".tbconfig");
57+
if (configEntry) {
58+
const configData = JSON.parse(configEntry.getData().toString("utf-8"));
59+
if (configData.title && configData.wmArgs) {
60+
result.push({ name: configData.title, config: configData.wmArgs });
61+
}
62+
}
63+
} catch (t) {
64+
consola.error(`Error reading ${zipPath}:`, t instanceof Error ? t.message : String(t));
65+
}
4966
}
5067
});
5168
}
@@ -115,6 +132,8 @@ export async function CreateAppsPaths() {
115132
} else {
116133
collectPaths(appPath);
117134
}
135+
} else if (app.name.toLowerCase().endsWith(".tapp.zip")) {
136+
accmp.push(app.name);
118137
}
119138
});
120139

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tb-v2",
33
"private": true,
4-
"version": "2.2.0",
4+
"version": "2.2.1",
55
"type": "module",
66
"scripts": {
77
"start": "npm run build && tsx bootstrap.ts",
@@ -52,16 +52,18 @@
5252
"devDependencies": {
5353
"@biomejs/biome": "2.3.10",
5454
"@eslint/js": "^9.39.2",
55+
"@types/adm-zip": "^0.5.7",
5556
"@types/node": "^25.0.3",
5657
"@types/path-browserify": "^1.0.3",
5758
"@types/react": "^19.2.7",
5859
"@types/react-dom": "^19.2.3",
5960
"@vitejs/plugin-react-swc": "^4.2.2",
61+
"adm-zip": "^0.5.16",
6062
"autoprefixer": "^10.4.23",
6163
"eslint": "^9.39.2",
6264
"eslint-plugin-react-hooks": "7.0.1",
6365
"eslint-plugin-react-refresh": "^0.4.26",
64-
"globals": "^16.5.0",
66+
"globals": "^17.0.0",
6567
"htmlparser2": "^10.0.0",
6668
"tailwindcss": "^4.1.18",
6769
"typescript": "^5.9.3",

pnpm-lock.yaml

Lines changed: 24 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/apps/terminal.tapp/index.html

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,12 @@
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@4.19.0/css/xterm.css" />
6+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xterm/xterm@latest/css/xterm.css" />
77
<link rel="stylesheet" href="./terminal.css" />
88
<title>terminal</title>
99
</head>
1010
<body>
11-
<script src="/assets/libs/filer.min.js"></script>
12-
<script src="https://cdn.jsdelivr.net/npm/xterm@4.19.0/lib/xterm.js"></script>
1311
<script src="https://cdn.jsdelivr.net/gh/lit/dist@3/all/lit-all.min.js" type="module"></script>
14-
<script type="importmap">
15-
{
16-
"imports": {
17-
"yargs-parser": "https://unpkg.com/yargs-parser@22.0.0/browser.js",
18-
"iso-http": "/assets/libs/http.min.js",
19-
"git": "https://cdn.jsdelivr.net/npm/isomorphic-git@latest/+esm"
20-
}
21-
}
22-
</script>
2312
<script src="./index.js" type="module"></script>
2413
<script src="./terminal_com.js"></script>
2514
<div id="term">

public/apps/terminal.tapp/index.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
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";
45

56
/**
67
* @typedef {import("yargs-parser").Arguments} argv
@@ -64,17 +65,18 @@ let path = `/home/${sessionStorage.getItem("currAcc")}/`;
6465
const HISTORY_LIMIT = 1000;
6566
const HISTORY_FILE = ".bash_history";
6667

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+
});
6876
document.addEventListener("DOMContentLoaded", async () => {
6977
term.open(document.getElementById("term"));
7078
term.writeln(`TerbiumOS [Version: ${tb.system.version()}]`);
7179
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);
7880
window.term = term;
7981

8082
// Load command history
@@ -158,8 +160,10 @@ document.addEventListener("DOMContentLoaded", async () => {
158160
* @returns {void}
159161
*/
160162
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);
163167
term.resize(cols, rows);
164168
}
165169
setTimeout(resizeTerm, 50);
@@ -200,7 +204,7 @@ async function handleCommand(name, args) {
200204
scriptRes = await fetch(scriptPaths[0]);
201205
} catch {
202206
try {
203-
scriptRes = await fetch(scriptPathss[1]);
207+
scriptRes = await fetch(scriptPaths[1]);
204208
} catch (error) {
205209
displayError(`Failed to fetch script: ${error.message}`);
206210
createNewCommandInput();

public/apps/terminal.tapp/terminal.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,8 @@ body {
7676
.error-text {
7777
color: #e64343;
7878
}
79+
80+
.xterm-helpers {
81+
position: fixed;
82+
opacity: 0;
83+
}

0 commit comments

Comments
 (0)