softpeach-cli 1.0.1 → 1.0.3
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/softpeach.mjs +18 -6
- package/package.json +1 -1
package/bin/softpeach.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { tunnel } from "cloudflared";
|
|
|
4
4
|
import { execSync } from "child_process";
|
|
5
5
|
import { randomBytes } from "crypto";
|
|
6
6
|
|
|
7
|
-
const SOFTPEACH_URL = process.env.SOFTPEACH_URL || "https://softpeach.onrender.com";
|
|
7
|
+
const SOFTPEACH_URL = process.env.SOFTPEACH_URL || "https://softpeach-w2zu.onrender.com";
|
|
8
8
|
|
|
9
9
|
function printBanner() {
|
|
10
10
|
console.log("");
|
|
@@ -102,11 +102,23 @@ async function main() {
|
|
|
102
102
|
|
|
103
103
|
const tunnelUrl = await url;
|
|
104
104
|
|
|
105
|
-
// Wait for
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
// Wait for tunnel to be actually routable before opening browser
|
|
106
|
+
console.log(` \x1b[36m⟳\x1b[0m Waiting for tunnel to be reachable...`);
|
|
107
|
+
let tunnelReady = false;
|
|
108
|
+
for (let i = 0; i < 15; i++) {
|
|
109
|
+
try {
|
|
110
|
+
const check = await fetch(tunnelUrl, { signal: AbortSignal.timeout(3000), redirect: "follow" });
|
|
111
|
+
if (check.ok || check.status < 500) {
|
|
112
|
+
tunnelReady = true;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
} catch {}
|
|
116
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!tunnelReady) {
|
|
120
|
+
console.log(` \x1b[33m⚠\x1b[0m Tunnel URL may not be ready yet, opening anyway...`);
|
|
121
|
+
}
|
|
110
122
|
|
|
111
123
|
console.log(` \x1b[32m✓\x1b[0m Tunnel ready: \x1b[4m${tunnelUrl}\x1b[0m`);
|
|
112
124
|
console.log("");
|