@syengup/friday-channel-next 0.0.14 → 0.0.16
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/install.js +18 -3
- package/install.sh +27 -3
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -59,6 +59,15 @@ if (!PKG) {
|
|
|
59
59
|
process.exit(1);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
// Auto-detect best registry (if npmjs.org is unreachable, use npmmirror)
|
|
63
|
+
let registryFlag = "";
|
|
64
|
+
try {
|
|
65
|
+
execSync('curl -s --connect-timeout 3 --max-time 5 https://registry.npmjs.org/ >/dev/null 2>&1');
|
|
66
|
+
} catch {
|
|
67
|
+
warn("Default registry unreachable, using https://registry.npmmirror.com");
|
|
68
|
+
registryFlag = "--registry=https://registry.npmmirror.com";
|
|
69
|
+
}
|
|
70
|
+
|
|
62
71
|
if (!existsSync(OPENCLAW_CONFIG)) {
|
|
63
72
|
err(`OpenClaw config not found at ${OPENCLAW_CONFIG}`);
|
|
64
73
|
err("Make sure OpenClaw is installed and has been run at least once.");
|
|
@@ -94,7 +103,7 @@ process.chdir(PLUGIN_DIR);
|
|
|
94
103
|
// --------------- install + build ---------------
|
|
95
104
|
|
|
96
105
|
log("Installing dependencies...");
|
|
97
|
-
execSync(`${PKG} install`, { stdio: "inherit" });
|
|
106
|
+
execSync(`${PKG} install ${registryFlag}`, { stdio: "inherit" });
|
|
98
107
|
|
|
99
108
|
log("Building TypeScript...");
|
|
100
109
|
execSync(`${PKG} run build`, { stdio: "inherit" });
|
|
@@ -226,14 +235,20 @@ async function verifyGateway(url, token, retries = 6) {
|
|
|
226
235
|
}
|
|
227
236
|
|
|
228
237
|
log("Verifying gateway...");
|
|
229
|
-
await verifyGateway(gatewayUrl, gatewayToken);
|
|
238
|
+
const verified = await verifyGateway(gatewayUrl, gatewayToken);
|
|
230
239
|
|
|
231
240
|
// --------------- show connection info ---------------
|
|
232
241
|
|
|
233
242
|
const BOLD_YELLOW = (s) => `\x1b[1;33m${s}\x1b[0m`;
|
|
234
243
|
|
|
235
244
|
log("--------------------------------------------------");
|
|
236
|
-
|
|
245
|
+
if (verified) {
|
|
246
|
+
log("Installation complete! Friday Next channel is now active.");
|
|
247
|
+
} else {
|
|
248
|
+
warn("Installation complete, but gateway verification failed.");
|
|
249
|
+
warn("Check 'openclaw gateway status' and restart the gateway if needed.");
|
|
250
|
+
warn("Also ensure OpenClaw is updated to 2026.5.7 or above: openclaw update");
|
|
251
|
+
}
|
|
237
252
|
log("");
|
|
238
253
|
|
|
239
254
|
// --------------- QR code ---------------
|
package/install.sh
CHANGED
|
@@ -39,6 +39,14 @@ else
|
|
|
39
39
|
exit 1
|
|
40
40
|
fi
|
|
41
41
|
|
|
42
|
+
# Auto-detect best registry (if npmjs.org is unreachable, use npmmirror)
|
|
43
|
+
if curl -s --connect-timeout 3 https://registry.npmjs.org/ >/dev/null 2>&1; then
|
|
44
|
+
REGISTRY=""
|
|
45
|
+
else
|
|
46
|
+
warn "Default registry unreachable, using https://registry.npmmirror.com"
|
|
47
|
+
REGISTRY="--registry=https://registry.npmmirror.com"
|
|
48
|
+
fi
|
|
49
|
+
|
|
42
50
|
if [ ! -f "$OPENCLAW_CONFIG" ]; then
|
|
43
51
|
err "OpenClaw config not found at $OPENCLAW_CONFIG"
|
|
44
52
|
err "Make sure OpenClaw is installed and has been run at least once."
|
|
@@ -58,7 +66,7 @@ fi
|
|
|
58
66
|
cd "$PLUGIN_DIR"
|
|
59
67
|
|
|
60
68
|
log "Installing dependencies..."
|
|
61
|
-
$PKG install
|
|
69
|
+
$PKG install $REGISTRY
|
|
62
70
|
|
|
63
71
|
log "Building TypeScript..."
|
|
64
72
|
$PKG run build
|
|
@@ -121,6 +129,7 @@ openclaw gateway restart
|
|
|
121
129
|
|
|
122
130
|
# Verify gateway is up
|
|
123
131
|
log "Verifying gateway..."
|
|
132
|
+
VERIFY_LOG=$(mktemp)
|
|
124
133
|
node --input-type=module -e '
|
|
125
134
|
import { readFileSync } from "node:fs";
|
|
126
135
|
import { networkInterfaces } from "node:os";
|
|
@@ -143,6 +152,7 @@ const token = config.gateway?.auth?.token || "";
|
|
|
143
152
|
const bind = config.gateway?.bind || "localhost";
|
|
144
153
|
const host = bind === "lan" ? getLanIp() : "127.0.0.1";
|
|
145
154
|
|
|
155
|
+
let ok = false;
|
|
146
156
|
async function verifyGateway() {
|
|
147
157
|
for (let i = 1; i <= 6; i++) {
|
|
148
158
|
await new Promise((r) => setTimeout(r, 1000));
|
|
@@ -162,6 +172,7 @@ async function verifyGateway() {
|
|
|
162
172
|
const data = JSON.parse(res.body);
|
|
163
173
|
if (data.ok) {
|
|
164
174
|
console.log(" Gateway verified OK (friday-next " + data.version + ", " + data.connections + " connections).");
|
|
175
|
+
ok = true;
|
|
165
176
|
return;
|
|
166
177
|
}
|
|
167
178
|
console.log(" ! Plugin responded but ok=false — " + JSON.stringify(data));
|
|
@@ -193,7 +204,14 @@ async function verifyGateway() {
|
|
|
193
204
|
console.log(" ! Gateway verification timed out — check '\''openclaw gateway status'\'' manually.");
|
|
194
205
|
}
|
|
195
206
|
await verifyGateway();
|
|
196
|
-
|
|
207
|
+
console.log(ok ? "VERIFY_OK" : "VERIFY_FAIL");
|
|
208
|
+
' "$OPENCLAW_CONFIG" 2>&1 | tee "$VERIFY_LOG"
|
|
209
|
+
if grep -q "VERIFY_OK" "$VERIFY_LOG"; then
|
|
210
|
+
VERIFY_PASS=1
|
|
211
|
+
else
|
|
212
|
+
VERIFY_PASS=0
|
|
213
|
+
fi
|
|
214
|
+
rm -f "$VERIFY_LOG"
|
|
197
215
|
|
|
198
216
|
# Show connection info
|
|
199
217
|
node --input-type=module -e '
|
|
@@ -267,5 +285,11 @@ if (classifyIp(host) === "tailscale") {
|
|
|
267
285
|
' "$OPENCLAW_CONFIG"
|
|
268
286
|
|
|
269
287
|
log "--------------------------------------------------"
|
|
270
|
-
|
|
288
|
+
if [ "$VERIFY_PASS" = "1" ]; then
|
|
289
|
+
log "Installation complete! Friday Next channel is now active."
|
|
290
|
+
else
|
|
291
|
+
warn "Installation complete, but gateway verification failed."
|
|
292
|
+
warn "Check 'openclaw gateway status' and restart the gateway if needed."
|
|
293
|
+
warn "Also ensure OpenClaw is updated to 2026.5.7 or above: openclaw update"
|
|
294
|
+
fi
|
|
271
295
|
log "--------------------------------------------------"
|