@ecmaos/kernel 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{browser-DwS0anQc.js → browser-C1zKI-gX.js} +2 -2
- package/dist/assets/{browser-DwS0anQc.js.map → browser-C1zKI-gX.js.map} +1 -1
- package/dist/assets/{index-xODqy1dm.js → index-BOrpzH3-.js} +307 -284
- package/dist/assets/index-BOrpzH3-.js.map +1 -0
- package/dist/assets/{topbar.min-BGDI2FSe.js → topbar.min-DotodHSt.js} +2 -2
- package/dist/assets/{topbar.min-BGDI2FSe.js.map → topbar.min-DotodHSt.js.map} +1 -1
- package/dist/index.html +1 -1
- package/package.json +6 -7
- package/dist/assets/index-xODqy1dm.js.map +0 -1
|
@@ -18432,7 +18432,7 @@ Commands:
|
|
|
18432
18432
|
}
|
|
18433
18433
|
return 0;
|
|
18434
18434
|
}
|
|
18435
|
-
async function test$2(
|
|
18435
|
+
async function test$2(kernel2) {
|
|
18436
18436
|
const sampleRate = 44100;
|
|
18437
18437
|
const noteLength = 0.25;
|
|
18438
18438
|
const shortNoteLength = 0.125;
|
|
@@ -18506,17 +18506,17 @@ async function test$2(kernel) {
|
|
|
18506
18506
|
finalBuffer.set(new Uint8Array(header), 0);
|
|
18507
18507
|
finalBuffer.set(new Uint8Array(audioData), header.byteLength);
|
|
18508
18508
|
try {
|
|
18509
|
-
|
|
18510
|
-
const fd2 = await
|
|
18509
|
+
kernel2.terminal.writeln("Playing test beeps...");
|
|
18510
|
+
const fd2 = await kernel2.filesystem.fs.open("/dev/audio", "w", 438);
|
|
18511
18511
|
await fd2.write(finalBuffer);
|
|
18512
18512
|
await fd2.close();
|
|
18513
18513
|
} catch (error) {
|
|
18514
|
-
|
|
18514
|
+
kernel2.terminal.writeln(`Error playing audio: ${error}`);
|
|
18515
18515
|
return 1;
|
|
18516
18516
|
}
|
|
18517
18517
|
return 0;
|
|
18518
18518
|
}
|
|
18519
|
-
async function getDrivers$c(
|
|
18519
|
+
async function getDrivers$c(kernel2) {
|
|
18520
18520
|
const drivers = [];
|
|
18521
18521
|
drivers.push({
|
|
18522
18522
|
name: "audio",
|
|
@@ -18525,7 +18525,7 @@ async function getDrivers$c(kernel) {
|
|
|
18525
18525
|
minor: 4,
|
|
18526
18526
|
data: {
|
|
18527
18527
|
version: pkg$c.version,
|
|
18528
|
-
kernel:
|
|
18528
|
+
kernel: kernel2.id,
|
|
18529
18529
|
context: new AudioContext()
|
|
18530
18530
|
}
|
|
18531
18531
|
}),
|
|
@@ -18858,7 +18858,7 @@ Commands:
|
|
|
18858
18858
|
return 1;
|
|
18859
18859
|
}
|
|
18860
18860
|
}
|
|
18861
|
-
async function getDrivers$b(
|
|
18861
|
+
async function getDrivers$b(kernel2) {
|
|
18862
18862
|
const drivers = [];
|
|
18863
18863
|
if ("getBattery" in navigator) {
|
|
18864
18864
|
const battery = await navigator.getBattery();
|
|
@@ -18868,7 +18868,7 @@ async function getDrivers$b(kernel) {
|
|
|
18868
18868
|
major: 10,
|
|
18869
18869
|
minor: 100,
|
|
18870
18870
|
data: {
|
|
18871
|
-
kernelId:
|
|
18871
|
+
kernelId: kernel2.id,
|
|
18872
18872
|
charging: battery.charging,
|
|
18873
18873
|
chargingTime: battery.chargingTime,
|
|
18874
18874
|
dischargingTime: battery.dischargingTime,
|
|
@@ -18898,18 +18898,18 @@ const pkg$a = {
|
|
|
18898
18898
|
};
|
|
18899
18899
|
async function cli$a(options) {
|
|
18900
18900
|
var _a3, _b2, _c, _d, _e, _f, _g;
|
|
18901
|
-
const { args, terminal, kernel } = options;
|
|
18901
|
+
const { args, terminal, kernel: kernel2 } = options;
|
|
18902
18902
|
if (!(navigator == null ? void 0 : navigator.bluetooth)) {
|
|
18903
18903
|
terminal.writeln("Bluetooth API not available");
|
|
18904
18904
|
return 1;
|
|
18905
18905
|
}
|
|
18906
18906
|
async function ensureBluetoothPermission() {
|
|
18907
|
-
if (
|
|
18907
|
+
if (kernel2.storage.local.getItem("permission:bluetooth") === "1")
|
|
18908
18908
|
return true;
|
|
18909
|
-
if (
|
|
18909
|
+
if (kernel2.storage.session.getItem("hide:permission:bluetooth") === "1")
|
|
18910
18910
|
return false;
|
|
18911
18911
|
return new Promise((resolve2) => {
|
|
18912
|
-
const win =
|
|
18912
|
+
const win = kernel2.windows.create({
|
|
18913
18913
|
id: "bluetooth-permission",
|
|
18914
18914
|
title: "Bluetooth Permission",
|
|
18915
18915
|
modal: true,
|
|
@@ -18924,14 +18924,14 @@ async function cli$a(options) {
|
|
|
18924
18924
|
var _a4;
|
|
18925
18925
|
try {
|
|
18926
18926
|
await navigator.bluetooth.requestDevice({ acceptAllDevices: true });
|
|
18927
|
-
|
|
18927
|
+
kernel2.storage.local.setItem("permission:bluetooth", "1");
|
|
18928
18928
|
win.close();
|
|
18929
18929
|
resolve2(true);
|
|
18930
18930
|
} catch (error) {
|
|
18931
|
-
(_a4 =
|
|
18932
|
-
|
|
18931
|
+
(_a4 = kernel2.log) == null ? void 0 : _a4.error("Error requesting Bluetooth device", error);
|
|
18932
|
+
kernel2.storage.session.removeItem("permission:bluetooth");
|
|
18933
18933
|
win.close();
|
|
18934
|
-
const dialog =
|
|
18934
|
+
const dialog = kernel2.windows.dialog({
|
|
18935
18935
|
title: "⚠️ Error",
|
|
18936
18936
|
height: 250,
|
|
18937
18937
|
html: `
|
|
@@ -19142,14 +19142,14 @@ Commands:
|
|
|
19142
19142
|
return 1;
|
|
19143
19143
|
}
|
|
19144
19144
|
}
|
|
19145
|
-
async function getDrivers$a(
|
|
19145
|
+
async function getDrivers$a(kernel2) {
|
|
19146
19146
|
const drivers = [{
|
|
19147
19147
|
name: "bluetooth",
|
|
19148
19148
|
init: () => ({
|
|
19149
19149
|
major: 216,
|
|
19150
19150
|
minor: 0,
|
|
19151
19151
|
data: {
|
|
19152
|
-
kernelId:
|
|
19152
|
+
kernelId: kernel2.id,
|
|
19153
19153
|
available: !!(navigator == null ? void 0 : navigator.bluetooth)
|
|
19154
19154
|
}
|
|
19155
19155
|
}),
|
|
@@ -19437,13 +19437,13 @@ Commands:
|
|
|
19437
19437
|
return 1;
|
|
19438
19438
|
}
|
|
19439
19439
|
}
|
|
19440
|
-
async function getDrivers$9(
|
|
19440
|
+
async function getDrivers$9(kernel2) {
|
|
19441
19441
|
const drivers = [{
|
|
19442
19442
|
name: "gamepad",
|
|
19443
19443
|
init: () => ({
|
|
19444
19444
|
major: 13,
|
|
19445
19445
|
minor: 1,
|
|
19446
|
-
data: { kernelId:
|
|
19446
|
+
data: { kernelId: kernel2.id, version: pkg$9.version }
|
|
19447
19447
|
}),
|
|
19448
19448
|
read: () => 0,
|
|
19449
19449
|
write: () => 0
|
|
@@ -19719,7 +19719,7 @@ Commands:
|
|
|
19719
19719
|
return 1;
|
|
19720
19720
|
}
|
|
19721
19721
|
}
|
|
19722
|
-
async function getDrivers$8(
|
|
19722
|
+
async function getDrivers$8(kernel2) {
|
|
19723
19723
|
const drivers = [];
|
|
19724
19724
|
if ("geolocation" in navigator) {
|
|
19725
19725
|
let lastPosition = {
|
|
@@ -19766,7 +19766,7 @@ async function getDrivers$8(kernel) {
|
|
|
19766
19766
|
major: 10,
|
|
19767
19767
|
minor: 101,
|
|
19768
19768
|
data: {
|
|
19769
|
-
kernelId:
|
|
19769
|
+
kernelId: kernel2.id,
|
|
19770
19770
|
version: pkg$8.version
|
|
19771
19771
|
}
|
|
19772
19772
|
}),
|
|
@@ -19824,7 +19824,7 @@ Launch chrome using: google-chrome --enable-unsafe-webgpu --enable-features=Vulk
|
|
|
19824
19824
|
}
|
|
19825
19825
|
return 0;
|
|
19826
19826
|
}
|
|
19827
|
-
async function getDrivers$7(
|
|
19827
|
+
async function getDrivers$7(kernel2) {
|
|
19828
19828
|
const drivers = [];
|
|
19829
19829
|
if ("gpu" in navigator) {
|
|
19830
19830
|
const adapter = await navigator.gpu.requestAdapter();
|
|
@@ -19840,7 +19840,7 @@ async function getDrivers$7(kernel) {
|
|
|
19840
19840
|
data: {
|
|
19841
19841
|
adapter,
|
|
19842
19842
|
device,
|
|
19843
|
-
kernelId:
|
|
19843
|
+
kernelId: kernel2.id,
|
|
19844
19844
|
features: Array.from(adapter.features),
|
|
19845
19845
|
limits: Object.fromEntries(
|
|
19846
19846
|
Object.entries(adapter.limits).map(([k, v]) => [k, String(v)])
|
|
@@ -19855,7 +19855,7 @@ async function getDrivers$7(kernel) {
|
|
|
19855
19855
|
}
|
|
19856
19856
|
return drivers;
|
|
19857
19857
|
}
|
|
19858
|
-
async function test$1(
|
|
19858
|
+
async function test$1(kernel2) {
|
|
19859
19859
|
var _a3;
|
|
19860
19860
|
if (!("gpu" in navigator)) throw new Error("WebGPU not available");
|
|
19861
19861
|
const adapter = await navigator.gpu.requestAdapter();
|
|
@@ -19926,7 +19926,7 @@ async function test$1(kernel) {
|
|
|
19926
19926
|
pass.draw(3, 1, 0, 0);
|
|
19927
19927
|
pass.end();
|
|
19928
19928
|
device.queue.submit([commandEncoder.finish()]);
|
|
19929
|
-
if ((_a3 =
|
|
19929
|
+
if ((_a3 = kernel2.terminal) == null ? void 0 : _a3.element) kernel2.terminal.element.style.display = "none";
|
|
19930
19930
|
canvas.style.position = "absolute";
|
|
19931
19931
|
canvas.style.top = "0";
|
|
19932
19932
|
canvas.style.left = "0";
|
|
@@ -19934,9 +19934,9 @@ async function test$1(kernel) {
|
|
|
19934
19934
|
document.body.appendChild(canvas);
|
|
19935
19935
|
setTimeout(() => {
|
|
19936
19936
|
var _a4;
|
|
19937
|
-
if ((_a4 =
|
|
19937
|
+
if ((_a4 = kernel2.terminal) == null ? void 0 : _a4.element) kernel2.terminal.element.style.display = "";
|
|
19938
19938
|
canvas.remove();
|
|
19939
|
-
|
|
19939
|
+
kernel2.terminal.focus();
|
|
19940
19940
|
}, 2e3);
|
|
19941
19941
|
}
|
|
19942
19942
|
const GPUDevice = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -20257,7 +20257,7 @@ Commands:
|
|
|
20257
20257
|
return 1;
|
|
20258
20258
|
}
|
|
20259
20259
|
}
|
|
20260
|
-
async function getDrivers$6(
|
|
20260
|
+
async function getDrivers$6(kernel2) {
|
|
20261
20261
|
const deviceMap = /* @__PURE__ */ new Map();
|
|
20262
20262
|
const drivers = [{
|
|
20263
20263
|
name: "hid",
|
|
@@ -20265,7 +20265,7 @@ async function getDrivers$6(kernel) {
|
|
|
20265
20265
|
major: 13,
|
|
20266
20266
|
minor: 64,
|
|
20267
20267
|
data: {
|
|
20268
|
-
kernelId:
|
|
20268
|
+
kernelId: kernel2.id,
|
|
20269
20269
|
version: pkg$6.version
|
|
20270
20270
|
}
|
|
20271
20271
|
}),
|
|
@@ -20296,7 +20296,7 @@ async function getDrivers$6(kernel) {
|
|
|
20296
20296
|
major: 13,
|
|
20297
20297
|
minor: 64 + drivers.length,
|
|
20298
20298
|
data: {
|
|
20299
|
-
kernelId:
|
|
20299
|
+
kernelId: kernel2.id,
|
|
20300
20300
|
version: pkg$6.version
|
|
20301
20301
|
}
|
|
20302
20302
|
}),
|
|
@@ -20434,13 +20434,13 @@ Commands:
|
|
|
20434
20434
|
return 1;
|
|
20435
20435
|
}
|
|
20436
20436
|
}
|
|
20437
|
-
async function getDrivers$5(
|
|
20437
|
+
async function getDrivers$5(kernel2) {
|
|
20438
20438
|
const drivers = [{
|
|
20439
20439
|
name: "midi",
|
|
20440
20440
|
init: () => ({
|
|
20441
20441
|
major: 35,
|
|
20442
20442
|
minor: 0,
|
|
20443
|
-
data: { kernelId:
|
|
20443
|
+
data: { kernelId: kernel2.id }
|
|
20444
20444
|
}),
|
|
20445
20445
|
read: () => 0,
|
|
20446
20446
|
write: () => 0
|
|
@@ -20502,22 +20502,22 @@ async function getDrivers$4() {
|
|
|
20502
20502
|
}
|
|
20503
20503
|
return drivers;
|
|
20504
20504
|
}
|
|
20505
|
-
async function listDisplays(
|
|
20505
|
+
async function listDisplays(kernel2, presentationUrl) {
|
|
20506
20506
|
if (!("PresentationRequest" in globalThis)) throw new Error("PresentationRequest API not supported");
|
|
20507
20507
|
try {
|
|
20508
20508
|
const url = new URL(presentationUrl);
|
|
20509
20509
|
const request = new globalThis.PresentationRequest([url.toString()]);
|
|
20510
20510
|
const availability = await request.getAvailability();
|
|
20511
|
-
|
|
20511
|
+
kernel2.terminal.writeln(`Available displays: ${availability ? "Yes" : "No"}`);
|
|
20512
20512
|
if (availability) {
|
|
20513
20513
|
const connectionState = activeConnection ? "Connected" : "Not connected";
|
|
20514
|
-
|
|
20514
|
+
kernel2.terminal.writeln(`Connection state: ${connectionState}`);
|
|
20515
20515
|
}
|
|
20516
20516
|
} catch (error) {
|
|
20517
|
-
|
|
20517
|
+
kernel2.terminal.writeln(`Error checking displays: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
20518
20518
|
}
|
|
20519
20519
|
}
|
|
20520
|
-
async function startPresentation(
|
|
20520
|
+
async function startPresentation(kernel2, presentationUrl) {
|
|
20521
20521
|
if (!("PresentationRequest" in globalThis)) throw new Error("PresentationRequest API not supported");
|
|
20522
20522
|
try {
|
|
20523
20523
|
if (activeConnection) {
|
|
@@ -20531,19 +20531,19 @@ async function startPresentation(kernel, presentationUrl) {
|
|
|
20531
20531
|
if (!available) throw new Error("No presentation displays available");
|
|
20532
20532
|
const connection = await request.start();
|
|
20533
20533
|
activeConnection = connection;
|
|
20534
|
-
|
|
20534
|
+
kernel2.terminal.writeln(`Presentation started: ${url}`);
|
|
20535
20535
|
connection.addEventListener("close", () => {
|
|
20536
20536
|
activeConnection = null;
|
|
20537
|
-
|
|
20537
|
+
kernel2.terminal.writeln("Presentation closed");
|
|
20538
20538
|
});
|
|
20539
20539
|
connection.addEventListener("terminate", () => {
|
|
20540
20540
|
activeConnection = null;
|
|
20541
|
-
|
|
20541
|
+
kernel2.terminal.writeln("Presentation terminated");
|
|
20542
20542
|
});
|
|
20543
20543
|
} catch (error) {
|
|
20544
20544
|
activeRequest = null;
|
|
20545
20545
|
activeConnection = null;
|
|
20546
|
-
|
|
20546
|
+
kernel2.terminal.writeln(`Error starting presentation: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
20547
20547
|
}
|
|
20548
20548
|
}
|
|
20549
20549
|
const PresentationDevice = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -20832,10 +20832,10 @@ Commands:
|
|
|
20832
20832
|
return 1;
|
|
20833
20833
|
}
|
|
20834
20834
|
}
|
|
20835
|
-
async function getDrivers$3(
|
|
20835
|
+
async function getDrivers$3(kernel2) {
|
|
20836
20836
|
const drivers = [{
|
|
20837
20837
|
name: "sensors",
|
|
20838
|
-
init: () => ({ major: 0, minor: 0, data: { kernelId:
|
|
20838
|
+
init: () => ({ major: 0, minor: 0, data: { kernelId: kernel2.id, version: pkg$3.version } }),
|
|
20839
20839
|
read: () => 0,
|
|
20840
20840
|
write: () => 0
|
|
20841
20841
|
}];
|
|
@@ -21123,10 +21123,10 @@ async function createDriver(name) {
|
|
|
21123
21123
|
}
|
|
21124
21124
|
};
|
|
21125
21125
|
}
|
|
21126
|
-
async function getDrivers$2(
|
|
21126
|
+
async function getDrivers$2(kernel2) {
|
|
21127
21127
|
if (typeof navigator === "undefined" || !navigator.serial) return [];
|
|
21128
21128
|
navigator.serial.addEventListener("connect", async (event) => {
|
|
21129
|
-
|
|
21129
|
+
kernel2.events.emit("device:connect", event.target);
|
|
21130
21130
|
if (event.target && !availablePorts.has(event.target)) {
|
|
21131
21131
|
availablePorts.add(event.target);
|
|
21132
21132
|
}
|
|
@@ -21243,14 +21243,14 @@ Commands:
|
|
|
21243
21243
|
return 1;
|
|
21244
21244
|
}
|
|
21245
21245
|
}
|
|
21246
|
-
async function getDrivers$1(
|
|
21246
|
+
async function getDrivers$1(kernel2) {
|
|
21247
21247
|
const drivers = [
|
|
21248
21248
|
{
|
|
21249
21249
|
name: "usb",
|
|
21250
21250
|
init: () => ({
|
|
21251
21251
|
major: 8,
|
|
21252
21252
|
minor: 0,
|
|
21253
|
-
data: { kernelId:
|
|
21253
|
+
data: { kernelId: kernel2.id }
|
|
21254
21254
|
}),
|
|
21255
21255
|
read: () => 0,
|
|
21256
21256
|
write: () => 0
|
|
@@ -21264,7 +21264,7 @@ async function getDrivers$1(kernel) {
|
|
|
21264
21264
|
init: () => ({
|
|
21265
21265
|
major: 8,
|
|
21266
21266
|
minor: device.vendorId + device.productId,
|
|
21267
|
-
data: { device, kernelId:
|
|
21267
|
+
data: { device, kernelId: kernel2.id }
|
|
21268
21268
|
}),
|
|
21269
21269
|
read: () => 0,
|
|
21270
21270
|
write: () => 0
|
|
@@ -21316,7 +21316,7 @@ Commands:
|
|
|
21316
21316
|
}
|
|
21317
21317
|
return 0;
|
|
21318
21318
|
}
|
|
21319
|
-
async function getDrivers(
|
|
21319
|
+
async function getDrivers(kernel2) {
|
|
21320
21320
|
var _a3;
|
|
21321
21321
|
const drivers = [];
|
|
21322
21322
|
try {
|
|
@@ -21343,11 +21343,11 @@ async function getDrivers(kernel) {
|
|
|
21343
21343
|
});
|
|
21344
21344
|
}
|
|
21345
21345
|
} catch (error) {
|
|
21346
|
-
(_a3 =
|
|
21346
|
+
(_a3 = kernel2.log) == null ? void 0 : _a3.error(`Failed to initialize WebGL device: ${error}`);
|
|
21347
21347
|
}
|
|
21348
21348
|
return drivers;
|
|
21349
21349
|
}
|
|
21350
|
-
async function showInfo(
|
|
21350
|
+
async function showInfo(kernel2) {
|
|
21351
21351
|
var _a3, _b2, _c, _d, _e, _f;
|
|
21352
21352
|
const canvas = document.createElement("canvas");
|
|
21353
21353
|
const context = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
|
@@ -21361,25 +21361,25 @@ async function showInfo(kernel) {
|
|
|
21361
21361
|
shadingLanguage: context.getParameter(context.SHADING_LANGUAGE_VERSION),
|
|
21362
21362
|
extensions: context.getSupportedExtensions() || []
|
|
21363
21363
|
};
|
|
21364
|
-
(_a3 =
|
|
21365
|
-
(_b2 =
|
|
21366
|
-
(_c =
|
|
21367
|
-
(_d =
|
|
21368
|
-
(_e =
|
|
21369
|
-
(_f =
|
|
21364
|
+
(_a3 = kernel2.terminal) == null ? void 0 : _a3.writeln("\nWebGL Information:");
|
|
21365
|
+
(_b2 = kernel2.terminal) == null ? void 0 : _b2.writeln(`Vendor: ${info.vendor}`);
|
|
21366
|
+
(_c = kernel2.terminal) == null ? void 0 : _c.writeln(`Renderer: ${info.renderer}`);
|
|
21367
|
+
(_d = kernel2.terminal) == null ? void 0 : _d.writeln(`Version: ${info.version}`);
|
|
21368
|
+
(_e = kernel2.terminal) == null ? void 0 : _e.writeln(`Shading Language: ${info.shadingLanguage}`);
|
|
21369
|
+
(_f = kernel2.terminal) == null ? void 0 : _f.writeln("\nSupported Extensions:");
|
|
21370
21370
|
info.extensions.forEach((ext) => {
|
|
21371
21371
|
var _a4;
|
|
21372
|
-
return (_a4 =
|
|
21372
|
+
return (_a4 = kernel2.terminal) == null ? void 0 : _a4.writeln(` ${ext}`);
|
|
21373
21373
|
});
|
|
21374
21374
|
}
|
|
21375
|
-
async function test(
|
|
21375
|
+
async function test(kernel2) {
|
|
21376
21376
|
var _a3;
|
|
21377
21377
|
const canvas = document.createElement("canvas");
|
|
21378
21378
|
const context = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
|
21379
21379
|
if (!context) {
|
|
21380
21380
|
throw new Error("WebGL not available");
|
|
21381
21381
|
}
|
|
21382
|
-
if ((_a3 =
|
|
21382
|
+
if ((_a3 = kernel2.terminal) == null ? void 0 : _a3.element) kernel2.terminal.element.style.display = "none";
|
|
21383
21383
|
canvas.width = window.innerWidth;
|
|
21384
21384
|
canvas.height = window.innerHeight;
|
|
21385
21385
|
canvas.style.position = "absolute";
|
|
@@ -21390,9 +21390,9 @@ async function test(kernel) {
|
|
|
21390
21390
|
await runWebGLTest(context);
|
|
21391
21391
|
setTimeout(() => {
|
|
21392
21392
|
var _a4, _b2;
|
|
21393
|
-
if ((_a4 =
|
|
21393
|
+
if ((_a4 = kernel2.terminal) == null ? void 0 : _a4.element) kernel2.terminal.element.style.display = "";
|
|
21394
21394
|
canvas.remove();
|
|
21395
|
-
(_b2 =
|
|
21395
|
+
(_b2 = kernel2.terminal) == null ? void 0 : _b2.focus();
|
|
21396
21396
|
}, 3e3);
|
|
21397
21397
|
}
|
|
21398
21398
|
async function runWebGLTest(context) {
|
|
@@ -21493,7 +21493,7 @@ class Dom {
|
|
|
21493
21493
|
async topbar(show) {
|
|
21494
21494
|
if (!this._topbar) return;
|
|
21495
21495
|
const { default: topbar } = await __vitePreload(async () => {
|
|
21496
|
-
const { default: topbar2 } = await import("./topbar.min-
|
|
21496
|
+
const { default: topbar2 } = await import("./topbar.min-DotodHSt.js").then((n) => n.t);
|
|
21497
21497
|
return { default: topbar2 };
|
|
21498
21498
|
}, true ? [] : void 0);
|
|
21499
21499
|
this._topbarShow = show ?? !this._topbarShow;
|
|
@@ -46169,7 +46169,7 @@ async function createSimpleWebSocket(url) {
|
|
|
46169
46169
|
let WebSocket2;
|
|
46170
46170
|
try {
|
|
46171
46171
|
WebSocket2 = (await __vitePreload(async () => {
|
|
46172
|
-
const { default: __vite_default__ } = await import("./browser-
|
|
46172
|
+
const { default: __vite_default__ } = await import("./browser-C1zKI-gX.js").then((n) => n.b);
|
|
46173
46173
|
return { default: __vite_default__ };
|
|
46174
46174
|
}, true ? [] : void 0)).default;
|
|
46175
46175
|
} catch (error) {
|
|
@@ -62695,7 +62695,7 @@ var TerminalEvents;
|
|
|
62695
62695
|
TerminalEvents2["WRITELN"] = "terminal:writeln";
|
|
62696
62696
|
})(TerminalEvents || (TerminalEvents = {}));
|
|
62697
62697
|
class TerminalCommand {
|
|
62698
|
-
constructor({ command, description, kernel, options, run, shell, terminal, stdin, stdout, stderr }) {
|
|
62698
|
+
constructor({ command, description, kernel: kernel2, options, run, shell, terminal, stdin, stdout, stderr }) {
|
|
62699
62699
|
__publicField(this, "command", "");
|
|
62700
62700
|
__publicField(this, "description", "");
|
|
62701
62701
|
__publicField(this, "kernel");
|
|
@@ -62708,7 +62708,7 @@ class TerminalCommand {
|
|
|
62708
62708
|
__publicField(this, "stderr");
|
|
62709
62709
|
this.command = command;
|
|
62710
62710
|
this.description = description;
|
|
62711
|
-
this.kernel =
|
|
62711
|
+
this.kernel = kernel2;
|
|
62712
62712
|
this.options = options;
|
|
62713
62713
|
this.shell = shell;
|
|
62714
62714
|
this.terminal = terminal;
|
|
@@ -62748,13 +62748,13 @@ class TerminalCommand {
|
|
|
62748
62748
|
}).join(" ")}`;
|
|
62749
62749
|
}
|
|
62750
62750
|
}
|
|
62751
|
-
const TerminalCommands = (
|
|
62752
|
-
const HelpOption = { name: "help", type: Boolean, description:
|
|
62751
|
+
const TerminalCommands = (kernel2, shell, terminal) => {
|
|
62752
|
+
const HelpOption = { name: "help", type: Boolean, description: kernel2.i18n.t("Display help") };
|
|
62753
62753
|
return {
|
|
62754
62754
|
ai: new TerminalCommand({
|
|
62755
62755
|
command: "ai",
|
|
62756
62756
|
description: "Access an AI",
|
|
62757
|
-
kernel,
|
|
62757
|
+
kernel: kernel2,
|
|
62758
62758
|
shell,
|
|
62759
62759
|
terminal,
|
|
62760
62760
|
options: [
|
|
@@ -62762,13 +62762,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62762
62762
|
{ name: "prompt", type: String, defaultOption: true, description: "The prompt to send to the AI" }
|
|
62763
62763
|
],
|
|
62764
62764
|
run: async (argv, process2) => {
|
|
62765
|
-
return await ai({ kernel, shell, terminal, process: process2, args: [argv.prompt] });
|
|
62765
|
+
return await ai({ kernel: kernel2, shell, terminal, process: process2, args: [argv.prompt] });
|
|
62766
62766
|
}
|
|
62767
62767
|
}),
|
|
62768
62768
|
cat: new TerminalCommand({
|
|
62769
62769
|
command: "cat",
|
|
62770
62770
|
description: "Concatenate files and print on the standard output",
|
|
62771
|
-
kernel,
|
|
62771
|
+
kernel: kernel2,
|
|
62772
62772
|
shell,
|
|
62773
62773
|
terminal,
|
|
62774
62774
|
options: [
|
|
@@ -62777,13 +62777,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62777
62777
|
{ name: "bytes", type: Number, description: "The number of bytes to read from the file" }
|
|
62778
62778
|
],
|
|
62779
62779
|
run: async (argv, process2) => {
|
|
62780
|
-
return await cat({ kernel, shell, terminal, process: process2, args: [argv.path, argv.bytes] });
|
|
62780
|
+
return await cat({ kernel: kernel2, shell, terminal, process: process2, args: [argv.path, argv.bytes] });
|
|
62781
62781
|
}
|
|
62782
62782
|
}),
|
|
62783
62783
|
cd: new TerminalCommand({
|
|
62784
62784
|
command: "cd",
|
|
62785
62785
|
description: "Change the shell working directory",
|
|
62786
|
-
kernel,
|
|
62786
|
+
kernel: kernel2,
|
|
62787
62787
|
shell,
|
|
62788
62788
|
terminal,
|
|
62789
62789
|
options: [
|
|
@@ -62791,13 +62791,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62791
62791
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the directory to change to" }
|
|
62792
62792
|
],
|
|
62793
62793
|
run: async (argv) => {
|
|
62794
|
-
return await cd({ kernel, shell, terminal, args: [argv.path || shell.cwd] });
|
|
62794
|
+
return await cd({ kernel: kernel2, shell, terminal, args: [argv.path || shell.cwd] });
|
|
62795
62795
|
}
|
|
62796
62796
|
}),
|
|
62797
62797
|
chmod: new TerminalCommand({
|
|
62798
62798
|
command: "chmod",
|
|
62799
62799
|
description: "Change file mode bits",
|
|
62800
|
-
kernel,
|
|
62800
|
+
kernel: kernel2,
|
|
62801
62801
|
shell,
|
|
62802
62802
|
terminal,
|
|
62803
62803
|
options: [
|
|
@@ -62805,13 +62805,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62805
62805
|
{ name: "args", type: String, multiple: true, defaultOption: true, description: "The mode and path to the file or directory" }
|
|
62806
62806
|
],
|
|
62807
62807
|
run: async (argv) => {
|
|
62808
|
-
return await chmod({ kernel, shell, terminal, args: argv.args });
|
|
62808
|
+
return await chmod({ kernel: kernel2, shell, terminal, args: argv.args });
|
|
62809
62809
|
}
|
|
62810
62810
|
}),
|
|
62811
62811
|
chown: new TerminalCommand({
|
|
62812
62812
|
command: "chown",
|
|
62813
62813
|
description: "Change file ownership",
|
|
62814
|
-
kernel,
|
|
62814
|
+
kernel: kernel2,
|
|
62815
62815
|
shell,
|
|
62816
62816
|
terminal,
|
|
62817
62817
|
options: [
|
|
@@ -62820,24 +62820,24 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62820
62820
|
{ name: "group", type: String, description: "The group to set for the file or directory" }
|
|
62821
62821
|
],
|
|
62822
62822
|
run: async (argv) => {
|
|
62823
|
-
return await chown({ kernel, shell, terminal, args: [argv.args[0], argv.args[1], argv.group] });
|
|
62823
|
+
return await chown({ kernel: kernel2, shell, terminal, args: [argv.args[0], argv.args[1], argv.group] });
|
|
62824
62824
|
}
|
|
62825
62825
|
}),
|
|
62826
62826
|
clear: new TerminalCommand({
|
|
62827
62827
|
command: "clear",
|
|
62828
62828
|
description: "Clear the terminal screen",
|
|
62829
|
-
kernel,
|
|
62829
|
+
kernel: kernel2,
|
|
62830
62830
|
shell,
|
|
62831
62831
|
terminal,
|
|
62832
62832
|
options: [],
|
|
62833
62833
|
run: async () => {
|
|
62834
|
-
return await clear({ kernel, shell, terminal, args: [] });
|
|
62834
|
+
return await clear({ kernel: kernel2, shell, terminal, args: [] });
|
|
62835
62835
|
}
|
|
62836
62836
|
}),
|
|
62837
62837
|
cp: new TerminalCommand({
|
|
62838
62838
|
command: "cp",
|
|
62839
62839
|
description: "Copy files",
|
|
62840
|
-
kernel,
|
|
62840
|
+
kernel: kernel2,
|
|
62841
62841
|
shell,
|
|
62842
62842
|
terminal,
|
|
62843
62843
|
options: [
|
|
@@ -62845,13 +62845,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62845
62845
|
{ name: "args", type: String, multiple: true, defaultOption: true, description: "The source and destination paths" }
|
|
62846
62846
|
],
|
|
62847
62847
|
run: async (argv) => {
|
|
62848
|
-
return await cp({ kernel, shell, terminal, args: argv.args });
|
|
62848
|
+
return await cp({ kernel: kernel2, shell, terminal, args: argv.args });
|
|
62849
62849
|
}
|
|
62850
62850
|
}),
|
|
62851
62851
|
download: new TerminalCommand({
|
|
62852
62852
|
command: "download",
|
|
62853
62853
|
description: "Download a file from the filesystem",
|
|
62854
|
-
kernel,
|
|
62854
|
+
kernel: kernel2,
|
|
62855
62855
|
shell,
|
|
62856
62856
|
terminal,
|
|
62857
62857
|
options: [
|
|
@@ -62859,13 +62859,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62859
62859
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, multiple: true, description: "The path(s) to the file(s) to download" }
|
|
62860
62860
|
],
|
|
62861
62861
|
run: async (argv) => {
|
|
62862
|
-
return await download({ kernel, shell, terminal, args: argv.path });
|
|
62862
|
+
return await download({ kernel: kernel2, shell, terminal, args: argv.path });
|
|
62863
62863
|
}
|
|
62864
62864
|
}),
|
|
62865
62865
|
echo: new TerminalCommand({
|
|
62866
62866
|
command: "echo",
|
|
62867
62867
|
description: "Print arguments to the standard output",
|
|
62868
|
-
kernel,
|
|
62868
|
+
kernel: kernel2,
|
|
62869
62869
|
shell,
|
|
62870
62870
|
terminal,
|
|
62871
62871
|
options: [
|
|
@@ -62873,13 +62873,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62873
62873
|
{ name: "text", type: String, typeLabel: "{underline text}", defaultOption: true, multiple: true, description: "The text to print" }
|
|
62874
62874
|
],
|
|
62875
62875
|
run: async (argv, process2) => {
|
|
62876
|
-
return await echo({ kernel, shell, terminal, process: process2, args: argv.text });
|
|
62876
|
+
return await echo({ kernel: kernel2, shell, terminal, process: process2, args: argv.text });
|
|
62877
62877
|
}
|
|
62878
62878
|
}),
|
|
62879
62879
|
edit: new TerminalCommand({
|
|
62880
62880
|
command: "edit",
|
|
62881
62881
|
description: "Edit a file",
|
|
62882
|
-
kernel,
|
|
62882
|
+
kernel: kernel2,
|
|
62883
62883
|
shell,
|
|
62884
62884
|
terminal,
|
|
62885
62885
|
options: [
|
|
@@ -62887,13 +62887,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62887
62887
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file to edit" }
|
|
62888
62888
|
],
|
|
62889
62889
|
run: async (argv) => {
|
|
62890
|
-
return await edit({ kernel, shell, terminal, args: [argv.path] });
|
|
62890
|
+
return await edit({ kernel: kernel2, shell, terminal, args: [argv.path] });
|
|
62891
62891
|
}
|
|
62892
62892
|
}),
|
|
62893
62893
|
env: new TerminalCommand({
|
|
62894
62894
|
command: "env",
|
|
62895
62895
|
description: "Print or set an environment variable",
|
|
62896
|
-
kernel,
|
|
62896
|
+
kernel: kernel2,
|
|
62897
62897
|
shell,
|
|
62898
62898
|
terminal,
|
|
62899
62899
|
options: [
|
|
@@ -62902,13 +62902,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62902
62902
|
{ name: "set", type: String, description: "Set the environment variable" }
|
|
62903
62903
|
],
|
|
62904
62904
|
run: async (argv) => {
|
|
62905
|
-
return await env({ kernel, shell, terminal, args: [argv.variables, argv.set] });
|
|
62905
|
+
return await env({ kernel: kernel2, shell, terminal, args: [argv.variables, argv.set] });
|
|
62906
62906
|
}
|
|
62907
62907
|
}),
|
|
62908
62908
|
fetch: new TerminalCommand({
|
|
62909
62909
|
command: "fetch",
|
|
62910
62910
|
description: "Fetch a resource from the network",
|
|
62911
|
-
kernel,
|
|
62911
|
+
kernel: kernel2,
|
|
62912
62912
|
shell,
|
|
62913
62913
|
terminal,
|
|
62914
62914
|
options: [
|
|
@@ -62919,13 +62919,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62919
62919
|
{ name: "body", type: String, description: "The body to send with the request" }
|
|
62920
62920
|
],
|
|
62921
62921
|
run: async (argv, process2) => {
|
|
62922
|
-
return await fetch$1({ kernel, shell, terminal, process: process2, args: [argv.url, argv.filename, argv.method, argv.body] });
|
|
62922
|
+
return await fetch$1({ kernel: kernel2, shell, terminal, process: process2, args: [argv.url, argv.filename, argv.method, argv.body] });
|
|
62923
62923
|
}
|
|
62924
62924
|
}),
|
|
62925
62925
|
install: new TerminalCommand({
|
|
62926
62926
|
command: "install",
|
|
62927
62927
|
description: "Install a package",
|
|
62928
|
-
kernel,
|
|
62928
|
+
kernel: kernel2,
|
|
62929
62929
|
shell,
|
|
62930
62930
|
terminal,
|
|
62931
62931
|
options: [
|
|
@@ -62934,13 +62934,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62934
62934
|
{ name: "repo", type: String, description: "The repository to use", defaultValue: "https://unpkg.com" }
|
|
62935
62935
|
],
|
|
62936
62936
|
run: async (argv) => {
|
|
62937
|
-
return await install({ kernel, shell, terminal, args: [argv.url] });
|
|
62937
|
+
return await install({ kernel: kernel2, shell, terminal, args: [argv.url] });
|
|
62938
62938
|
}
|
|
62939
62939
|
}),
|
|
62940
62940
|
ls: new TerminalCommand({
|
|
62941
62941
|
command: "ls",
|
|
62942
62942
|
description: "List directory contents",
|
|
62943
|
-
kernel,
|
|
62943
|
+
kernel: kernel2,
|
|
62944
62944
|
shell,
|
|
62945
62945
|
terminal,
|
|
62946
62946
|
options: [
|
|
@@ -62948,13 +62948,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62948
62948
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the directory to list" }
|
|
62949
62949
|
],
|
|
62950
62950
|
run: async (argv) => {
|
|
62951
|
-
return await ls({ kernel, shell, terminal, args: [argv.path || shell.cwd] });
|
|
62951
|
+
return await ls({ kernel: kernel2, shell, terminal, args: [argv.path || shell.cwd] });
|
|
62952
62952
|
}
|
|
62953
62953
|
}),
|
|
62954
62954
|
mkdir: new TerminalCommand({
|
|
62955
62955
|
command: "mkdir",
|
|
62956
62956
|
description: "Create a directory",
|
|
62957
|
-
kernel,
|
|
62957
|
+
kernel: kernel2,
|
|
62958
62958
|
shell,
|
|
62959
62959
|
terminal,
|
|
62960
62960
|
options: [
|
|
@@ -62962,13 +62962,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62962
62962
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the directory to create" }
|
|
62963
62963
|
],
|
|
62964
62964
|
run: async (argv) => {
|
|
62965
|
-
return await mkdir({ kernel, shell, terminal, args: [argv.path] });
|
|
62965
|
+
return await mkdir({ kernel: kernel2, shell, terminal, args: [argv.path] });
|
|
62966
62966
|
}
|
|
62967
62967
|
}),
|
|
62968
62968
|
mount: new TerminalCommand({
|
|
62969
62969
|
command: "mount",
|
|
62970
62970
|
description: "Mount a filesystem",
|
|
62971
|
-
kernel,
|
|
62971
|
+
kernel: kernel2,
|
|
62972
62972
|
shell,
|
|
62973
62973
|
terminal,
|
|
62974
62974
|
options: [
|
|
@@ -62978,13 +62978,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62978
62978
|
{ name: "options", type: String, description: "The options to pass to the filesystem type", alias: "o" }
|
|
62979
62979
|
],
|
|
62980
62980
|
run: async (argv) => {
|
|
62981
|
-
return await mount({ kernel, shell, terminal, args: [argv.args, argv.type, argv.options] });
|
|
62981
|
+
return await mount({ kernel: kernel2, shell, terminal, args: [argv.args, argv.type, argv.options] });
|
|
62982
62982
|
}
|
|
62983
62983
|
}),
|
|
62984
62984
|
mv: new TerminalCommand({
|
|
62985
62985
|
command: "mv",
|
|
62986
62986
|
description: "Move or rename files",
|
|
62987
|
-
kernel,
|
|
62987
|
+
kernel: kernel2,
|
|
62988
62988
|
shell,
|
|
62989
62989
|
terminal,
|
|
62990
62990
|
options: [
|
|
@@ -62992,24 +62992,24 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
62992
62992
|
{ name: "args", type: String, multiple: true, defaultOption: true, description: "The source and destination paths" }
|
|
62993
62993
|
],
|
|
62994
62994
|
run: async (argv) => {
|
|
62995
|
-
return await mv({ kernel, shell, terminal, args: argv.args });
|
|
62995
|
+
return await mv({ kernel: kernel2, shell, terminal, args: argv.args });
|
|
62996
62996
|
}
|
|
62997
62997
|
}),
|
|
62998
62998
|
observe: new TerminalCommand({
|
|
62999
62999
|
command: "observe",
|
|
63000
63000
|
description: "Observe piped streams",
|
|
63001
|
-
kernel,
|
|
63001
|
+
kernel: kernel2,
|
|
63002
63002
|
shell,
|
|
63003
63003
|
terminal,
|
|
63004
63004
|
options: [HelpOption],
|
|
63005
63005
|
run: async (_, process2) => {
|
|
63006
|
-
return await observe({ kernel, shell, terminal, process: process2, args: [] });
|
|
63006
|
+
return await observe({ kernel: kernel2, shell, terminal, process: process2, args: [] });
|
|
63007
63007
|
}
|
|
63008
63008
|
}),
|
|
63009
63009
|
open: new TerminalCommand({
|
|
63010
63010
|
command: "open",
|
|
63011
63011
|
description: "Open a file or URL",
|
|
63012
|
-
kernel,
|
|
63012
|
+
kernel: kernel2,
|
|
63013
63013
|
shell,
|
|
63014
63014
|
terminal,
|
|
63015
63015
|
options: [
|
|
@@ -63017,13 +63017,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63017
63017
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file or URL to open" }
|
|
63018
63018
|
],
|
|
63019
63019
|
run: async (argv) => {
|
|
63020
|
-
return await open({ kernel, shell, terminal, args: [argv.path] });
|
|
63020
|
+
return await open({ kernel: kernel2, shell, terminal, args: [argv.path] });
|
|
63021
63021
|
}
|
|
63022
63022
|
}),
|
|
63023
63023
|
passwd: new TerminalCommand({
|
|
63024
63024
|
command: "passwd",
|
|
63025
63025
|
description: "Change user password",
|
|
63026
|
-
kernel,
|
|
63026
|
+
kernel: kernel2,
|
|
63027
63027
|
shell,
|
|
63028
63028
|
terminal,
|
|
63029
63029
|
options: [
|
|
@@ -63031,13 +63031,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63031
63031
|
{ name: "password", type: String, multiple: true, defaultOption: true, description: "Old and new passwords (optional - will prompt if not provided)" }
|
|
63032
63032
|
],
|
|
63033
63033
|
run: async (argv) => {
|
|
63034
|
-
return await passwd({ kernel, shell, terminal, args: argv.password });
|
|
63034
|
+
return await passwd({ kernel: kernel2, shell, terminal, args: argv.password });
|
|
63035
63035
|
}
|
|
63036
63036
|
}),
|
|
63037
63037
|
play: new TerminalCommand({
|
|
63038
63038
|
command: "play",
|
|
63039
63039
|
description: "Play a media file",
|
|
63040
|
-
kernel,
|
|
63040
|
+
kernel: kernel2,
|
|
63041
63041
|
shell,
|
|
63042
63042
|
terminal,
|
|
63043
63043
|
options: [
|
|
@@ -63045,46 +63045,46 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63045
63045
|
{ name: "file", type: String, typeLabel: "{underline file}", defaultOption: true, description: "The path to the media file to play" }
|
|
63046
63046
|
],
|
|
63047
63047
|
run: async (argv) => {
|
|
63048
|
-
return await play({ kernel, shell, terminal, args: [argv.file] });
|
|
63048
|
+
return await play({ kernel: kernel2, shell, terminal, args: [argv.file] });
|
|
63049
63049
|
}
|
|
63050
63050
|
}),
|
|
63051
63051
|
ps: new TerminalCommand({
|
|
63052
63052
|
command: "ps",
|
|
63053
63053
|
description: "List all running processes",
|
|
63054
|
-
kernel,
|
|
63054
|
+
kernel: kernel2,
|
|
63055
63055
|
shell,
|
|
63056
63056
|
terminal,
|
|
63057
63057
|
options: [],
|
|
63058
63058
|
run: async () => {
|
|
63059
|
-
return await ps({ kernel, shell, terminal, args: [] });
|
|
63059
|
+
return await ps({ kernel: kernel2, shell, terminal, args: [] });
|
|
63060
63060
|
}
|
|
63061
63061
|
}),
|
|
63062
63062
|
pwd: new TerminalCommand({
|
|
63063
63063
|
command: "pwd",
|
|
63064
63064
|
description: "Print the shell working directory",
|
|
63065
|
-
kernel,
|
|
63065
|
+
kernel: kernel2,
|
|
63066
63066
|
shell,
|
|
63067
63067
|
terminal,
|
|
63068
63068
|
options: [],
|
|
63069
63069
|
run: async () => {
|
|
63070
|
-
return await pwd({ kernel, shell, terminal, args: [] });
|
|
63070
|
+
return await pwd({ kernel: kernel2, shell, terminal, args: [] });
|
|
63071
63071
|
}
|
|
63072
63072
|
}),
|
|
63073
63073
|
reboot: new TerminalCommand({
|
|
63074
63074
|
command: "reboot",
|
|
63075
63075
|
description: "Reboot the system",
|
|
63076
|
-
kernel,
|
|
63076
|
+
kernel: kernel2,
|
|
63077
63077
|
shell,
|
|
63078
63078
|
terminal,
|
|
63079
63079
|
options: [],
|
|
63080
63080
|
run: async () => {
|
|
63081
|
-
return await reboot({ kernel, shell, terminal, args: [] });
|
|
63081
|
+
return await reboot({ kernel: kernel2, shell, terminal, args: [] });
|
|
63082
63082
|
}
|
|
63083
63083
|
}),
|
|
63084
63084
|
rm: new TerminalCommand({
|
|
63085
63085
|
command: "rm",
|
|
63086
63086
|
description: "Remove files or directories",
|
|
63087
|
-
kernel,
|
|
63087
|
+
kernel: kernel2,
|
|
63088
63088
|
shell,
|
|
63089
63089
|
terminal,
|
|
63090
63090
|
options: [
|
|
@@ -63092,13 +63092,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63092
63092
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file or directory to remove" }
|
|
63093
63093
|
],
|
|
63094
63094
|
run: async (argv) => {
|
|
63095
|
-
return await rm({ kernel, shell, terminal, args: [argv.path] });
|
|
63095
|
+
return await rm({ kernel: kernel2, shell, terminal, args: [argv.path] });
|
|
63096
63096
|
}
|
|
63097
63097
|
}),
|
|
63098
63098
|
screensaver: new TerminalCommand({
|
|
63099
63099
|
command: "screensaver",
|
|
63100
63100
|
description: "Start the screensaver",
|
|
63101
|
-
kernel,
|
|
63101
|
+
kernel: kernel2,
|
|
63102
63102
|
shell,
|
|
63103
63103
|
terminal,
|
|
63104
63104
|
options: [
|
|
@@ -63107,24 +63107,24 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63107
63107
|
{ name: "set", type: Boolean, description: "Set the default screensaver" }
|
|
63108
63108
|
],
|
|
63109
63109
|
run: async (argv) => {
|
|
63110
|
-
return await screensaver({ kernel, shell, terminal, args: [argv.screensaver, argv.set] });
|
|
63110
|
+
return await screensaver({ kernel: kernel2, shell, terminal, args: [argv.screensaver, argv.set] });
|
|
63111
63111
|
}
|
|
63112
63112
|
}),
|
|
63113
63113
|
snake: new TerminalCommand({
|
|
63114
63114
|
command: "snake",
|
|
63115
63115
|
description: "Play a simple snake game",
|
|
63116
|
-
kernel,
|
|
63116
|
+
kernel: kernel2,
|
|
63117
63117
|
shell,
|
|
63118
63118
|
terminal,
|
|
63119
63119
|
options: [],
|
|
63120
63120
|
run: async () => {
|
|
63121
|
-
await snake({ kernel, shell, terminal, args: [] });
|
|
63121
|
+
await snake({ kernel: kernel2, shell, terminal, args: [] });
|
|
63122
63122
|
}
|
|
63123
63123
|
}),
|
|
63124
63124
|
socket: new TerminalCommand({
|
|
63125
63125
|
command: "socket",
|
|
63126
63126
|
description: "Send a message to the terminal socket",
|
|
63127
|
-
kernel,
|
|
63127
|
+
kernel: kernel2,
|
|
63128
63128
|
shell,
|
|
63129
63129
|
terminal,
|
|
63130
63130
|
options: [
|
|
@@ -63133,13 +63133,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63133
63133
|
{ name: "args", type: String, multiple: true, description: "The arguments to send to the command" }
|
|
63134
63134
|
],
|
|
63135
63135
|
run: async () => {
|
|
63136
|
-
return await socket();
|
|
63136
|
+
return await socket$1();
|
|
63137
63137
|
}
|
|
63138
63138
|
}),
|
|
63139
63139
|
stat: new TerminalCommand({
|
|
63140
63140
|
command: "stat",
|
|
63141
63141
|
description: "Display information about a file or directory",
|
|
63142
|
-
kernel,
|
|
63142
|
+
kernel: kernel2,
|
|
63143
63143
|
shell,
|
|
63144
63144
|
terminal,
|
|
63145
63145
|
options: [
|
|
@@ -63147,13 +63147,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63147
63147
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file or directory to display" }
|
|
63148
63148
|
],
|
|
63149
63149
|
run: async (argv) => {
|
|
63150
|
-
return await stat({ kernel, shell, terminal, args: [argv.path] });
|
|
63150
|
+
return await stat({ kernel: kernel2, shell, terminal, args: [argv.path] });
|
|
63151
63151
|
}
|
|
63152
63152
|
}),
|
|
63153
63153
|
su: new TerminalCommand({
|
|
63154
63154
|
command: "su",
|
|
63155
63155
|
description: "Switch user",
|
|
63156
|
-
kernel,
|
|
63156
|
+
kernel: kernel2,
|
|
63157
63157
|
shell,
|
|
63158
63158
|
terminal,
|
|
63159
63159
|
options: [
|
|
@@ -63161,13 +63161,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63161
63161
|
{ name: "user", type: String, defaultOption: true, description: "The user to switch to" }
|
|
63162
63162
|
],
|
|
63163
63163
|
run: async (argv) => {
|
|
63164
|
-
return await su({ kernel, shell, terminal, args: [argv.user] });
|
|
63164
|
+
return await su({ kernel: kernel2, shell, terminal, args: [argv.user] });
|
|
63165
63165
|
}
|
|
63166
63166
|
}),
|
|
63167
63167
|
touch: new TerminalCommand({
|
|
63168
63168
|
command: "touch",
|
|
63169
63169
|
description: "Create an empty file",
|
|
63170
|
-
kernel,
|
|
63170
|
+
kernel: kernel2,
|
|
63171
63171
|
shell,
|
|
63172
63172
|
terminal,
|
|
63173
63173
|
options: [
|
|
@@ -63175,13 +63175,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63175
63175
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file to create" }
|
|
63176
63176
|
],
|
|
63177
63177
|
run: async (argv) => {
|
|
63178
|
-
return await touch({ kernel, shell, terminal, args: [argv.path] });
|
|
63178
|
+
return await touch({ kernel: kernel2, shell, terminal, args: [argv.path] });
|
|
63179
63179
|
}
|
|
63180
63180
|
}),
|
|
63181
63181
|
umount: new TerminalCommand({
|
|
63182
63182
|
command: "umount",
|
|
63183
63183
|
description: "Unmount a filesystem",
|
|
63184
|
-
kernel,
|
|
63184
|
+
kernel: kernel2,
|
|
63185
63185
|
shell,
|
|
63186
63186
|
terminal,
|
|
63187
63187
|
options: [
|
|
@@ -63189,13 +63189,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63189
63189
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the directory to unmount" }
|
|
63190
63190
|
],
|
|
63191
63191
|
run: async (argv) => {
|
|
63192
|
-
return await umount({ kernel, shell, terminal, args: [argv.path] });
|
|
63192
|
+
return await umount({ kernel: kernel2, shell, terminal, args: [argv.path] });
|
|
63193
63193
|
}
|
|
63194
63194
|
}),
|
|
63195
63195
|
user: new TerminalCommand({
|
|
63196
63196
|
command: "user",
|
|
63197
63197
|
description: "Manage users",
|
|
63198
|
-
kernel,
|
|
63198
|
+
kernel: kernel2,
|
|
63199
63199
|
shell,
|
|
63200
63200
|
terminal,
|
|
63201
63201
|
options: [
|
|
@@ -63222,13 +63222,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63222
63222
|
}
|
|
63223
63223
|
],
|
|
63224
63224
|
run: async (argv) => {
|
|
63225
|
-
return await user({ kernel, shell, terminal, args: [argv.command, argv.username, argv.password] });
|
|
63225
|
+
return await user({ kernel: kernel2, shell, terminal, args: [argv.command, argv.username, argv.password] });
|
|
63226
63226
|
}
|
|
63227
63227
|
}),
|
|
63228
63228
|
unzip: new TerminalCommand({
|
|
63229
63229
|
command: "unzip",
|
|
63230
63230
|
description: "Unzip a file",
|
|
63231
|
-
kernel,
|
|
63231
|
+
kernel: kernel2,
|
|
63232
63232
|
shell,
|
|
63233
63233
|
terminal,
|
|
63234
63234
|
options: [
|
|
@@ -63236,13 +63236,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63236
63236
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file to unzip" }
|
|
63237
63237
|
],
|
|
63238
63238
|
run: async (argv) => {
|
|
63239
|
-
return await unzip({ kernel, shell, terminal, args: [argv.path] });
|
|
63239
|
+
return await unzip({ kernel: kernel2, shell, terminal, args: [argv.path] });
|
|
63240
63240
|
}
|
|
63241
63241
|
}),
|
|
63242
63242
|
upload: new TerminalCommand({
|
|
63243
63243
|
command: "upload",
|
|
63244
63244
|
description: "Upload a file to the filesystem",
|
|
63245
|
-
kernel,
|
|
63245
|
+
kernel: kernel2,
|
|
63246
63246
|
shell,
|
|
63247
63247
|
terminal,
|
|
63248
63248
|
options: [
|
|
@@ -63250,13 +63250,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63250
63250
|
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to store the file" }
|
|
63251
63251
|
],
|
|
63252
63252
|
run: async (argv) => {
|
|
63253
|
-
return await upload({ kernel, shell, terminal, args: [argv.path] });
|
|
63253
|
+
return await upload({ kernel: kernel2, shell, terminal, args: [argv.path] });
|
|
63254
63254
|
}
|
|
63255
63255
|
}),
|
|
63256
63256
|
video: new TerminalCommand({
|
|
63257
63257
|
command: "video",
|
|
63258
63258
|
description: "Play a video file",
|
|
63259
|
-
kernel,
|
|
63259
|
+
kernel: kernel2,
|
|
63260
63260
|
shell,
|
|
63261
63261
|
terminal,
|
|
63262
63262
|
options: [
|
|
@@ -63264,13 +63264,13 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63264
63264
|
{ name: "file", type: String, typeLabel: "{underline file}", defaultOption: true, description: "The path to the video file to play" }
|
|
63265
63265
|
],
|
|
63266
63266
|
run: async (argv) => {
|
|
63267
|
-
return await video({ kernel, shell, terminal, args: [argv.file] });
|
|
63267
|
+
return await video({ kernel: kernel2, shell, terminal, args: [argv.file] });
|
|
63268
63268
|
}
|
|
63269
63269
|
}),
|
|
63270
63270
|
zip: new TerminalCommand({
|
|
63271
63271
|
command: "zip",
|
|
63272
63272
|
description: "Zip a directory",
|
|
63273
|
-
kernel,
|
|
63273
|
+
kernel: kernel2,
|
|
63274
63274
|
shell,
|
|
63275
63275
|
terminal,
|
|
63276
63276
|
options: [
|
|
@@ -63279,7 +63279,7 @@ const TerminalCommands = (kernel, shell, terminal) => {
|
|
|
63279
63279
|
{ name: "path", type: String, typeLabel: "{underline path}", multiple: true, description: "The paths to the files or directories to zip" }
|
|
63280
63280
|
],
|
|
63281
63281
|
run: async (argv) => {
|
|
63282
|
-
return await zip({ kernel, shell, terminal, args: [argv.output, argv.path] });
|
|
63282
|
+
return await zip({ kernel: kernel2, shell, terminal, args: [argv.output, argv.path] });
|
|
63283
63283
|
}
|
|
63284
63284
|
})
|
|
63285
63285
|
};
|
|
@@ -63301,7 +63301,7 @@ const ai = async ({ process: process2, args }) => {
|
|
|
63301
63301
|
writer == null ? void 0 : writer.releaseLock();
|
|
63302
63302
|
return 0;
|
|
63303
63303
|
};
|
|
63304
|
-
const cat = async ({ kernel, shell, process: process2, args }) => {
|
|
63304
|
+
const cat = async ({ kernel: kernel2, shell, process: process2, args }) => {
|
|
63305
63305
|
if (!process2) return 1;
|
|
63306
63306
|
const writer = process2.stdout.getWriter();
|
|
63307
63307
|
try {
|
|
@@ -63325,23 +63325,23 @@ const cat = async ({ kernel, shell, process: process2, args }) => {
|
|
|
63325
63325
|
const interruptHandler = () => {
|
|
63326
63326
|
interrupted = true;
|
|
63327
63327
|
};
|
|
63328
|
-
|
|
63328
|
+
kernel2.terminal.events.on(TerminalEvents.INTERRUPT, interruptHandler);
|
|
63329
63329
|
try {
|
|
63330
63330
|
if (!fullPath.startsWith("/dev")) {
|
|
63331
|
-
const handle = await
|
|
63332
|
-
const stat2 = await
|
|
63331
|
+
const handle = await kernel2.filesystem.fs.open(fullPath);
|
|
63332
|
+
const stat2 = await kernel2.filesystem.fs.stat(fullPath);
|
|
63333
63333
|
let bytesRead = 0;
|
|
63334
63334
|
const chunkSize = 1024;
|
|
63335
63335
|
while (bytesRead < stat2.size) {
|
|
63336
63336
|
if (interrupted) break;
|
|
63337
63337
|
const data = new Uint8Array(chunkSize);
|
|
63338
63338
|
const readSize = Math.min(chunkSize, stat2.size - bytesRead);
|
|
63339
|
-
await
|
|
63339
|
+
await kernel2.filesystem.fsSync.read(handle.fd, data, 0, readSize, bytesRead);
|
|
63340
63340
|
await writer.write(data.subarray(0, readSize));
|
|
63341
63341
|
bytesRead += readSize;
|
|
63342
63342
|
}
|
|
63343
63343
|
} else {
|
|
63344
|
-
const device = await
|
|
63344
|
+
const device = await kernel2.filesystem.fs.open(fullPath);
|
|
63345
63345
|
const maxBytes = bytes ? parseInt(bytes) : void 0;
|
|
63346
63346
|
let totalBytesRead = 0;
|
|
63347
63347
|
const chunkSize = 1024;
|
|
@@ -63361,7 +63361,7 @@ const cat = async ({ kernel, shell, process: process2, args }) => {
|
|
|
63361
63361
|
} while (bytesRead > 0 && (!maxBytes || totalBytesRead < maxBytes));
|
|
63362
63362
|
}
|
|
63363
63363
|
} finally {
|
|
63364
|
-
|
|
63364
|
+
kernel2.terminal.events.off(TerminalEvents.INTERRUPT, interruptHandler);
|
|
63365
63365
|
}
|
|
63366
63366
|
}
|
|
63367
63367
|
return 0;
|
|
@@ -63369,13 +63369,13 @@ const cat = async ({ kernel, shell, process: process2, args }) => {
|
|
|
63369
63369
|
writer.releaseLock();
|
|
63370
63370
|
}
|
|
63371
63371
|
};
|
|
63372
|
-
const cd = async ({ kernel, shell, terminal, args }) => {
|
|
63372
|
+
const cd = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
63373
63373
|
const destination = args[0];
|
|
63374
63374
|
const fullPath = destination ? path.resolve(shell.cwd, destination) : shell.cwd;
|
|
63375
|
-
if (await
|
|
63375
|
+
if (await kernel2.filesystem.fs.exists(fullPath)) shell.cwd = fullPath;
|
|
63376
63376
|
else terminal.writeln(chalk$1.red(`${fullPath} not found`));
|
|
63377
63377
|
};
|
|
63378
|
-
const chmod = async ({ kernel, shell, terminal, args }) => {
|
|
63378
|
+
const chmod = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
63379
63379
|
if (!args || args.length === 0) {
|
|
63380
63380
|
terminal.writeln(chalk$1.red("chmod: missing operand"));
|
|
63381
63381
|
terminal.writeln("Try 'chmod --help' for more information.");
|
|
@@ -63384,30 +63384,30 @@ const chmod = async ({ kernel, shell, terminal, args }) => {
|
|
|
63384
63384
|
const [mode2, target] = args;
|
|
63385
63385
|
if (!mode2 || !target) return 1;
|
|
63386
63386
|
const fullPath = path.resolve(shell.cwd, target);
|
|
63387
|
-
await
|
|
63387
|
+
await kernel2.filesystem.fs.chmod(fullPath, mode2);
|
|
63388
63388
|
return 0;
|
|
63389
63389
|
};
|
|
63390
|
-
const chown = async ({ kernel, shell, args }) => {
|
|
63390
|
+
const chown = async ({ kernel: kernel2, shell, args }) => {
|
|
63391
63391
|
const [user2, target, group] = args;
|
|
63392
63392
|
if (!user2 || !target) return 1;
|
|
63393
63393
|
const fullPath = path.resolve(shell.cwd, target);
|
|
63394
|
-
|
|
63394
|
+
kernel2.filesystem.fsSync.chownSync(fullPath, parseInt(user2), parseInt(group ?? user2));
|
|
63395
63395
|
};
|
|
63396
63396
|
const clear = async ({ terminal }) => {
|
|
63397
63397
|
terminal.write("\x1B[2J\x1B[H");
|
|
63398
63398
|
};
|
|
63399
|
-
const cp = async ({ kernel, shell, args }) => {
|
|
63399
|
+
const cp = async ({ kernel: kernel2, shell, args }) => {
|
|
63400
63400
|
const [source2, destination] = args.map((arg) => path.resolve(shell.cwd, arg));
|
|
63401
63401
|
if (!source2 || !destination) return 1;
|
|
63402
|
-
const destinationStats = await
|
|
63402
|
+
const destinationStats = await kernel2.filesystem.fs.stat(destination).catch(() => null);
|
|
63403
63403
|
const finalDestination = (destinationStats == null ? void 0 : destinationStats.isDirectory()) ? path.join(destination, path.basename(source2)) : destination;
|
|
63404
|
-
await
|
|
63404
|
+
await kernel2.filesystem.fs.copyFile(source2, finalDestination);
|
|
63405
63405
|
};
|
|
63406
|
-
const download = async ({ kernel, shell, terminal, args }) => {
|
|
63406
|
+
const download = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
63407
63407
|
const destination = args[0];
|
|
63408
63408
|
const fullPath = destination ? path.resolve(shell.cwd, destination) : shell.cwd;
|
|
63409
|
-
if (await
|
|
63410
|
-
const data = await
|
|
63409
|
+
if (await kernel2.filesystem.fs.exists(fullPath)) {
|
|
63410
|
+
const data = await kernel2.filesystem.fs.readFile(fullPath);
|
|
63411
63411
|
const blob = new Blob([data], { type: "application/octet-stream" });
|
|
63412
63412
|
const url = window.URL.createObjectURL(blob);
|
|
63413
63413
|
const a = document.createElement("a");
|
|
@@ -63436,11 +63436,11 @@ const echo = async ({ process: process2, terminal, args }) => {
|
|
|
63436
63436
|
}
|
|
63437
63437
|
return 0;
|
|
63438
63438
|
};
|
|
63439
|
-
const edit = async ({ kernel, shell, terminal, args }) => {
|
|
63439
|
+
const edit = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
63440
63440
|
const target = args[0];
|
|
63441
63441
|
if (!target) return 1;
|
|
63442
63442
|
const fullPath = path.resolve(shell.cwd, target);
|
|
63443
|
-
const content = await
|
|
63443
|
+
const content = await kernel2.filesystem.fs.readFile(fullPath, "utf-8").catch(() => "");
|
|
63444
63444
|
const lines = content.split("\n");
|
|
63445
63445
|
let cursorX = 0;
|
|
63446
63446
|
let cursorY = 0;
|
|
@@ -63548,7 +63548,7 @@ const edit = async ({ kernel, shell, terminal, args }) => {
|
|
|
63548
63548
|
switch (command) {
|
|
63549
63549
|
case "w":
|
|
63550
63550
|
message = chalk$1.green(`Saved to ${fullPath}`);
|
|
63551
|
-
await
|
|
63551
|
+
await kernel2.filesystem.fs.writeFile(fullPath, lines.join("\n"));
|
|
63552
63552
|
break;
|
|
63553
63553
|
case "q":
|
|
63554
63554
|
return true;
|
|
@@ -63717,7 +63717,7 @@ const env = async ({ shell, terminal, args }) => {
|
|
|
63717
63717
|
}
|
|
63718
63718
|
}
|
|
63719
63719
|
};
|
|
63720
|
-
const fetch$1 = async ({ kernel, shell, terminal, process: process2, args }) => {
|
|
63720
|
+
const fetch$1 = async ({ kernel: kernel2, shell, terminal, process: process2, args }) => {
|
|
63721
63721
|
var _a3, _b2;
|
|
63722
63722
|
const [url, filename, method, body2] = args;
|
|
63723
63723
|
if (!url) {
|
|
@@ -63733,14 +63733,14 @@ const fetch$1 = async ({ kernel, shell, terminal, process: process2, args }) =>
|
|
|
63733
63733
|
if (!reader) throw new Error("No response body");
|
|
63734
63734
|
let writer;
|
|
63735
63735
|
if (filename) {
|
|
63736
|
-
const fullPath = path.resolve(
|
|
63737
|
-
const fileHandle = await
|
|
63736
|
+
const fullPath = path.resolve(kernel2.shell.cwd, filename);
|
|
63737
|
+
const fileHandle = await kernel2.filesystem.fs.open(fullPath, "w");
|
|
63738
63738
|
writer = {
|
|
63739
63739
|
write: (chunk) => {
|
|
63740
|
-
|
|
63740
|
+
kernel2.filesystem.fsSync.write(fileHandle.fd, chunk);
|
|
63741
63741
|
},
|
|
63742
63742
|
releaseLock: async () => {
|
|
63743
|
-
await
|
|
63743
|
+
await kernel2.filesystem.fsSync.close(fileHandle.fd);
|
|
63744
63744
|
}
|
|
63745
63745
|
};
|
|
63746
63746
|
} else writer = (_b2 = process2 == null ? void 0 : process2.stdout) == null ? void 0 : _b2.getWriter();
|
|
@@ -63761,7 +63761,7 @@ const fetch$1 = async ({ kernel, shell, terminal, process: process2, args }) =>
|
|
|
63761
63761
|
return 1;
|
|
63762
63762
|
}
|
|
63763
63763
|
};
|
|
63764
|
-
const install = async ({ kernel, terminal, args }) => {
|
|
63764
|
+
const install = async ({ kernel: kernel2, terminal, args }) => {
|
|
63765
63765
|
const [packageArg, repoArg] = args;
|
|
63766
63766
|
if (!packageArg) {
|
|
63767
63767
|
terminal.writeln(chalk$1.red("Usage: install <package-name>[@version]"));
|
|
@@ -63803,11 +63803,11 @@ const install = async ({ kernel, terminal, args }) => {
|
|
|
63803
63803
|
if (!dir) continue;
|
|
63804
63804
|
currentPath += "/" + dir;
|
|
63805
63805
|
try {
|
|
63806
|
-
await
|
|
63806
|
+
await kernel2.filesystem.fs.mkdir(currentPath, 493);
|
|
63807
63807
|
} catch {
|
|
63808
63808
|
}
|
|
63809
63809
|
}
|
|
63810
|
-
await
|
|
63810
|
+
await kernel2.filesystem.fs.writeFile(`${packagePath}/package.json`, JSON.stringify(data, null, 2), { mode: 493 });
|
|
63811
63811
|
terminal.writeln(chalk$1.green(`Downloaded package.json to ${packagePath}/package.json`));
|
|
63812
63812
|
const processedFiles = /* @__PURE__ */ new Set();
|
|
63813
63813
|
for (const file of files) {
|
|
@@ -63827,7 +63827,7 @@ const install = async ({ kernel, terminal, args }) => {
|
|
|
63827
63827
|
if (!part) continue;
|
|
63828
63828
|
dirPath += "/" + part;
|
|
63829
63829
|
try {
|
|
63830
|
-
await
|
|
63830
|
+
await kernel2.filesystem.fs.mkdir(dirPath, 493);
|
|
63831
63831
|
} catch {
|
|
63832
63832
|
}
|
|
63833
63833
|
}
|
|
@@ -63841,7 +63841,7 @@ const install = async ({ kernel, terminal, args }) => {
|
|
|
63841
63841
|
continue;
|
|
63842
63842
|
}
|
|
63843
63843
|
const fileData = await fileResponse.text();
|
|
63844
|
-
await
|
|
63844
|
+
await kernel2.filesystem.fs.writeFile(filePath, fileData, { mode: 493 });
|
|
63845
63845
|
} catch (error) {
|
|
63846
63846
|
terminal.writeln(chalk$1.red(`Failed to download ${targetFile}: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
63847
63847
|
}
|
|
@@ -63853,24 +63853,24 @@ const install = async ({ kernel, terminal, args }) => {
|
|
|
63853
63853
|
try {
|
|
63854
63854
|
let packages = [];
|
|
63855
63855
|
try {
|
|
63856
|
-
const packagesData = await
|
|
63856
|
+
const packagesData = await kernel2.filesystem.fs.readFile("/etc/packages", "utf-8");
|
|
63857
63857
|
if (packagesData) packages = JSON.parse(packagesData);
|
|
63858
63858
|
} catch {
|
|
63859
63859
|
}
|
|
63860
63860
|
packages.push(packageEntry);
|
|
63861
|
-
await
|
|
63861
|
+
await kernel2.filesystem.fs.writeFile("/etc/packages", JSON.stringify(packages, null, 2));
|
|
63862
63862
|
terminal.writeln(chalk$1.green(`Added ${packageName}@${data.version} to /etc/packages`));
|
|
63863
63863
|
} catch (error) {
|
|
63864
63864
|
terminal.writeln(chalk$1.red(`Failed to update /etc/packages: ${error}`));
|
|
63865
63865
|
}
|
|
63866
63866
|
};
|
|
63867
|
-
const ls = async ({ kernel, shell, terminal, args }) => {
|
|
63867
|
+
const ls = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
63868
63868
|
var _a3;
|
|
63869
63869
|
const target = args[0];
|
|
63870
63870
|
const fullPath = target ? path.resolve(shell.cwd, target === "" ? "." : target) : shell.cwd;
|
|
63871
|
-
const stats2 = await
|
|
63872
|
-
const entries = stats2.isDirectory() ? await
|
|
63873
|
-
const descriptions =
|
|
63871
|
+
const stats2 = await kernel2.filesystem.fs.stat(fullPath);
|
|
63872
|
+
const entries = stats2.isDirectory() ? await kernel2.filesystem.fs.readdir(fullPath) : [fullPath];
|
|
63873
|
+
const descriptions = kernel2.filesystem.descriptions(kernel2.i18n.t);
|
|
63874
63874
|
const getModeType = (stats22) => {
|
|
63875
63875
|
let type = "-";
|
|
63876
63876
|
if (stats22.isDirectory()) type = "d";
|
|
@@ -63893,19 +63893,19 @@ const ls = async ({ kernel, shell, terminal, args }) => {
|
|
|
63893
63893
|
else return chalk$1.gray(timestamp.toISOString().slice(0, 19).replace("T", " "));
|
|
63894
63894
|
};
|
|
63895
63895
|
const getOwnerString = (stats22) => {
|
|
63896
|
-
const owner =
|
|
63896
|
+
const owner = kernel2.users.all.get(stats22.uid) || kernel2.users.all.get(0);
|
|
63897
63897
|
if ((owner == null ? void 0 : owner.username) === shell.username) return chalk$1.green(`${(owner == null ? void 0 : owner.username) || stats22.uid}:${(owner == null ? void 0 : owner.username) || stats22.gid}`);
|
|
63898
63898
|
else if (stats22.uid === 0) return chalk$1.red(`${(owner == null ? void 0 : owner.username) || stats22.uid}:${(owner == null ? void 0 : owner.username) || stats22.gid}`);
|
|
63899
63899
|
else return chalk$1.gray(`${(owner == null ? void 0 : owner.username) || stats22.uid}:${(owner == null ? void 0 : owner.username) || stats22.gid}`);
|
|
63900
63900
|
};
|
|
63901
|
-
const mounts2 = Array.from(
|
|
63901
|
+
const mounts2 = Array.from(kernel2.filesystem.fsSync.mounts.entries()).filter(([target2]) => path.dirname(target2) === fullPath && target2 !== "/");
|
|
63902
63902
|
const files = entries.map((entry) => {
|
|
63903
63903
|
var _a4;
|
|
63904
63904
|
const target2 = path.resolve(fullPath, entry);
|
|
63905
63905
|
try {
|
|
63906
|
-
return { target: target2, name: entry, stats:
|
|
63906
|
+
return { target: target2, name: entry, stats: kernel2.filesystem.fsSync.statSync(target2) };
|
|
63907
63907
|
} catch (err2) {
|
|
63908
|
-
(_a4 =
|
|
63908
|
+
(_a4 = kernel2.log) == null ? void 0 : _a4.warn(err2);
|
|
63909
63909
|
return null;
|
|
63910
63910
|
}
|
|
63911
63911
|
}).filter((entry) => entry !== null && entry !== void 0).filter((entry) => !entry.stats.isDirectory());
|
|
@@ -63913,9 +63913,9 @@ const ls = async ({ kernel, shell, terminal, args }) => {
|
|
|
63913
63913
|
var _a4;
|
|
63914
63914
|
const target2 = path.resolve(fullPath, entry);
|
|
63915
63915
|
try {
|
|
63916
|
-
return { target: target2, name: entry, stats:
|
|
63916
|
+
return { target: target2, name: entry, stats: kernel2.filesystem.fsSync.statSync(target2) };
|
|
63917
63917
|
} catch (err2) {
|
|
63918
|
-
(_a4 =
|
|
63918
|
+
(_a4 = kernel2.log) == null ? void 0 : _a4.warn(err2);
|
|
63919
63919
|
return null;
|
|
63920
63920
|
}
|
|
63921
63921
|
}).filter((entry) => entry && entry.stats.isDirectory()).concat(mounts2.map(([target2]) => ({
|
|
@@ -63953,8 +63953,8 @@ const ls = async ({ kernel, shell, terminal, args }) => {
|
|
|
63953
63953
|
const ext = file.name.split(".").pop();
|
|
63954
63954
|
if (ext && descriptions.has("." + ext)) return descriptions.get("." + ext);
|
|
63955
63955
|
if (file.stats.isBlockDevice() || file.stats.isCharacterDevice()) {
|
|
63956
|
-
const device =
|
|
63957
|
-
const kdevice =
|
|
63956
|
+
const device = kernel2.filesystem.devfs.devices.get(`/${file.name}`);
|
|
63957
|
+
const kdevice = kernel2.devices.get(file.name);
|
|
63958
63958
|
const description = ((_a4 = kdevice == null ? void 0 : kdevice.device.pkg) == null ? void 0 : _a4.description) || "";
|
|
63959
63959
|
const version2 = ((_b2 = kdevice == null ? void 0 : kdevice.device.pkg) == null ? void 0 : _b2.version) || "";
|
|
63960
63960
|
if (device) return `${description ? `${description}:` : ""}${version2 ? `v${version2}:` : ""}M${device.major ?? "?"},m${device.minor ?? "?"}`;
|
|
@@ -63981,11 +63981,11 @@ const ls = async ({ kernel, shell, terminal, args }) => {
|
|
|
63981
63981
|
if (data.length > 1) terminal.writeln(line3);
|
|
63982
63982
|
}
|
|
63983
63983
|
};
|
|
63984
|
-
const mount = async ({ kernel, shell, terminal, args }) => {
|
|
63984
|
+
const mount = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
63985
63985
|
const [points, type, config2] = args;
|
|
63986
63986
|
if (!points || !type || points.length !== 2) {
|
|
63987
63987
|
terminal.writeln(chalk$1.red("Usage: mount -t <type> <source> <target>"));
|
|
63988
|
-
const currentMounts = Array.from(
|
|
63988
|
+
const currentMounts = Array.from(kernel2.filesystem.fsSync.mounts.entries()).map(([target2, mount2]) => {
|
|
63989
63989
|
var _a3;
|
|
63990
63990
|
return `${chalk$1.blue(target2)} (${((_a3 = mount2.store) == null ? void 0 : _a3.constructor.name) || mount2.constructor.name}/${mount2.metadata().name})`;
|
|
63991
63991
|
});
|
|
@@ -64010,26 +64010,26 @@ const mount = async ({ kernel, shell, terminal, args }) => {
|
|
|
64010
64010
|
const fullTargetPath = path.resolve(shell.cwd, target);
|
|
64011
64011
|
switch (type.toLowerCase()) {
|
|
64012
64012
|
case "fetch":
|
|
64013
|
-
|
|
64013
|
+
kernel2.filesystem.fsSync.mount(fullTargetPath, await resolveMountConfig({ backend: Fetch, index: fullSourcePath, baseUrl: options == null ? void 0 : options.baseUrl }));
|
|
64014
64014
|
break;
|
|
64015
64015
|
case "indexeddb":
|
|
64016
|
-
|
|
64016
|
+
kernel2.filesystem.fsSync.mount(fullTargetPath, await resolveMountConfig({ backend: IndexedDB, storeName: fullSourcePath }));
|
|
64017
64017
|
break;
|
|
64018
64018
|
case "memory":
|
|
64019
|
-
|
|
64019
|
+
kernel2.filesystem.fsSync.mount(fullTargetPath, await resolveMountConfig({ backend: InMemory, name: fullSourcePath }));
|
|
64020
64020
|
break;
|
|
64021
64021
|
case "zip":
|
|
64022
|
-
|
|
64022
|
+
kernel2.filesystem.fsSync.mount(fullTargetPath, await resolveMountConfig({ backend: Zip, name: fullSourcePath, data: new Uint8Array(await kernel2.filesystem.fs.readFile(fullSourcePath)).buffer }));
|
|
64023
64023
|
break;
|
|
64024
64024
|
}
|
|
64025
64025
|
return 0;
|
|
64026
64026
|
};
|
|
64027
|
-
const mkdir = async ({ kernel, shell, args }) => {
|
|
64027
|
+
const mkdir = async ({ kernel: kernel2, shell, args }) => {
|
|
64028
64028
|
const target = args[0];
|
|
64029
64029
|
const fullPath = target ? path.resolve(shell.cwd, target) : shell.cwd;
|
|
64030
|
-
await
|
|
64030
|
+
await kernel2.filesystem.fs.mkdir(fullPath);
|
|
64031
64031
|
};
|
|
64032
|
-
const mv = async ({ kernel, shell, terminal, args }) => {
|
|
64032
|
+
const mv = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
64033
64033
|
const [sourceInput, destinationInput] = args;
|
|
64034
64034
|
if (!sourceInput || !destinationInput) {
|
|
64035
64035
|
terminal.writeln(chalk$1.red("Usage: mv <source> <destination>"));
|
|
@@ -64043,15 +64043,15 @@ const mv = async ({ kernel, shell, terminal, args }) => {
|
|
|
64043
64043
|
terminal.writeln(chalk$1.red("Cannot move disallowed paths"));
|
|
64044
64044
|
return 2;
|
|
64045
64045
|
}
|
|
64046
|
-
if (await
|
|
64047
|
-
if ((await
|
|
64046
|
+
if (await kernel2.filesystem.fs.exists(destination)) {
|
|
64047
|
+
if ((await kernel2.filesystem.fs.stat(destination)).isDirectory()) {
|
|
64048
64048
|
destination = path.resolve(destination, path.basename(source2));
|
|
64049
64049
|
} else {
|
|
64050
64050
|
terminal.writeln(chalk$1.red(`${destination} already exists`));
|
|
64051
64051
|
return 1;
|
|
64052
64052
|
}
|
|
64053
64053
|
}
|
|
64054
|
-
await
|
|
64054
|
+
await kernel2.filesystem.fs.rename(source2, destination);
|
|
64055
64055
|
return 0;
|
|
64056
64056
|
};
|
|
64057
64057
|
const observe = async ({ process: process2, terminal }) => {
|
|
@@ -64092,7 +64092,7 @@ const open = async ({ terminal, args }) => {
|
|
|
64092
64092
|
terminal.writeln(chalk$1.red("Unsupported path"));
|
|
64093
64093
|
}
|
|
64094
64094
|
};
|
|
64095
|
-
const passwd = async ({ kernel, terminal, args }) => {
|
|
64095
|
+
const passwd = async ({ kernel: kernel2, terminal, args }) => {
|
|
64096
64096
|
let oldPass, newPass;
|
|
64097
64097
|
if (!args || !Array.isArray(args) || args.length < 2) {
|
|
64098
64098
|
oldPass = await terminal.readline(chalk$1.cyan("Enter current password: "), true);
|
|
@@ -64115,7 +64115,7 @@ const passwd = async ({ kernel, terminal, args }) => {
|
|
|
64115
64115
|
}
|
|
64116
64116
|
try {
|
|
64117
64117
|
if (!oldPass || !newPass) throw new Error("Missing password");
|
|
64118
|
-
await
|
|
64118
|
+
await kernel2.users.password(oldPass, newPass);
|
|
64119
64119
|
terminal.writeln(chalk$1.green("Password updated successfully"));
|
|
64120
64120
|
return 0;
|
|
64121
64121
|
} catch (error) {
|
|
@@ -64123,55 +64123,55 @@ const passwd = async ({ kernel, terminal, args }) => {
|
|
|
64123
64123
|
return 1;
|
|
64124
64124
|
}
|
|
64125
64125
|
};
|
|
64126
|
-
const play = async ({ kernel, shell, terminal, args }) => {
|
|
64126
|
+
const play = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
64127
64127
|
const [file] = args;
|
|
64128
64128
|
if (!file || file === "") {
|
|
64129
64129
|
terminal.writeln(chalk$1.red("Usage: play <file>"));
|
|
64130
64130
|
return 1;
|
|
64131
64131
|
}
|
|
64132
64132
|
const fullPath = path.resolve(shell.cwd, file);
|
|
64133
|
-
const blob = new Blob([await
|
|
64133
|
+
const blob = new Blob([await kernel2.filesystem.fs.readFile(fullPath)]);
|
|
64134
64134
|
const url = URL.createObjectURL(blob);
|
|
64135
64135
|
const audio = new Audio(url);
|
|
64136
64136
|
audio.play();
|
|
64137
64137
|
};
|
|
64138
|
-
const ps = async ({ kernel, terminal }) => {
|
|
64138
|
+
const ps = async ({ kernel: kernel2, terminal }) => {
|
|
64139
64139
|
terminal.writeln("PID COMMAND STATUS");
|
|
64140
|
-
for (const [pid, process2] of
|
|
64140
|
+
for (const [pid, process2] of kernel2.processes.all.entries()) {
|
|
64141
64141
|
terminal.writeln(`${chalk$1.yellow(pid)} ${chalk$1.green(process2.command)} ${chalk$1.blue(process2.status)}`);
|
|
64142
64142
|
}
|
|
64143
64143
|
};
|
|
64144
64144
|
const pwd = async ({ shell, terminal }) => {
|
|
64145
64145
|
terminal.writeln(shell.cwd);
|
|
64146
64146
|
};
|
|
64147
|
-
const reboot = async ({ kernel }) => {
|
|
64148
|
-
|
|
64147
|
+
const reboot = async ({ kernel: kernel2 }) => {
|
|
64148
|
+
kernel2.reboot();
|
|
64149
64149
|
};
|
|
64150
|
-
const rm = async ({ kernel, shell, args }) => {
|
|
64150
|
+
const rm = async ({ kernel: kernel2, shell, args }) => {
|
|
64151
64151
|
const target = args[0];
|
|
64152
64152
|
const fullPath = target ? path.resolve(shell.cwd, target) : shell.cwd;
|
|
64153
|
-
if ((await
|
|
64154
|
-
else await
|
|
64153
|
+
if ((await kernel2.filesystem.fs.stat(fullPath)).isDirectory()) await kernel2.filesystem.fs.rmdir(fullPath);
|
|
64154
|
+
else await kernel2.filesystem.fs.unlink(fullPath);
|
|
64155
64155
|
return 0;
|
|
64156
64156
|
};
|
|
64157
|
-
const screensaver = async ({ kernel, terminal, args }) => {
|
|
64157
|
+
const screensaver = async ({ kernel: kernel2, terminal, args }) => {
|
|
64158
64158
|
const [screensaver2, set] = args;
|
|
64159
64159
|
if (screensaver2 === "off") {
|
|
64160
|
-
|
|
64160
|
+
kernel2.storage.local.removeItem("screensaver");
|
|
64161
64161
|
return 0;
|
|
64162
64162
|
}
|
|
64163
64163
|
let saverName = screensaver2;
|
|
64164
|
-
if (!saverName) saverName =
|
|
64165
|
-
const saver =
|
|
64164
|
+
if (!saverName) saverName = kernel2.storage.local.getItem("screensaver") || "matrix";
|
|
64165
|
+
const saver = kernel2.screensavers.get(saverName);
|
|
64166
64166
|
if (!saver) {
|
|
64167
64167
|
terminal.writeln(chalk$1.red("Invalid screensaver"));
|
|
64168
64168
|
return 1;
|
|
64169
64169
|
}
|
|
64170
64170
|
terminal.blur();
|
|
64171
64171
|
saver.default({ terminal });
|
|
64172
|
-
if (set)
|
|
64172
|
+
if (set) kernel2.storage.local.setItem("screensaver", saverName);
|
|
64173
64173
|
};
|
|
64174
|
-
const snake = ({ kernel, terminal }) => {
|
|
64174
|
+
const snake = ({ kernel: kernel2, terminal }) => {
|
|
64175
64175
|
const width = 20;
|
|
64176
64176
|
const height = 10;
|
|
64177
64177
|
const snake2 = [{ x: 10, y: 5 }];
|
|
@@ -64188,7 +64188,7 @@ const snake = ({ kernel, terminal }) => {
|
|
|
64188
64188
|
terminal.writeln(chalk$1.blue("┌" + "─".repeat(width) + "┐"));
|
|
64189
64189
|
gameBoard.forEach((row) => terminal.writeln(chalk$1.blue("│" + row.join("") + "│")));
|
|
64190
64190
|
terminal.writeln(chalk$1.blue(`└${"─".repeat(width)}┘`));
|
|
64191
|
-
terminal.writeln(`Score: ${score} High Score: ${
|
|
64191
|
+
terminal.writeln(`Score: ${score} High Score: ${kernel2.storage.local.getItem("snake-high-score") || 0}`);
|
|
64192
64192
|
if (!gameStarted) terminal.writeln("\nPress any key to start...");
|
|
64193
64193
|
};
|
|
64194
64194
|
const moveSnake = () => {
|
|
@@ -64199,8 +64199,8 @@ const snake = ({ kernel, terminal }) => {
|
|
|
64199
64199
|
if (head.x === food.x && head.y === food.y) {
|
|
64200
64200
|
score++;
|
|
64201
64201
|
food = { x: Math.floor(Math.random() * width), y: Math.floor(Math.random() * height) };
|
|
64202
|
-
if (!
|
|
64203
|
-
|
|
64202
|
+
if (!kernel2.storage.local.getItem("snake-high-score") || Number(kernel2.storage.local.getItem("snake-high-score")) < score)
|
|
64203
|
+
kernel2.storage.local.setItem("snake-high-score", score.toString());
|
|
64204
64204
|
} else snake2.pop();
|
|
64205
64205
|
return;
|
|
64206
64206
|
};
|
|
@@ -64260,33 +64260,33 @@ const snake = ({ kernel, terminal }) => {
|
|
|
64260
64260
|
}, 100);
|
|
64261
64261
|
});
|
|
64262
64262
|
};
|
|
64263
|
-
const socket = async () => {
|
|
64263
|
+
const socket$1 = async () => {
|
|
64264
64264
|
return 0;
|
|
64265
64265
|
};
|
|
64266
|
-
const stat = async ({ kernel, shell, terminal, args }) => {
|
|
64266
|
+
const stat = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
64267
64267
|
const argPath = args[0];
|
|
64268
64268
|
const fullPath = argPath ? path.resolve(shell.cwd, argPath) : shell.cwd;
|
|
64269
|
-
const stats2 = await
|
|
64269
|
+
const stats2 = await kernel2.filesystem.fs.stat(fullPath);
|
|
64270
64270
|
terminal.writeln(JSON.stringify(stats2, null, 2));
|
|
64271
64271
|
const extension = path.extname(fullPath);
|
|
64272
64272
|
if (extension === ".zip") {
|
|
64273
|
-
const blob = new Blob([await
|
|
64273
|
+
const blob = new Blob([await kernel2.filesystem.fs.readFile(fullPath)]);
|
|
64274
64274
|
const zipReader = new ZipReader(new BlobReader(blob));
|
|
64275
64275
|
const entries = await zipReader.getEntries();
|
|
64276
64276
|
terminal.writeln(chalk$1.bold("\nZIP Entries:"));
|
|
64277
64277
|
for (const entry of entries) terminal.writeln(`${chalk$1.blue(entry.filename)} (${entry.uncompressedSize} bytes)`);
|
|
64278
64278
|
}
|
|
64279
64279
|
};
|
|
64280
|
-
const su = async ({ kernel, terminal, args }) => {
|
|
64280
|
+
const su = async ({ kernel: kernel2, terminal, args }) => {
|
|
64281
64281
|
const username = args[0];
|
|
64282
|
-
const currentUser =
|
|
64282
|
+
const currentUser = kernel2.users.get(credentials.suid);
|
|
64283
64283
|
if (!currentUser || credentials.suid !== 0) {
|
|
64284
|
-
terminal.writeln(chalk$1.red(
|
|
64284
|
+
terminal.writeln(chalk$1.red(kernel2.i18n.t("Unauthorized")));
|
|
64285
64285
|
return 1;
|
|
64286
64286
|
}
|
|
64287
|
-
const user2 = Array.from(
|
|
64287
|
+
const user2 = Array.from(kernel2.users.all.values()).find((user3) => user3.username === username);
|
|
64288
64288
|
if (!user2) {
|
|
64289
|
-
terminal.writeln(chalk$1.red(
|
|
64289
|
+
terminal.writeln(chalk$1.red(kernel2.i18n.t("User not found", { username })));
|
|
64290
64290
|
return 1;
|
|
64291
64291
|
}
|
|
64292
64292
|
Object.assign(credentials, {
|
|
@@ -64299,27 +64299,27 @@ const su = async ({ kernel, terminal, args }) => {
|
|
|
64299
64299
|
});
|
|
64300
64300
|
terminal.promptTemplate = `{user}:{cwd}${user2.uid === 0 ? "#" : "$"} `;
|
|
64301
64301
|
};
|
|
64302
|
-
const touch = async ({ kernel, shell, args }) => {
|
|
64302
|
+
const touch = async ({ kernel: kernel2, shell, args }) => {
|
|
64303
64303
|
const target = args[0];
|
|
64304
64304
|
const fullPath = target ? path.resolve(shell.cwd, target) : shell.cwd;
|
|
64305
|
-
await
|
|
64305
|
+
await kernel2.filesystem.fs.appendFile(fullPath, "");
|
|
64306
64306
|
};
|
|
64307
|
-
const umount = async ({ kernel, shell, args }) => {
|
|
64307
|
+
const umount = async ({ kernel: kernel2, shell, args }) => {
|
|
64308
64308
|
const target = args[0];
|
|
64309
64309
|
const fullPath = target ? path.resolve(shell.cwd, target) : shell.cwd;
|
|
64310
64310
|
console.log("umount", fullPath);
|
|
64311
|
-
|
|
64311
|
+
kernel2.filesystem.fsSync.umount(fullPath);
|
|
64312
64312
|
};
|
|
64313
|
-
const unzip = async ({ kernel, shell, terminal, args }) => {
|
|
64313
|
+
const unzip = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
64314
64314
|
var _a3;
|
|
64315
64315
|
const target = args[0];
|
|
64316
64316
|
const fullPath = target ? path.resolve(shell.cwd, target) : shell.cwd;
|
|
64317
|
-
const blob = new Blob([await
|
|
64317
|
+
const blob = new Blob([await kernel2.filesystem.fs.readFile(fullPath)]);
|
|
64318
64318
|
const zipReader = new ZipReader(new BlobReader(blob));
|
|
64319
64319
|
for (const entry of await zipReader.getEntries()) {
|
|
64320
64320
|
const entryPath = path.resolve(shell.cwd, entry.filename);
|
|
64321
64321
|
if (entry.directory) {
|
|
64322
|
-
await
|
|
64322
|
+
await kernel2.filesystem.fs.mkdir(entryPath);
|
|
64323
64323
|
} else {
|
|
64324
64324
|
const writer = new Uint8ArrayWriter();
|
|
64325
64325
|
const data = await ((_a3 = entry.getData) == null ? void 0 : _a3.call(entry, writer));
|
|
@@ -64327,12 +64327,12 @@ const unzip = async ({ kernel, shell, terminal, args }) => {
|
|
|
64327
64327
|
terminal.writeln(chalk$1.red(`Failed to read ${entryPath}`));
|
|
64328
64328
|
return 1;
|
|
64329
64329
|
}
|
|
64330
|
-
await
|
|
64330
|
+
await kernel2.filesystem.fs.writeFile(entryPath, data);
|
|
64331
64331
|
}
|
|
64332
64332
|
}
|
|
64333
64333
|
return 0;
|
|
64334
64334
|
};
|
|
64335
|
-
const upload = async ({ kernel, shell, terminal, args }) => {
|
|
64335
|
+
const upload = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
64336
64336
|
const destination = path.resolve(args[0] || shell.cwd);
|
|
64337
64337
|
if (!destination) {
|
|
64338
64338
|
terminal.writeln(chalk$1.red("File path is required"));
|
|
@@ -64350,8 +64350,8 @@ const upload = async ({ kernel, shell, terminal, args }) => {
|
|
|
64350
64350
|
reader.onload = async (event2) => {
|
|
64351
64351
|
if (!event2.target) return terminal.writeln(chalk$1.red("No file selected"));
|
|
64352
64352
|
const data = new Uint8Array(event2.target.result);
|
|
64353
|
-
await
|
|
64354
|
-
|
|
64353
|
+
await kernel2.filesystem.fs.writeFile(path.resolve(destination, file.name), data);
|
|
64354
|
+
kernel2.events.dispatch(KernelEvents.UPLOAD, { file: file.name, path: path.resolve(destination, file.name) });
|
|
64355
64355
|
};
|
|
64356
64356
|
reader.readAsArrayBuffer(file);
|
|
64357
64357
|
}
|
|
@@ -64359,7 +64359,7 @@ const upload = async ({ kernel, shell, terminal, args }) => {
|
|
|
64359
64359
|
input.click();
|
|
64360
64360
|
return 0;
|
|
64361
64361
|
};
|
|
64362
|
-
const user = async ({ kernel, shell, terminal, args }) => {
|
|
64362
|
+
const user = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
64363
64363
|
var _a3, _b2;
|
|
64364
64364
|
if (shell.credentials.suid !== 0) {
|
|
64365
64365
|
terminal.writeln(chalk$1.red("Unauthorized"));
|
|
@@ -64379,7 +64379,7 @@ const user = async ({ kernel, shell, terminal, args }) => {
|
|
|
64379
64379
|
}
|
|
64380
64380
|
switch (command) {
|
|
64381
64381
|
case "list": {
|
|
64382
|
-
const users = Array.from(
|
|
64382
|
+
const users = Array.from(kernel2.users.all.values());
|
|
64383
64383
|
const uidWidth = Math.max(3, ...users.map((u) => u.uid.toString().length));
|
|
64384
64384
|
const usernameWidth = Math.max(8, ...users.map((u) => u.username.length));
|
|
64385
64385
|
const gidWidth = Math.max(3, ...users.map((u) => {
|
|
@@ -64401,7 +64401,7 @@ const user = async ({ kernel, shell, terminal, args }) => {
|
|
|
64401
64401
|
terminal.writeln(chalk$1.red("Username required"));
|
|
64402
64402
|
return 1;
|
|
64403
64403
|
}
|
|
64404
|
-
if (Array.from(
|
|
64404
|
+
if (Array.from(kernel2.users.all.values()).some((u) => u.username === username)) {
|
|
64405
64405
|
terminal.writeln(chalk$1.red(`User ${username} already exists`));
|
|
64406
64406
|
return 1;
|
|
64407
64407
|
}
|
|
@@ -64415,7 +64415,7 @@ const user = async ({ kernel, shell, terminal, args }) => {
|
|
|
64415
64415
|
}
|
|
64416
64416
|
}
|
|
64417
64417
|
try {
|
|
64418
|
-
await
|
|
64418
|
+
await kernel2.users.add({ username, password: userPassword });
|
|
64419
64419
|
terminal.writeln(chalk$1.green(`User ${username} created successfully`));
|
|
64420
64420
|
return 0;
|
|
64421
64421
|
} catch (error) {
|
|
@@ -64428,7 +64428,7 @@ const user = async ({ kernel, shell, terminal, args }) => {
|
|
|
64428
64428
|
terminal.writeln(chalk$1.red("Username required"));
|
|
64429
64429
|
return 1;
|
|
64430
64430
|
}
|
|
64431
|
-
const user2 = Array.from(
|
|
64431
|
+
const user2 = Array.from(kernel2.users.all.values()).find((u) => u.username === username);
|
|
64432
64432
|
if (!user2) {
|
|
64433
64433
|
terminal.writeln(chalk$1.red(`User ${username} not found`));
|
|
64434
64434
|
return 1;
|
|
@@ -64438,9 +64438,9 @@ const user = async ({ kernel, shell, terminal, args }) => {
|
|
|
64438
64438
|
return 1;
|
|
64439
64439
|
}
|
|
64440
64440
|
try {
|
|
64441
|
-
await
|
|
64442
|
-
await
|
|
64443
|
-
await
|
|
64441
|
+
await kernel2.users.remove(user2.uid);
|
|
64442
|
+
await kernel2.filesystem.fs.writeFile("/etc/passwd", (await kernel2.filesystem.fs.readFile("/etc/passwd", "utf8")).split("\n").filter((line3) => !line3.startsWith(`${username}:`)).join("\n"));
|
|
64443
|
+
await kernel2.filesystem.fs.writeFile("/etc/shadow", (await kernel2.filesystem.fs.readFile("/etc/shadow", "utf8")).split("\n").filter((line3) => !line3.startsWith(`${username}:`)).join("\n"));
|
|
64444
64444
|
terminal.writeln(chalk$1.green(`User ${username} deleted successfully`));
|
|
64445
64445
|
return 0;
|
|
64446
64446
|
} catch (error) {
|
|
@@ -64453,7 +64453,7 @@ const user = async ({ kernel, shell, terminal, args }) => {
|
|
|
64453
64453
|
terminal.writeln(chalk$1.red("Username required"));
|
|
64454
64454
|
return 1;
|
|
64455
64455
|
}
|
|
64456
|
-
const user2 = Array.from(
|
|
64456
|
+
const user2 = Array.from(kernel2.users.all.values()).find((u) => u.username === username);
|
|
64457
64457
|
if (!user2) {
|
|
64458
64458
|
terminal.writeln(chalk$1.red(`User ${username} not found`));
|
|
64459
64459
|
return 1;
|
|
@@ -64465,7 +64465,7 @@ const user = async ({ kernel, shell, terminal, args }) => {
|
|
|
64465
64465
|
return 1;
|
|
64466
64466
|
}
|
|
64467
64467
|
try {
|
|
64468
|
-
await
|
|
64468
|
+
await kernel2.users.update(user2.uid, { password: newPassword });
|
|
64469
64469
|
terminal.writeln(chalk$1.green(`Password updated for ${username}`));
|
|
64470
64470
|
return 0;
|
|
64471
64471
|
} catch (error) {
|
|
@@ -64478,10 +64478,10 @@ const user = async ({ kernel, shell, terminal, args }) => {
|
|
|
64478
64478
|
return 1;
|
|
64479
64479
|
}
|
|
64480
64480
|
};
|
|
64481
|
-
const video = async ({ kernel, shell, args }) => {
|
|
64481
|
+
const video = async ({ kernel: kernel2, shell, args }) => {
|
|
64482
64482
|
const file = args[0];
|
|
64483
64483
|
const fullPath = file ? path.resolve(shell.cwd, file) : shell.cwd;
|
|
64484
|
-
const blob = new Blob([await
|
|
64484
|
+
const blob = new Blob([await kernel2.filesystem.fs.readFile(fullPath)]);
|
|
64485
64485
|
const url = URL.createObjectURL(blob);
|
|
64486
64486
|
const video2 = document.createElement("video");
|
|
64487
64487
|
video2.src = url;
|
|
@@ -64491,7 +64491,7 @@ const video = async ({ kernel, shell, args }) => {
|
|
|
64491
64491
|
const { videoWidth, videoHeight } = video2;
|
|
64492
64492
|
const { innerWidth, innerHeight } = window;
|
|
64493
64493
|
const shouldMaximize = videoWidth > innerWidth || videoHeight > innerHeight;
|
|
64494
|
-
|
|
64494
|
+
kernel2.windows.create({
|
|
64495
64495
|
title: file,
|
|
64496
64496
|
html: `<video src="${url}" autoplay controls style="width:100%;height:100%"></video>`,
|
|
64497
64497
|
width: shouldMaximize ? innerWidth : videoWidth,
|
|
@@ -64499,7 +64499,7 @@ const video = async ({ kernel, shell, args }) => {
|
|
|
64499
64499
|
maximized: shouldMaximize
|
|
64500
64500
|
});
|
|
64501
64501
|
};
|
|
64502
|
-
const zip = async ({ kernel, shell, terminal, args }) => {
|
|
64502
|
+
const zip = async ({ kernel: kernel2, shell, terminal, args }) => {
|
|
64503
64503
|
const [output, paths2 = []] = args;
|
|
64504
64504
|
if (!output || paths2.length === 0) {
|
|
64505
64505
|
terminal.writeln("Usage: zip <output> <paths...>");
|
|
@@ -64512,22 +64512,22 @@ const zip = async ({ kernel, shell, terminal, args }) => {
|
|
|
64512
64512
|
for (const inputPath of paths2) {
|
|
64513
64513
|
const fullPath = path.resolve(shell.cwd, inputPath);
|
|
64514
64514
|
try {
|
|
64515
|
-
const stat2 = await
|
|
64515
|
+
const stat2 = await kernel2.filesystem.fs.stat(fullPath);
|
|
64516
64516
|
if (stat2.isFile()) {
|
|
64517
64517
|
const relativePath = path.relative(shell.cwd, fullPath);
|
|
64518
|
-
const fileData = await
|
|
64518
|
+
const fileData = await kernel2.filesystem.fs.readFile(fullPath);
|
|
64519
64519
|
const reader = new Uint8ArrayReader(fileData);
|
|
64520
64520
|
await zipWriter.add(relativePath, reader);
|
|
64521
64521
|
terminal.writeln(`Added file: ${relativePath}`);
|
|
64522
64522
|
} else if (stat2.isDirectory()) {
|
|
64523
64523
|
async function addDirectory(dirPath) {
|
|
64524
|
-
const entries = await
|
|
64524
|
+
const entries = await kernel2.filesystem.fs.readdir(dirPath);
|
|
64525
64525
|
for (const entry of entries) {
|
|
64526
64526
|
const entryPath = path.join(dirPath, entry);
|
|
64527
64527
|
const relativePath = path.relative(shell.cwd, entryPath);
|
|
64528
|
-
const entryStat = await
|
|
64528
|
+
const entryStat = await kernel2.filesystem.fs.stat(entryPath);
|
|
64529
64529
|
if (entryStat.isFile()) {
|
|
64530
|
-
const fileData = await
|
|
64530
|
+
const fileData = await kernel2.filesystem.fs.readFile(entryPath);
|
|
64531
64531
|
const reader = new Uint8ArrayReader(fileData);
|
|
64532
64532
|
await (zipWriter == null ? void 0 : zipWriter.add(relativePath, reader));
|
|
64533
64533
|
terminal.writeln(`Added file: ${relativePath}`);
|
|
@@ -64547,7 +64547,7 @@ const zip = async ({ kernel, shell, terminal, args }) => {
|
|
|
64547
64547
|
}
|
|
64548
64548
|
const blob = await zipWriter.close();
|
|
64549
64549
|
zipWriter = null;
|
|
64550
|
-
await
|
|
64550
|
+
await kernel2.filesystem.fs.writeFile(outputPath, new Uint8Array(await blob.arrayBuffer()));
|
|
64551
64551
|
terminal.writeln(`Created zip file: ${output}`);
|
|
64552
64552
|
return 0;
|
|
64553
64553
|
} catch (err2) {
|
|
@@ -68425,7 +68425,7 @@ class Shell {
|
|
|
68425
68425
|
const finalCommand = await this.resolveCommand(commandName);
|
|
68426
68426
|
if (!finalCommand) return -1;
|
|
68427
68427
|
let inputStream = i === 0 ? this._terminal.getInputStream() : prevOutputStream;
|
|
68428
|
-
const { env: env2, kernel } = this;
|
|
68428
|
+
const { env: env2, kernel: kernel2 } = this;
|
|
68429
68429
|
for (const redirection of redirections) {
|
|
68430
68430
|
if (redirection.type === "<") {
|
|
68431
68431
|
const sourcePath = path.resolve(this.cwd, redirection.target);
|
|
@@ -68434,7 +68434,7 @@ class Shell {
|
|
|
68434
68434
|
}
|
|
68435
68435
|
inputStream = new ReadableStream({
|
|
68436
68436
|
async start(controller) {
|
|
68437
|
-
const fileHandle = await
|
|
68437
|
+
const fileHandle = await kernel2.filesystem.fs.open(sourcePath, "r");
|
|
68438
68438
|
const chunkSize = parseInt(env2.get("SHELL_INPUT_REDIRECTION_CHUNK_SIZE") || void 0 || "8192");
|
|
68439
68439
|
const buffer2 = new Uint8Array(chunkSize);
|
|
68440
68440
|
try {
|
|
@@ -68660,9 +68660,9 @@ class Users {
|
|
|
68660
68660
|
*/
|
|
68661
68661
|
async load() {
|
|
68662
68662
|
var _a3, _b2;
|
|
68663
|
-
const { kernel } = this._options;
|
|
68664
|
-
const passwd2 = await
|
|
68665
|
-
const shadow = await
|
|
68663
|
+
const { kernel: kernel2 } = this._options;
|
|
68664
|
+
const passwd2 = await kernel2.filesystem.fs.readFile("/etc/passwd", "utf-8");
|
|
68665
|
+
const shadow = await kernel2.filesystem.fs.readFile("/etc/shadow", "utf-8");
|
|
68666
68666
|
for (const line3 of passwd2.split("\n")) {
|
|
68667
68667
|
if (line3.trim() === "" || line3.trim() === "\n" || line3.startsWith("#")) continue;
|
|
68668
68668
|
const [username, uid, gid, home, shell] = line3.split(":");
|
|
@@ -68671,13 +68671,13 @@ class Users {
|
|
|
68671
68671
|
if (shadowEntry) {
|
|
68672
68672
|
const [, , , password, publicKey, encryptedPrivateKey] = shadowEntry.split(":");
|
|
68673
68673
|
if (!publicKey || !encryptedPrivateKey) {
|
|
68674
|
-
(_a3 =
|
|
68674
|
+
(_a3 = kernel2.log) == null ? void 0 : _a3.warn(`User ${username} has no keypair`);
|
|
68675
68675
|
continue;
|
|
68676
68676
|
}
|
|
68677
68677
|
const keypair = { publicKey: JSON.parse(atob(publicKey)), privateKey: encryptedPrivateKey };
|
|
68678
68678
|
await this.add({ username, password, uid: parseInt(uid), gid: gid.split(",").map(Number), home, shell, keypair }, { noWrite: true, noHome: true, noHash: true });
|
|
68679
68679
|
} else {
|
|
68680
|
-
(_b2 =
|
|
68680
|
+
(_b2 = kernel2.log) == null ? void 0 : _b2.warn(`User ${username} not found in /etc/shadow`);
|
|
68681
68681
|
}
|
|
68682
68682
|
}
|
|
68683
68683
|
}
|
|
@@ -75950,7 +75950,7 @@ var createBIOS = (() => {
|
|
|
75950
75950
|
return moduleRtn;
|
|
75951
75951
|
};
|
|
75952
75952
|
})();
|
|
75953
|
-
const __vite_import_meta_env__ = { "AUTHOR": { "name": "Jay Mathis", "email": "code@mathis.network", "url": "https://github.com/mathiscode" }, "BASE_URL": "/", "DESCRIPTION": "ecmaOS: Micro-kernel and framework for web technologies", "DEV": false, "HOMEPAGE": "https://ecmaos.sh", "KNOWN_ISSUES": ["Don't expect any sort of POSIX compliance at this stage", "Most commands/devices are very basic implementations, not complete reproductions", "stdin/stdout/stderr streams and redirection can be wonky and don't work everywhere, but are coming along", "Newly created files on any IndexedDB-backed filesystem are not readable until the kernel is restarted", "Lots of unfinished work; watch your step"], "MODE": "production", "NAME": "@ecmaos/kernel", "PROD": true, "REPOSITORY": "https://github.com/ecmaos/ecmaos", "SSR": false, "TIPS": ["You can 'run' some devices that offer a CLI - for example, '/dev/battery --help'"], "VERSION": "0.1.
|
|
75953
|
+
const __vite_import_meta_env__ = { "AUTHOR": { "name": "Jay Mathis", "email": "code@mathis.network", "url": "https://github.com/mathiscode" }, "BASE_URL": "/", "DESCRIPTION": "ecmaOS: Micro-kernel and framework for web technologies", "DEV": false, "HOMEPAGE": "https://ecmaos.sh", "KNOWN_ISSUES": ["Don't expect any sort of POSIX compliance at this stage", "Most commands/devices are very basic implementations, not complete reproductions", "stdin/stdout/stderr streams and redirection can be wonky and don't work everywhere, but are coming along", "Newly created files on any IndexedDB-backed filesystem are not readable until the kernel is restarted", "Lots of unfinished work; watch your step"], "MODE": "production", "NAME": "@ecmaos/kernel", "PROD": true, "REPOSITORY": "https://github.com/ecmaos/ecmaos", "SSR": false, "TIPS": ["You can 'run' some devices that offer a CLI - for example, '/dev/battery --help'"], "VERSION": "0.1.2", "VITE_APP_SHOW_DEFAULT_LOGIN": "true", "VITE_KERNEL_INTERVALS_PROC": "1000", "VITE_KERNEL_MODULES": "http://localhost:3000/build/release.js", "VITE_METAL_SOCKET": "ws://localhost:30445/socket", "VITE_PORT": "30443" };
|
|
75954
75954
|
var define_import_meta_env_AUTHOR_default = { name: "Jay Mathis", email: "code@mathis.network", url: "https://github.com/mathiscode" };
|
|
75955
75955
|
var define_import_meta_env_KNOWN_ISSUES_default = ["Don't expect any sort of POSIX compliance at this stage", "Most commands/devices are very basic implementations, not complete reproductions", "stdin/stdout/stderr streams and redirection can be wonky and don't work everywhere, but are coming along", "Newly created files on any IndexedDB-backed filesystem are not readable until the kernel is restarted", "Lots of unfinished work; watch your step"];
|
|
75956
75956
|
var define_import_meta_env_TIPS_default = ["You can 'run' some devices that offer a CLI - for example, '/dev/battery --help'"];
|
|
@@ -75994,7 +75994,7 @@ class Kernel {
|
|
|
75994
75994
|
/** Name of the kernel */
|
|
75995
75995
|
__publicField(this, "name", "@ecmaos/kernel");
|
|
75996
75996
|
/** Version string of the kernel */
|
|
75997
|
-
__publicField(this, "version", "0.1.
|
|
75997
|
+
__publicField(this, "version", "0.1.2");
|
|
75998
75998
|
/** Authentication and authorization service */
|
|
75999
75999
|
__publicField(this, "auth");
|
|
76000
76000
|
/** BIOS module providing low-level functionality */
|
|
@@ -76021,6 +76021,8 @@ class Kernel {
|
|
|
76021
76021
|
__publicField(this, "log");
|
|
76022
76022
|
/** Memory management service */
|
|
76023
76023
|
__publicField(this, "memory");
|
|
76024
|
+
/** Map of loaded modules */
|
|
76025
|
+
__publicField(this, "modules", /* @__PURE__ */ new Map());
|
|
76024
76026
|
/** Configuration options passed to the kernel */
|
|
76025
76027
|
__publicField(this, "options");
|
|
76026
76028
|
/** Map of loaded packages */
|
|
@@ -76064,6 +76066,7 @@ class Kernel {
|
|
|
76064
76066
|
this.keyboard = navigator.keyboard;
|
|
76065
76067
|
this.log = this.options.log ? new Log(this.options.log) : null;
|
|
76066
76068
|
this.memory = new Memory();
|
|
76069
|
+
this.modules = /* @__PURE__ */ new Map();
|
|
76067
76070
|
this.processes = new ProcessManager();
|
|
76068
76071
|
this.protocol = new Protocol({ kernel: this });
|
|
76069
76072
|
this.screensavers = /* @__PURE__ */ new Map();
|
|
@@ -76099,7 +76102,7 @@ class Kernel {
|
|
|
76099
76102
|
* @throws {Error} If boot process fails
|
|
76100
76103
|
*/
|
|
76101
76104
|
async boot(options = DefaultBootOptions) {
|
|
76102
|
-
var _a3, _b2, _c, _d, _e, _f;
|
|
76105
|
+
var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
76103
76106
|
let spinner;
|
|
76104
76107
|
const t2 = this.i18n.i18next.getFixedT(this.i18n.language, "kernel");
|
|
76105
76108
|
try {
|
|
@@ -76145,7 +76148,7 @@ class Kernel {
|
|
|
76145
76148
|
figlet.parseFont(figletFont || "Poison", loadedFont.default);
|
|
76146
76149
|
const logoFiglet = figlet.textSync(__vite_import_meta_env__["FIGLET_TEXT"] || "ECMAOS", { font: figletFont });
|
|
76147
76150
|
this.terminal.writeln(colorFiglet(figletColor, logoFiglet));
|
|
76148
|
-
this.terminal.writeln(`${this.terminal.createSpecialLink("https://ecmaos.sh", "@ecmaos/kernel")} v${"0.1.
|
|
76151
|
+
this.terminal.writeln(`${this.terminal.createSpecialLink("https://ecmaos.sh", "@ecmaos/kernel")} v${"0.1.2"}`);
|
|
76149
76152
|
this.terminal.writeln(`${t2("kernel.madeBy")} ${this.terminal.createSpecialLink(
|
|
76150
76153
|
(define_import_meta_env_AUTHOR_default == null ? void 0 : define_import_meta_env_AUTHOR_default.url) || "https://github.com/mathiscode",
|
|
76151
76154
|
`${define_import_meta_env_AUTHOR_default == null ? void 0 : define_import_meta_env_AUTHOR_default.name} <${define_import_meta_env_AUTHOR_default == null ? void 0 : define_import_meta_env_AUTHOR_default.email}>`
|
|
@@ -76164,13 +76167,13 @@ class Kernel {
|
|
|
76164
76167
|
spinner.start();
|
|
76165
76168
|
console.log(`%c${logoFiglet}`, "color: green");
|
|
76166
76169
|
console.log(`%c${"https://github.com/ecmaos/ecmaos"}`, "color: blue; text-decoration: underline; font-size: 16px");
|
|
76167
|
-
this.log.info(`${"@ecmaos/kernel"} v${"0.1.
|
|
76170
|
+
this.log.info(`${"@ecmaos/kernel"} v${"0.1.2"}`);
|
|
76168
76171
|
if ((Notification == null ? void 0 : Notification.permission) === "default") Notification.requestPermission();
|
|
76169
76172
|
if ((Notification == null ? void 0 : Notification.permission) === "denied") (_b2 = this.log) == null ? void 0 : _b2.warn(t2("kernel.permissionNotificationDenied"));
|
|
76170
76173
|
this.intervals.set("title-blink", () => {
|
|
76171
76174
|
globalThis.document.title = globalThis.document.title.includes("_") ? "ecmaos# " : "ecmaos# _";
|
|
76172
76175
|
}, 600);
|
|
76173
|
-
this.toast.success(`${"@ecmaos/kernel"} v${"0.1.
|
|
76176
|
+
this.toast.success(`${"@ecmaos/kernel"} v${"0.1.2"}`);
|
|
76174
76177
|
}
|
|
76175
76178
|
await this.configure({ filesystem: Filesystem.options() });
|
|
76176
76179
|
const requiredPaths = [
|
|
@@ -76242,12 +76245,27 @@ class Kernel {
|
|
|
76242
76245
|
await this.registerCommands();
|
|
76243
76246
|
await this.registerProc();
|
|
76244
76247
|
await this.registerPackages();
|
|
76245
|
-
this.intervals.set("/proc", this.registerProc.bind(this),
|
|
76248
|
+
this.intervals.set("/proc", this.registerProc.bind(this), "1000");
|
|
76249
|
+
const modules = "http://localhost:3000/build/release.js";
|
|
76250
|
+
if (modules) {
|
|
76251
|
+
const mods = modules.split(",");
|
|
76252
|
+
for (const mod of mods) {
|
|
76253
|
+
(_d = this.log) == null ? void 0 : _d.info(`Loading module ${mod}`);
|
|
76254
|
+
try {
|
|
76255
|
+
const module = await import(mod);
|
|
76256
|
+
const name = ((_e = module.name) == null ? void 0 : _e.value) || mod;
|
|
76257
|
+
(_f = module.init) == null ? void 0 : _f.call(module, this.id);
|
|
76258
|
+
this.modules.set(name, module);
|
|
76259
|
+
} catch (error) {
|
|
76260
|
+
(_g = this.log) == null ? void 0 : _g.error(`Failed to load module ${mod}: ${error.message}`);
|
|
76261
|
+
}
|
|
76262
|
+
}
|
|
76263
|
+
}
|
|
76246
76264
|
try {
|
|
76247
76265
|
if (!await this.filesystem.fs.exists("/etc/passwd")) await this.users.add({ username: "root", password: "root", home: "/root" }, { noHome: true });
|
|
76248
76266
|
else await this.users.load();
|
|
76249
76267
|
} catch (err2) {
|
|
76250
|
-
(
|
|
76268
|
+
(_h = this.log) == null ? void 0 : _h.error(err2);
|
|
76251
76269
|
this.terminal.writeln(chalk$1.red(err2.message));
|
|
76252
76270
|
throw err2;
|
|
76253
76271
|
}
|
|
@@ -76317,7 +76335,7 @@ class Kernel {
|
|
|
76317
76335
|
args: [],
|
|
76318
76336
|
command: "init",
|
|
76319
76337
|
uid: user2.uid,
|
|
76320
|
-
gid: ((
|
|
76338
|
+
gid: ((_i = user2.gid) == null ? void 0 : _i[0]) ?? 0,
|
|
76321
76339
|
kernel: this,
|
|
76322
76340
|
shell: this.shell,
|
|
76323
76341
|
terminal: this.terminal,
|
|
@@ -76329,7 +76347,7 @@ class Kernel {
|
|
|
76329
76347
|
this.terminal.focus();
|
|
76330
76348
|
this.terminal.listen();
|
|
76331
76349
|
} catch (error) {
|
|
76332
|
-
(
|
|
76350
|
+
(_j = this.log) == null ? void 0 : _j.error(error);
|
|
76333
76351
|
this._state = KernelState.PANIC;
|
|
76334
76352
|
this.events.dispatch(KernelEvents.PANIC, { error });
|
|
76335
76353
|
this.toast.error({
|
|
@@ -76653,7 +76671,7 @@ class Kernel {
|
|
|
76653
76671
|
memory: "?",
|
|
76654
76672
|
platform: ((_a3 = navigator.userAgentData) == null ? void 0 : _a3.platform) || (navigator == null ? void 0 : navigator.platform) || navigator.userAgent,
|
|
76655
76673
|
querystring: location.search,
|
|
76656
|
-
version: `${"@ecmaos/kernel"} ${"0.1.
|
|
76674
|
+
version: `${"@ecmaos/kernel"} ${"0.1.2"}`,
|
|
76657
76675
|
language: navigator.language,
|
|
76658
76676
|
host: location.host,
|
|
76659
76677
|
userAgent: navigator.userAgent,
|
|
@@ -76707,14 +76725,19 @@ class Kernel {
|
|
|
76707
76725
|
}
|
|
76708
76726
|
}
|
|
76709
76727
|
}
|
|
76710
|
-
|
|
76728
|
+
const socket = "ws://localhost:30445/socket";
|
|
76729
|
+
const kernel = new Kernel({
|
|
76711
76730
|
credentials: void 0,
|
|
76712
76731
|
dom: { topbar: true },
|
|
76713
76732
|
log: { name: `ecmaos:${"kernel"}` },
|
|
76714
|
-
socket:
|
|
76733
|
+
socket: new WebSocket(socket)
|
|
76715
76734
|
});
|
|
76716
|
-
globalThis.
|
|
76717
|
-
globalThis.kernel.
|
|
76735
|
+
globalThis.kernels = globalThis.kernels || /* @__PURE__ */ new Map();
|
|
76736
|
+
globalThis.kernels.set(kernel.id, kernel);
|
|
76737
|
+
const primaryKernel = globalThis.kernels.values().next().value;
|
|
76738
|
+
globalThis.kernel = primaryKernel;
|
|
76739
|
+
kernel.terminal.mount(document.getElementById("terminal"));
|
|
76740
|
+
kernel.boot({ silent: false, figletFontRandom: false });
|
|
76718
76741
|
const __viteBrowserExternal = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
76719
76742
|
__proto__: null
|
|
76720
76743
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -76724,4 +76747,4 @@ const empty = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
76724
76747
|
export {
|
|
76725
76748
|
getDefaultExportFromCjs$2 as g
|
|
76726
76749
|
};
|
|
76727
|
-
//# sourceMappingURL=index-
|
|
76750
|
+
//# sourceMappingURL=index-BOrpzH3-.js.map
|