@syengup/friday-channel-next 0.0.9 → 0.0.11

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.
Files changed (3) hide show
  1. package/install.js +45 -8
  2. package/install.sh +41 -7
  3. package/package.json +1 -1
package/install.js CHANGED
@@ -181,15 +181,38 @@ async function verifyGateway(url, token, retries = 6) {
181
181
  req.end();
182
182
  });
183
183
  if (res.status === 200) {
184
- const data = JSON.parse(res.body);
185
- if (data.ok) {
186
- log("Gateway verified OK (friday-next " + data.version + ", " + data.connections + " connections).");
187
- return true;
184
+ try {
185
+ const data = JSON.parse(res.body);
186
+ if (data.ok) {
187
+ log("Gateway verified OK (friday-next " + data.version + ", " + data.connections + " connections).");
188
+ return true;
189
+ }
190
+ warn("Plugin responded but ok=false — " + JSON.stringify(data));
191
+ return false;
192
+ } catch {
193
+ // body is not JSON (e.g. HTML control panel) — plugin route not registered yet
194
+ if (i < 3) {
195
+ warn(`Plugin routes not registered yet, retrying (${i}/${retries})...`);
196
+ } else if (i < retries) {
197
+ warn(`Gateway is up but plugin routes missing — may need config reload, retrying (${i}/${retries})...`);
198
+ } else {
199
+ warn("Gateway is running but plugin routes were not loaded. Check plugin config in openclaw.json.");
200
+ }
201
+ continue;
188
202
  }
189
203
  }
204
+ if (res.status === 401) {
205
+ warn("Auth token mismatch — check gateway.auth.token in openclaw.json.");
206
+ return false;
207
+ }
208
+ if (res.status === 404) {
209
+ warn("Route /friday-next/status not found — plugin may not be loaded.");
210
+ return false;
211
+ }
190
212
  if (i < retries) warn(`Gateway responded ${res.status}, retrying (${i}/${retries})...`);
191
213
  } catch {
192
- if (i < retries) warn(`Gateway not ready, retrying (${i}/${retries})...`);
214
+ // Connection refused / timeout — gateway not running yet
215
+ if (i < retries) warn(`Gateway not reachable, retrying (${i}/${retries})...`);
193
216
  }
194
217
  }
195
218
  warn("Gateway verification timed out — check 'openclaw gateway status' manually.");
@@ -237,7 +260,21 @@ log("");
237
260
  log("Gateway URL: " + BOLD_YELLOW(gatewayUrl));
238
261
  log("Bearer Token: " + BOLD_YELLOW(gatewayToken));
239
262
  log("");
240
- log("This is a LOCAL network URL (bind=" + bindMode + ").");
241
- log("If you need a public URL for remote access, configure it");
242
- log("via HTTPS, Tailscale, or a reverse proxy yourself.");
263
+ function isPrivateIp(ip) {
264
+ const parts = ip.split(".").map(Number);
265
+ if (parts[0] === 127) return true; // loopback
266
+ if (parts[0] === 10) return true; // RFC 1918
267
+ if (parts[0] === 172 && parts[1] >= 16 && parts[1] <= 31) return true; // RFC 1918
268
+ if (parts[0] === 192 && parts[1] === 168) return true; // RFC 1918
269
+ if (parts[0] === 169 && parts[1] === 254) return true; // link-local
270
+ if (parts[0] === 100 && parts[1] >= 64 && parts[1] <= 127) return true; // CGNAT / Tailscale
271
+ return false;
272
+ }
273
+ const ip = new URL(gatewayUrl).hostname;
274
+ if (isPrivateIp(ip)) {
275
+ log("This is a LOCAL network URL (" + ip + ", bind=" + bindMode + ").");
276
+ log("If you need public access, configure HTTPS, Tailscale, or a reverse proxy.");
277
+ } else {
278
+ log("This URL appears to be publicly accessible (" + ip + ").");
279
+ }
243
280
  log("--------------------------------------------------");
package/install.sh CHANGED
@@ -148,15 +148,36 @@ async function verifyGateway() {
148
148
  req.end();
149
149
  });
150
150
  if (res.status === 200) {
151
- const data = JSON.parse(res.body);
152
- if (data.ok) {
153
- console.log(" Gateway verified OK (friday-next " + data.version + ", " + data.connections + " connections).");
151
+ try {
152
+ const data = JSON.parse(res.body);
153
+ if (data.ok) {
154
+ console.log(" Gateway verified OK (friday-next " + data.version + ", " + data.connections + " connections).");
155
+ return;
156
+ }
157
+ console.log(" ! Plugin responded but ok=false — " + JSON.stringify(data));
154
158
  return;
159
+ } catch {
160
+ if (i < 3) {
161
+ console.log(" ! Plugin routes not registered yet, retrying (" + i + "/6)...");
162
+ } else if (i < 6) {
163
+ console.log(" ! Gateway is up but plugin routes missing — may need config reload, retrying (" + i + "/6)...");
164
+ } else {
165
+ console.log(" ! Gateway is running but plugin routes were not loaded. Check plugin config in openclaw.json.");
166
+ }
167
+ continue;
155
168
  }
156
169
  }
170
+ if (res.status === 401) {
171
+ console.log(" ! Auth token mismatch — check gateway.auth.token in openclaw.json.");
172
+ return;
173
+ }
174
+ if (res.status === 404) {
175
+ console.log(" ! Route /friday-next/status not found — plugin may not be loaded.");
176
+ return;
177
+ }
157
178
  if (i < 6) console.log(" ! Gateway responded " + res.status + ", retrying (" + i + "/6)...");
158
179
  } catch {
159
- if (i < 6) console.log(" ! Gateway not ready, retrying (" + i + "/6)...");
180
+ if (i < 6) console.log(" ! Gateway not reachable, retrying (" + i + "/6)...");
160
181
  }
161
182
  }
162
183
  console.log(" ! Gateway verification timed out — check '\''openclaw gateway status'\'' manually.");
@@ -211,9 +232,22 @@ console.log("");
211
232
  console.log("Gateway URL: " + YB + "http://" + host + ":" + port + N);
212
233
  console.log("Bearer Token: " + YB + token + N);
213
234
  console.log("");
214
- console.log("This is a LOCAL network URL (bind=" + bind + ").");
215
- console.log("If you need a public URL for remote access, configure it");
216
- console.log("via HTTPS, Tailscale, or a reverse proxy yourself.");
235
+ function isPrivateIp(ip) {
236
+ var p = ip.split(".").map(Number);
237
+ if (p[0] === 127) return true;
238
+ if (p[0] === 10) return true;
239
+ if (p[0] === 172 && p[1] >= 16 && p[1] <= 31) return true;
240
+ if (p[0] === 192 && p[1] === 168) return true;
241
+ if (p[0] === 169 && p[1] === 254) return true;
242
+ if (p[0] === 100 && p[1] >= 64 && p[1] <= 127) return true;
243
+ return false;
244
+ }
245
+ if (isPrivateIp(host)) {
246
+ console.log("This is a LOCAL network URL (" + host + ", bind=" + bind + ").");
247
+ console.log("If you need public access, configure HTTPS, Tailscale, or a reverse proxy.");
248
+ } else {
249
+ console.log("This URL appears to be publicly accessible (" + host + ").");
250
+ }
217
251
  ' "$OPENCLAW_CONFIG"
218
252
 
219
253
  log "--------------------------------------------------"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syengup/friday-channel-next",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "OpenClaw Friday Next Apple channel plugin",
5
5
  "type": "module",
6
6
  "files": [