vibelet 0.1.26 → 0.1.28
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/cloudflared-quick-tunnel.mjs +11 -0
- package/bin/vibelet.mjs +4 -3
- package/dist/index.cjs +43 -43
- package/package.json +2 -19
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const QUICK_TUNNEL_URL_PATTERN = /https:\/\/[a-z0-9-]+\.trycloudflare\.com(?=$|[\s"',)\]])/g;
|
|
2
|
+
|
|
3
|
+
export function extractQuickTunnelUrl(logContent) {
|
|
4
|
+
if (typeof logContent !== 'string' || logContent.length === 0) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const match = QUICK_TUNNEL_URL_PATTERN.exec(logContent);
|
|
9
|
+
QUICK_TUNNEL_URL_PATTERN.lastIndex = 0;
|
|
10
|
+
return match?.[0] ?? null;
|
|
11
|
+
}
|
package/bin/vibelet.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { homedir } from 'node:os';
|
|
|
6
6
|
import { dirname, join, resolve } from 'node:path';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import QRCode from 'qrcode';
|
|
9
|
+
import { extractQuickTunnelUrl } from './cloudflared-quick-tunnel.mjs';
|
|
9
10
|
import { resolveCloudflaredBin } from './cloudflared-resolver.mjs';
|
|
10
11
|
import { shouldReuseHealthyDaemon } from './vibelet-runtime-policy.mjs';
|
|
11
12
|
|
|
@@ -748,9 +749,9 @@ function startTunnel() {
|
|
|
748
749
|
const poll = setInterval(() => {
|
|
749
750
|
try {
|
|
750
751
|
const content = readFileSync(logPath, 'utf8');
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
url =
|
|
752
|
+
const tunnelUrl = extractQuickTunnelUrl(content);
|
|
753
|
+
if (tunnelUrl) {
|
|
754
|
+
url = tunnelUrl;
|
|
754
755
|
clearInterval(poll);
|
|
755
756
|
clearTimeout(timeout);
|
|
756
757
|
saveTunnelState(pid, url);
|