kiosko 0.1.0 → 0.2.1
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/README.md +28 -19
- package/cli.js +1101 -317
- package/package.json +17 -16
- package/sdk.js +49 -0
- package/web/assets/app.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kiosko",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "A widget mosaic for small always-on USB LCD panels (Thermalright Trofeo Vision and friends), with a visual editor and plugins.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,20 +40,21 @@
|
|
|
40
40
|
"dejavu-fonts-ttf": "^2.37.3"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"
|
|
44
|
-
"kiosko-plugin-
|
|
45
|
-
"kiosko-plugin-
|
|
46
|
-
"kiosko-plugin-
|
|
47
|
-
"kiosko-plugin-
|
|
48
|
-
"kiosko-plugin-
|
|
49
|
-
"kiosko-plugin-
|
|
50
|
-
"kiosko-plugin-
|
|
51
|
-
"kiosko-plugin-
|
|
52
|
-
"kiosko-plugin-
|
|
53
|
-
"kiosko-plugin-
|
|
54
|
-
"kiosko-plugin-
|
|
55
|
-
"kiosko-plugin-
|
|
56
|
-
"kiosko-plugin-
|
|
57
|
-
"kiosko-plugin-
|
|
43
|
+
"usb": "^2.19.1",
|
|
44
|
+
"kiosko-plugin-agents": "^0.2.0",
|
|
45
|
+
"kiosko-plugin-cats": "^0.2.0",
|
|
46
|
+
"kiosko-plugin-system": "^0.2.0",
|
|
47
|
+
"kiosko-plugin-vitals": "^0.2.0",
|
|
48
|
+
"kiosko-plugin-usage": "^0.2.0",
|
|
49
|
+
"kiosko-plugin-weather": "^0.2.0",
|
|
50
|
+
"kiosko-plugin-calendar": "^0.2.0",
|
|
51
|
+
"kiosko-plugin-news": "^0.2.0",
|
|
52
|
+
"kiosko-plugin-mirror": "^0.2.0",
|
|
53
|
+
"kiosko-plugin-gitlab": "^0.2.0",
|
|
54
|
+
"kiosko-plugin-github": "^0.2.0",
|
|
55
|
+
"kiosko-plugin-calls": "^0.2.0",
|
|
56
|
+
"kiosko-plugin-timesheet": "^0.2.0",
|
|
57
|
+
"kiosko-plugin-llm": "^0.2.0",
|
|
58
|
+
"kiosko-plugin-gpu": "^0.2.0"
|
|
58
59
|
}
|
|
59
60
|
}
|
package/sdk.js
CHANGED
|
@@ -439,6 +439,7 @@ function createBaseContext(o) {
|
|
|
439
439
|
fmt: createFormatters({ locale, timeFormat: o.timeFormat ?? "auto", now: o.now }),
|
|
440
440
|
log: o.log ?? (() => void 0),
|
|
441
441
|
dataDir: o.dataDir ?? "",
|
|
442
|
+
cacheDir: o.cacheDir ?? o.dataDir ?? "",
|
|
442
443
|
...o.location ? { location: o.location } : {},
|
|
443
444
|
workday: o.workday ?? DEFAULT_WORKDAY
|
|
444
445
|
};
|
|
@@ -469,6 +470,52 @@ function placeOf(own, user) {
|
|
|
469
470
|
if (!user) return void 0;
|
|
470
471
|
return name ? { ...user, name } : user;
|
|
471
472
|
}
|
|
473
|
+
|
|
474
|
+
// packages/sdk/src/system.ts
|
|
475
|
+
import { statSync } from "node:fs";
|
|
476
|
+
import { homedir } from "node:os";
|
|
477
|
+
import { join, win32 } from "node:path";
|
|
478
|
+
function expandPath(p, o = {}) {
|
|
479
|
+
const env = o.env ?? process.env;
|
|
480
|
+
let v = p.replace(/\$(?:\{(\w+)\}|(\w+))/g, (whole, a, b) => env[a ?? b ?? ""] ?? whole);
|
|
481
|
+
if ((o.os ?? process.platform) === "win32") v = v.replace(/%([^%\r\n]+)%/g, (whole, name) => env[name] ?? whole);
|
|
482
|
+
const home = o.home ?? homedir();
|
|
483
|
+
if (v === "~") return home;
|
|
484
|
+
return v.startsWith("~/") || v.startsWith("~\\") ? join(home, v.slice(2)) : v;
|
|
485
|
+
}
|
|
486
|
+
var CMD_UNSAFE = /["%\r\n\0]/;
|
|
487
|
+
function commandFor(cmd, args, o = {}) {
|
|
488
|
+
if ((o.os ?? process.platform) !== "win32") return { file: cmd, args };
|
|
489
|
+
const env = o.env ?? process.env;
|
|
490
|
+
const exists = o.exists ?? defaultExists;
|
|
491
|
+
const shim = findShim(cmd, env, exists);
|
|
492
|
+
if (!shim) return { file: cmd, args };
|
|
493
|
+
for (const a of args) if (CMD_UNSAFE.test(a)) throw new Error(`argument not allowed for ${cmd}: ${JSON.stringify(a)}`);
|
|
494
|
+
const quote = (s) => /^[\w@+=:,./\\-]+$/.test(s) ? s : `"${s}"`;
|
|
495
|
+
return { file: env.ComSpec || "cmd.exe", args: ["/d", "/s", "/c", `"${[shim, ...args].map(quote).join(" ")}"`], windowsVerbatimArguments: true };
|
|
496
|
+
}
|
|
497
|
+
function defaultExists(path) {
|
|
498
|
+
try {
|
|
499
|
+
return statSync(path).isFile();
|
|
500
|
+
} catch {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function findShim(cmd, env, exists) {
|
|
505
|
+
if (/\.(exe|com)$/i.test(cmd)) return null;
|
|
506
|
+
if (/\.(cmd|bat)$/i.test(cmd) && /[\\/]/.test(cmd)) return exists(cmd) ? cmd : null;
|
|
507
|
+
const dirs = /[\\/]/.test(cmd) ? [""] : (env.PATH ?? env.Path ?? "").split(";").filter(Boolean);
|
|
508
|
+
const exts = (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean);
|
|
509
|
+
for (const dir of dirs) {
|
|
510
|
+
const base2 = dir ? win32.join(dir, cmd) : cmd;
|
|
511
|
+
for (const ext of /\.\w+$/.test(cmd) ? [""] : exts) {
|
|
512
|
+
const p = base2 + ext.toLowerCase();
|
|
513
|
+
if (!exists(p)) continue;
|
|
514
|
+
return /\.(cmd|bat)$/i.test(p) ? p : null;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return null;
|
|
518
|
+
}
|
|
472
519
|
export {
|
|
473
520
|
CATEGORIES,
|
|
474
521
|
DEFAULT_THEME,
|
|
@@ -478,6 +525,7 @@ export {
|
|
|
478
525
|
SECRET_NOTE,
|
|
479
526
|
THEMES,
|
|
480
527
|
TIME_FORMATS,
|
|
528
|
+
commandFor,
|
|
481
529
|
createBaseContext,
|
|
482
530
|
createFormatters,
|
|
483
531
|
dayKey,
|
|
@@ -488,6 +536,7 @@ export {
|
|
|
488
536
|
defineWidget,
|
|
489
537
|
drawEmpty,
|
|
490
538
|
drawMore,
|
|
539
|
+
expandPath,
|
|
491
540
|
filterPatterns,
|
|
492
541
|
isWorkingAt,
|
|
493
542
|
listLayout,
|