fluxy-bot 0.5.34 → 0.5.36
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/cli.js +27 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -217,6 +217,12 @@ function finalMessage(tunnelUrl, relayUrl) {
|
|
|
217
217
|
|
|
218
218
|
console.log(`
|
|
219
219
|
${c.dim}─────────────────────────────────${c.reset}
|
|
220
|
+
|
|
221
|
+
${c.bold}${c.white}Commands:${c.reset}
|
|
222
|
+
${c.dim}Status${c.reset} ${c.pink}fluxy status${c.reset}
|
|
223
|
+
${c.dim}Update${c.reset} ${c.pink}fluxy update${c.reset}${os.platform() === 'linux' ? `
|
|
224
|
+
${c.dim}Daemon${c.reset} ${c.pink}fluxy daemon${c.reset}` : ''}
|
|
225
|
+
|
|
220
226
|
${c.dim}Press Ctrl+C to stop the bot${c.reset}
|
|
221
227
|
`);
|
|
222
228
|
}
|
|
@@ -485,6 +491,25 @@ async function start() {
|
|
|
485
491
|
stepper.finish();
|
|
486
492
|
finalMessage(tunnelUrl, relayUrl);
|
|
487
493
|
|
|
494
|
+
// Offer daemon install on Linux if not already installed
|
|
495
|
+
if (os.platform() === 'linux' && !isServiceInstalled() && process.stdin.isTTY) {
|
|
496
|
+
try {
|
|
497
|
+
const answer = await askQuestion(` ${c.bold}Install as a system daemon (auto-start on boot)?${c.reset} ${c.dim}[Y/n]${c.reset} `);
|
|
498
|
+
if (!answer || answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
|
|
499
|
+
console.log(`\n ${c.dim}Stopping foreground server...${c.reset}`);
|
|
500
|
+
child.kill('SIGTERM');
|
|
501
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
502
|
+
const nodePath = process.execPath;
|
|
503
|
+
const realHome = os.homedir();
|
|
504
|
+
const result = spawnSync(process.execPath, [process.argv[1], 'daemon', 'install'], {
|
|
505
|
+
stdio: 'inherit',
|
|
506
|
+
env: { ...process.env, FLUXY_NODE_PATH: nodePath, FLUXY_REAL_HOME: realHome },
|
|
507
|
+
});
|
|
508
|
+
process.exit(result.status ?? 0);
|
|
509
|
+
}
|
|
510
|
+
} catch {}
|
|
511
|
+
}
|
|
512
|
+
|
|
488
513
|
child.stdout.on('data', (d) => {
|
|
489
514
|
process.stdout.write(` ${c.dim}${d.toString().trim()}${c.reset}\n`);
|
|
490
515
|
});
|
|
@@ -500,14 +525,14 @@ async function status() {
|
|
|
500
525
|
const config = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf-8'));
|
|
501
526
|
const res = await fetch(`http://localhost:${config.port}/api/health`);
|
|
502
527
|
const data = await res.json();
|
|
503
|
-
console.log(`\n ${c.blue}●${c.reset}
|
|
528
|
+
console.log(`\n ${c.blue}●${c.reset} Fluxy is running`);
|
|
504
529
|
console.log(` ${c.dim}Uptime: ${data.uptime}s${c.reset}`);
|
|
505
530
|
if (config.relay?.url) {
|
|
506
531
|
console.log(` ${c.dim}URL: ${c.reset}${c.pink}${link(config.relay.url)}${c.reset}`);
|
|
507
532
|
}
|
|
508
533
|
console.log(` ${c.dim}Config: ${CONFIG_PATH}${c.reset}\n`);
|
|
509
534
|
} catch {
|
|
510
|
-
console.log(`\n ${c.dim}●${c.reset}
|
|
535
|
+
console.log(`\n ${c.dim}●${c.reset} Fluxy is not running.\n`);
|
|
511
536
|
}
|
|
512
537
|
}
|
|
513
538
|
|