multiclaws 0.4.12 → 0.4.13
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/dist/infra/frp.js +8 -6
- package/package.json +1 -1
package/dist/infra/frp.js
CHANGED
|
@@ -233,7 +233,9 @@ class FrpTunnelManager {
|
|
|
233
233
|
}
|
|
234
234
|
/* ── Private: poll admin API ──────────────────────────────────── */
|
|
235
235
|
async waitForProxy(proxyName) {
|
|
236
|
-
|
|
236
|
+
// frpc 0.61.x uses /api/status (returns { tcp: [...], udp: [...], ... })
|
|
237
|
+
// older versions used /api/proxy/tcp (returns flat array or { proxies: [...] })
|
|
238
|
+
const statusUrl = `http://127.0.0.1:${this.adminPort}/api/status`;
|
|
237
239
|
for (let attempt = 0; attempt < ADMIN_API_POLL_MAX_RETRIES; attempt++) {
|
|
238
240
|
await new Promise((r) => setTimeout(r, ADMIN_API_POLL_INTERVAL_MS));
|
|
239
241
|
// Check if process has already exited
|
|
@@ -241,13 +243,13 @@ class FrpTunnelManager {
|
|
|
241
243
|
throw new Error("frpc process exited before proxy became ready");
|
|
242
244
|
}
|
|
243
245
|
try {
|
|
244
|
-
const res = await fetch(
|
|
246
|
+
const res = await fetch(statusUrl, { signal: AbortSignal.timeout(3_000) });
|
|
245
247
|
if (!res.ok)
|
|
246
248
|
continue;
|
|
247
|
-
// frpc 0.61.x admin API returns a flat array: [{name, status, ...}]
|
|
248
249
|
const data = (await res.json());
|
|
249
|
-
|
|
250
|
-
const
|
|
250
|
+
// /api/status groups proxies by type: { tcp: [...], udp: [...], ... }
|
|
251
|
+
const tcpProxies = data.tcp ?? [];
|
|
252
|
+
const proxy = tcpProxies.find((p) => p.name === proxyName);
|
|
251
253
|
if (!proxy)
|
|
252
254
|
continue;
|
|
253
255
|
if (proxy.status === "running") {
|
|
@@ -274,7 +276,7 @@ class FrpTunnelManager {
|
|
|
274
276
|
if (this._status.status !== "running")
|
|
275
277
|
return;
|
|
276
278
|
try {
|
|
277
|
-
const res = await fetch(`http://127.0.0.1:${this.adminPort}/api/
|
|
279
|
+
const res = await fetch(`http://127.0.0.1:${this.adminPort}/api/status`, { signal: AbortSignal.timeout(5_000) });
|
|
278
280
|
if (!res.ok) {
|
|
279
281
|
this.logger.warn("[frp] health check: admin API returned non-OK");
|
|
280
282
|
this._status = { status: "error", reason: "admin API returned non-OK status" };
|