omnius 1.0.255 → 1.0.256
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/index.js +191 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -692421,6 +692421,197 @@ data: ${JSON.stringify(data)}
|
|
|
692421
692421
|
jsonResponse(res, ok3 ? 200 : 500, ok3 ? { unit, action, status: "ok" } : { error: "action failed", unit, action });
|
|
692422
692422
|
return;
|
|
692423
692423
|
}
|
|
692424
|
+
if (pathname === "/v1/theme" && method === "GET") {
|
|
692425
|
+
const config = loadConfig();
|
|
692426
|
+
jsonResponse(res, 200, { theme: config.theme ?? "system", fontScale: config.fontScale ?? 1 });
|
|
692427
|
+
return;
|
|
692428
|
+
}
|
|
692429
|
+
if (pathname === "/v1/theme" && method === "POST") {
|
|
692430
|
+
const body = await parseJsonBody(req3);
|
|
692431
|
+
const config = loadConfig();
|
|
692432
|
+
if (body?.theme) config.theme = body.theme;
|
|
692433
|
+
if (typeof body?.fontScale === "number") config.fontScale = body.fontScale;
|
|
692434
|
+
try {
|
|
692435
|
+
require4("./config").saveConfig?.(config);
|
|
692436
|
+
} catch {
|
|
692437
|
+
}
|
|
692438
|
+
jsonResponse(res, 200, { ok: true, theme: config.theme, fontScale: config.fontScale });
|
|
692439
|
+
return;
|
|
692440
|
+
}
|
|
692441
|
+
if (pathname === "/v1/tor/status" && method === "GET") {
|
|
692442
|
+
const config = loadConfig();
|
|
692443
|
+
jsonResponse(res, 200, { enabled: config.torEnabled ?? false });
|
|
692444
|
+
return;
|
|
692445
|
+
}
|
|
692446
|
+
if (pathname === "/v1/tor/enable" && method === "POST") {
|
|
692447
|
+
const body = await parseJsonBody(req3);
|
|
692448
|
+
const config = loadConfig();
|
|
692449
|
+
config.torEnabled = Boolean(body?.enabled);
|
|
692450
|
+
try {
|
|
692451
|
+
require4("./config").saveConfig?.(config);
|
|
692452
|
+
} catch {
|
|
692453
|
+
}
|
|
692454
|
+
jsonResponse(res, 200, { ok: true, enabled: config.torEnabled });
|
|
692455
|
+
return;
|
|
692456
|
+
}
|
|
692457
|
+
if (pathname === "/v1/update" && method === "POST") {
|
|
692458
|
+
const config = loadConfig();
|
|
692459
|
+
config.updating = true;
|
|
692460
|
+
try {
|
|
692461
|
+
require4("./config").saveConfig?.(config);
|
|
692462
|
+
} catch {
|
|
692463
|
+
}
|
|
692464
|
+
setImmediate(() => {
|
|
692465
|
+
try {
|
|
692466
|
+
const { execSync: execSync62 } = require4("node:child_process");
|
|
692467
|
+
execSync62("npm update -g omnius 2>/dev/null || true", { stdio: "pipe" });
|
|
692468
|
+
} catch {
|
|
692469
|
+
}
|
|
692470
|
+
});
|
|
692471
|
+
jsonResponse(res, 200, { ok: true, message: "Update initiated" });
|
|
692472
|
+
return;
|
|
692473
|
+
}
|
|
692474
|
+
if (pathname === "/v1/share/generate" && method === "POST") {
|
|
692475
|
+
const body = await parseJsonBody(req3);
|
|
692476
|
+
const config = loadConfig();
|
|
692477
|
+
const shareDir = config.shareDir || `${require4("node:os").homedir()}/.omnius/share`;
|
|
692478
|
+
const fs11 = require4("node:fs");
|
|
692479
|
+
const path12 = require4("node:path");
|
|
692480
|
+
try {
|
|
692481
|
+
fs11.mkdirSync(shareDir, { recursive: true });
|
|
692482
|
+
const filename = `${Date.now()}-${(body?.title || "share").replace(/[^a-z0-9]/gi, "_")}.md`;
|
|
692483
|
+
const filepath = path12.join(shareDir, filename);
|
|
692484
|
+
fs11.writeFileSync(filepath, body?.content || "");
|
|
692485
|
+
jsonResponse(res, 200, { ok: true, path: filepath, filename });
|
|
692486
|
+
} catch (err) {
|
|
692487
|
+
jsonResponse(res, 500, { error: "share_failed", message: err instanceof Error ? err.message : String(err) });
|
|
692488
|
+
}
|
|
692489
|
+
return;
|
|
692490
|
+
}
|
|
692491
|
+
if (pathname === "/v1/config/endpoint/history" && method === "GET") {
|
|
692492
|
+
const config = loadConfig();
|
|
692493
|
+
const history = config.endpointHistory || [];
|
|
692494
|
+
jsonResponse(res, 200, { history });
|
|
692495
|
+
return;
|
|
692496
|
+
}
|
|
692497
|
+
if (pathname === "/v1/voice/speak" && method === "POST") {
|
|
692498
|
+
const body = await parseJsonBody(req3);
|
|
692499
|
+
const text2 = body?.text || "";
|
|
692500
|
+
if (!text2) {
|
|
692501
|
+
jsonResponse(res, 400, { error: "missing_text" });
|
|
692502
|
+
return;
|
|
692503
|
+
}
|
|
692504
|
+
try {
|
|
692505
|
+
const { execSync: execSync62 } = require4("node:child_process");
|
|
692506
|
+
let audioPath = null;
|
|
692507
|
+
const ttsCmds = [
|
|
692508
|
+
`espeak "${text2}" -w /tmp/tts_${Date.now()}.wav 2>/dev/null`,
|
|
692509
|
+
`pico2wave -w /tmp/tts_${Date.now()}.wav "text:${text2}" 2>/dev/null`,
|
|
692510
|
+
`say "${text2}" 2>/dev/null`
|
|
692511
|
+
];
|
|
692512
|
+
for (const cmd of ttsCmds) {
|
|
692513
|
+
try {
|
|
692514
|
+
execSync62(cmd, { stdio: "pipe" });
|
|
692515
|
+
audioPath = "/tmp/tts_" + Date.now() + ".wav";
|
|
692516
|
+
break;
|
|
692517
|
+
} catch {
|
|
692518
|
+
continue;
|
|
692519
|
+
}
|
|
692520
|
+
}
|
|
692521
|
+
if (audioPath) {
|
|
692522
|
+
const fs11 = require4("node:fs");
|
|
692523
|
+
const data = fs11.readFileSync(audioPath).toString("base64");
|
|
692524
|
+
fs11.unlinkSync(audioPath);
|
|
692525
|
+
jsonResponse(res, 200, { ok: true, audio: data, format: "wav" });
|
|
692526
|
+
} else {
|
|
692527
|
+
jsonResponse(res, 500, { error: "tts_unavailable", message: "No TTS backend found" });
|
|
692528
|
+
}
|
|
692529
|
+
} catch (err) {
|
|
692530
|
+
jsonResponse(res, 500, { error: "tts_failed", message: err instanceof Error ? err.message : String(err) });
|
|
692531
|
+
}
|
|
692532
|
+
return;
|
|
692533
|
+
}
|
|
692534
|
+
if (pathname === "/v1/voice/supertonic-settings" && method === "GET") {
|
|
692535
|
+
const config = loadConfig();
|
|
692536
|
+
jsonResponse(res, 200, { settings: config.supertonicSettings || {} });
|
|
692537
|
+
return;
|
|
692538
|
+
}
|
|
692539
|
+
if (pathname === "/v1/voice/supertonic-settings" && method === "POST") {
|
|
692540
|
+
const body = await parseJsonBody(req3);
|
|
692541
|
+
const config = loadConfig();
|
|
692542
|
+
config.supertonicSettings = { ...config.supertonicSettings, ...body };
|
|
692543
|
+
try {
|
|
692544
|
+
require4("./config").saveConfig?.(config);
|
|
692545
|
+
} catch {
|
|
692546
|
+
}
|
|
692547
|
+
jsonResponse(res, 200, { ok: true, settings: config.supertonicSettings });
|
|
692548
|
+
return;
|
|
692549
|
+
}
|
|
692550
|
+
if (pathname === "/v1/voice/clone-refs" && method === "GET") {
|
|
692551
|
+
const config = loadConfig();
|
|
692552
|
+
const refs = config.voiceCloneRefs || [];
|
|
692553
|
+
jsonResponse(res, 200, { refs });
|
|
692554
|
+
return;
|
|
692555
|
+
}
|
|
692556
|
+
if (pathname === "/v1/voice/clone-refs" && method === "POST") {
|
|
692557
|
+
const body = await parseJsonBody(req3);
|
|
692558
|
+
const config = loadConfig();
|
|
692559
|
+
const refs = config.voiceCloneRefs || [];
|
|
692560
|
+
const newRef = { filename: body?.filename || body?.path || "", path: body?.path || body?.filename || "", active: false };
|
|
692561
|
+
refs.push(newRef);
|
|
692562
|
+
config.voiceCloneRefs = refs;
|
|
692563
|
+
try {
|
|
692564
|
+
require4("./config").saveConfig?.(config);
|
|
692565
|
+
} catch {
|
|
692566
|
+
}
|
|
692567
|
+
jsonResponse(res, 200, { ok: true, ref: newRef });
|
|
692568
|
+
return;
|
|
692569
|
+
}
|
|
692570
|
+
if (pathname?.startsWith("/v1/voice/clone-refs/") && pathname.endsWith("/activate") && method === "POST") {
|
|
692571
|
+
const parts = pathname.split("/");
|
|
692572
|
+
const filename = parts[4] || "";
|
|
692573
|
+
const config = loadConfig();
|
|
692574
|
+
const refs = config.voiceCloneRefs || [];
|
|
692575
|
+
const ref = refs.find((r2) => r2.filename === filename);
|
|
692576
|
+
if (ref) {
|
|
692577
|
+
ref.active = true;
|
|
692578
|
+
try {
|
|
692579
|
+
require4("./config").saveConfig?.(config);
|
|
692580
|
+
} catch {
|
|
692581
|
+
}
|
|
692582
|
+
}
|
|
692583
|
+
jsonResponse(res, 200, { ok: true, ref });
|
|
692584
|
+
return;
|
|
692585
|
+
}
|
|
692586
|
+
if (pathname?.startsWith("/v1/voice/clone-refs/") && pathname.endsWith("/rename") && method === "POST") {
|
|
692587
|
+
const parts = pathname.split("/");
|
|
692588
|
+
const filename = parts[4] || "";
|
|
692589
|
+
const body = await parseJsonBody(req3);
|
|
692590
|
+
const config = loadConfig();
|
|
692591
|
+
const refs = config.voiceCloneRefs || [];
|
|
692592
|
+
const ref = refs.find((r2) => r2.filename === filename);
|
|
692593
|
+
if (ref && body?.newFilename) {
|
|
692594
|
+
ref.filename = body.newFilename;
|
|
692595
|
+
try {
|
|
692596
|
+
require4("./config").saveConfig?.(config);
|
|
692597
|
+
} catch {
|
|
692598
|
+
}
|
|
692599
|
+
}
|
|
692600
|
+
jsonResponse(res, 200, { ok: true, ref });
|
|
692601
|
+
return;
|
|
692602
|
+
}
|
|
692603
|
+
if (pathname?.startsWith("/v1/voice/clone-refs/") && method === "DELETE") {
|
|
692604
|
+
const parts = pathname.split("/");
|
|
692605
|
+
const filename = parts[4] || "";
|
|
692606
|
+
const config = loadConfig();
|
|
692607
|
+
config.voiceCloneRefs = (config.voiceCloneRefs || []).filter((r2) => r2.filename !== filename);
|
|
692608
|
+
try {
|
|
692609
|
+
require4("./config").saveConfig?.(config);
|
|
692610
|
+
} catch {
|
|
692611
|
+
}
|
|
692612
|
+
jsonResponse(res, 200, { ok: true, deleted: filename });
|
|
692613
|
+
return;
|
|
692614
|
+
}
|
|
692424
692615
|
if ((pathname === "/v1/chat" || pathname === "/api/chat") && method === "POST") {
|
|
692425
692616
|
if (!checkAuth(req3, res, "run")) {
|
|
692426
692617
|
status = 401;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.256",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.256",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED