arisa 2.1.5 → 2.1.7
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/bin/arisa.js +25 -3
- package/package.json +1 -1
package/bin/arisa.js
CHANGED
|
@@ -417,6 +417,13 @@ function isProvisioned() {
|
|
|
417
417
|
return arisaUserExists() && existsSync("/home/arisa/.bun/bin/bun");
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
+
function isArisaConfigured() {
|
|
421
|
+
const envPath = "/home/arisa/.arisa/.env";
|
|
422
|
+
if (!existsSync(envPath)) return false;
|
|
423
|
+
const content = readFileSync(envPath, "utf8");
|
|
424
|
+
return content.includes("TELEGRAM_BOT_TOKEN=");
|
|
425
|
+
}
|
|
426
|
+
|
|
420
427
|
function detectSudoGroup() {
|
|
421
428
|
// Debian/Ubuntu use 'sudo', RHEL/Fedora use 'wheel'
|
|
422
429
|
const sudoGroup = spawnSync("getent", ["group", "sudo"], { stdio: "ignore" });
|
|
@@ -568,7 +575,7 @@ if (isRoot()) {
|
|
|
568
575
|
step(true, "Systemd service enabled (auto-starts on reboot)");
|
|
569
576
|
|
|
570
577
|
process.stdout.write("\nStarting interactive setup as user arisa...\n\n");
|
|
571
|
-
const su = spawnSync("su", ["-", "arisa", "-c", "/home/arisa/.bun/bin/arisa"], {
|
|
578
|
+
const su = spawnSync("su", ["-", "arisa", "-c", "/home/arisa/.bun/bin/bun /home/arisa/arisa/src/daemon/index.ts"], {
|
|
572
579
|
stdio: "inherit",
|
|
573
580
|
});
|
|
574
581
|
|
|
@@ -593,8 +600,23 @@ Arisa management:
|
|
|
593
600
|
process.exit(0);
|
|
594
601
|
}
|
|
595
602
|
|
|
596
|
-
// No args → systemd
|
|
603
|
+
// No args → interactive setup if not configured, otherwise systemd
|
|
597
604
|
if (isDefaultInvocation) {
|
|
605
|
+
if (!isArisaConfigured()) {
|
|
606
|
+
process.stdout.write("Arisa is not configured yet. Starting interactive setup...\n\n");
|
|
607
|
+
const su = spawnSync("su", ["-", "arisa", "-c", "/home/arisa/.bun/bin/bun /home/arisa/arisa/src/daemon/index.ts"], {
|
|
608
|
+
stdio: "inherit",
|
|
609
|
+
});
|
|
610
|
+
process.stdout.write(`
|
|
611
|
+
Arisa management:
|
|
612
|
+
Start: systemctl start arisa
|
|
613
|
+
Status: systemctl status arisa
|
|
614
|
+
Logs: journalctl -u arisa -f
|
|
615
|
+
Restart: systemctl restart arisa
|
|
616
|
+
Stop: systemctl stop arisa
|
|
617
|
+
`);
|
|
618
|
+
process.exit(su.status ?? 0);
|
|
619
|
+
}
|
|
598
620
|
if (isSystemdActive()) {
|
|
599
621
|
process.exit(statusSystemdSystem());
|
|
600
622
|
} else {
|
|
@@ -618,7 +640,7 @@ Arisa management:
|
|
|
618
640
|
case "daemon":
|
|
619
641
|
case "run": {
|
|
620
642
|
// Explicit "arisa daemon/run" → foreground as arisa user
|
|
621
|
-
const su = spawnSync("su", ["-", "arisa", "-c", "/home/arisa/.bun/bin/arisa"], {
|
|
643
|
+
const su = spawnSync("su", ["-", "arisa", "-c", "/home/arisa/.bun/bin/bun /home/arisa/arisa/src/daemon/index.ts"], {
|
|
622
644
|
stdio: "inherit",
|
|
623
645
|
});
|
|
624
646
|
process.exit(su.status ?? 1);
|