fluxy-bot 0.1.29 → 0.1.31
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 +1 -16
- package/package.json +1 -1
- package/supervisor/tunnel.ts +3 -1
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { spawn,
|
|
3
|
+
import { spawn, execSync } from 'child_process';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import os from 'os';
|
|
@@ -8,21 +8,6 @@ import { fileURLToPath } from 'url';
|
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
|
|
11
|
-
// Delegate to ~/.fluxy/app/ if we're not already running from there
|
|
12
|
-
const FLUXY_APP_DIR = path.join(os.homedir(), '.fluxy', 'app');
|
|
13
|
-
const FLUXY_APP_CLI = path.join(FLUXY_APP_DIR, 'bin', 'cli.js');
|
|
14
|
-
if (
|
|
15
|
-
fs.existsSync(FLUXY_APP_CLI) &&
|
|
16
|
-
path.resolve(__dirname) !== path.resolve(path.join(FLUXY_APP_DIR, 'bin'))
|
|
17
|
-
) {
|
|
18
|
-
const { status } = spawnSync(
|
|
19
|
-
process.execPath,
|
|
20
|
-
[FLUXY_APP_CLI, ...process.argv.slice(2)],
|
|
21
|
-
{ stdio: 'inherit' },
|
|
22
|
-
);
|
|
23
|
-
process.exit(status ?? 0);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
11
|
const ROOT = path.resolve(__dirname, '..');
|
|
27
12
|
const DATA_DIR = path.join(os.homedir(), '.fluxy');
|
|
28
13
|
const CONFIG_PATH = path.join(DATA_DIR, 'config.json');
|
package/package.json
CHANGED
package/supervisor/tunnel.ts
CHANGED
|
@@ -67,8 +67,10 @@ export function startTunnel(port: number): Promise<string> {
|
|
|
67
67
|
windowsHide: true,
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
+
let buf = '';
|
|
70
71
|
const onData = (d: Buffer) => {
|
|
71
|
-
|
|
72
|
+
buf += d.toString();
|
|
73
|
+
const m = buf.match(/https:\/\/[^\s]+\.trycloudflare\.com/);
|
|
72
74
|
if (m) { clearTimeout(timeout); resolve(m[0]); }
|
|
73
75
|
};
|
|
74
76
|
|