freertc 0.1.28 → 0.1.31
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/README.md +1 -1
- package/bin/freertc.mjs +15 -7
- package/package.json +1 -1
- package/scripts/non-cloudflare-server.mjs +1 -1
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -216,7 +216,7 @@ Quick checks:
|
|
|
216
216
|
Expected `/health` response includes JSON like:
|
|
217
217
|
|
|
218
218
|
```json
|
|
219
|
-
{"ok":true,"version":"0.1.
|
|
219
|
+
{"ok":true,"version":"0.1.31","protocol_version":"1.0","peers":0}
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
## Auto WebRTC two-tab test
|
package/bin/freertc.mjs
CHANGED
|
@@ -149,7 +149,7 @@ function extractCurrentWorkerName(configText) {
|
|
|
149
149
|
|
|
150
150
|
function extractDeployHost(configPath) {
|
|
151
151
|
const text = fs.readFileSync(configPath, 'utf8');
|
|
152
|
-
return
|
|
152
|
+
return extractRouteHost(text) || extractDatabaseDomainHost(text) || extractRelayUrlHost(text) || extractGlobalRelayUrlHost(text);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
function extractGlobalRelayUrlHost(configText) {
|
|
@@ -183,19 +183,24 @@ function extractDatabaseDomainHost(configText) {
|
|
|
183
183
|
function autoPatchWranglerConfig(configPath) {
|
|
184
184
|
let text = fs.readFileSync(configPath, 'utf8');
|
|
185
185
|
|
|
186
|
-
const
|
|
186
|
+
const dbDomainHost = extractDatabaseDomainHost(text);
|
|
187
187
|
const routeHost = extractRouteHost(text);
|
|
188
|
+
const relayUrlHost = extractRelayUrlHost(text);
|
|
189
|
+
const globalRelayHost = extractGlobalRelayUrlHost(text);
|
|
190
|
+
const publicHost = dbDomainHost || routeHost || relayUrlHost || globalRelayHost;
|
|
188
191
|
const envDomainCandidate = normalizeHost(process.env.CF_DOMAIN || process.env.CLOUD_FLARE_DOMAIN || '');
|
|
189
192
|
const envDomainHost = envDomainCandidate && !isPlaceholderHost(envDomainCandidate) ? envDomainCandidate : null;
|
|
190
|
-
const
|
|
193
|
+
const baseRelayDomain = dbDomainHost || routeHost || envDomainHost || relayUrlHost || globalRelayHost;
|
|
191
194
|
|
|
192
|
-
if (!
|
|
195
|
+
if (!baseRelayDomain) {
|
|
193
196
|
return;
|
|
194
197
|
}
|
|
195
198
|
|
|
199
|
+
const relayHost = baseRelayDomain;
|
|
200
|
+
|
|
196
201
|
const relayWsUrl = `wss://${relayHost}/ws`;
|
|
197
202
|
const relayName = relayHost;
|
|
198
|
-
const dbName = `freertc-signal-${sanitizeDomain(
|
|
203
|
+
const dbName = `freertc-signal-${sanitizeDomain(dbDomainHost || baseRelayDomain)}`;
|
|
199
204
|
|
|
200
205
|
const before = text;
|
|
201
206
|
text = patchJsoncVar(text, 'RELAY_URL', relayWsUrl);
|
|
@@ -250,8 +255,11 @@ function validateWranglerConfigForDeploy(configPath) {
|
|
|
250
255
|
|
|
251
256
|
function extractRouteConflictOwner(outputText) {
|
|
252
257
|
if (!outputText) return null;
|
|
253
|
-
const
|
|
254
|
-
|
|
258
|
+
const usedByMatch = outputText.match(/used by Worker:\s*([A-Za-z0-9._-]+)/i);
|
|
259
|
+
if (usedByMatch?.[1]) return usedByMatch[1];
|
|
260
|
+
|
|
261
|
+
const assignedMatch = outputText.match(/"([A-Za-z0-9._-]+)"\s+is already assigned to routes:/i);
|
|
262
|
+
return assignedMatch?.[1] || null;
|
|
255
263
|
}
|
|
256
264
|
|
|
257
265
|
function patchWranglerScriptName(configPath, workerName) {
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
7
|
import { WebSocketServer } from 'ws';
|
|
8
8
|
|
|
9
9
|
const PSP_VERSION = '1.0';
|
|
10
|
-
const WORKER_VERSION = '0.1.
|
|
10
|
+
const WORKER_VERSION = '0.1.31';
|
|
11
11
|
const DEFAULT_TTL_MS = 30_000;
|
|
12
12
|
const MAX_TTL_MS = 120_000;
|
|
13
13
|
const MAX_MESSAGE_SIZE = 64 * 1024;
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const PSP_VERSION = "1.0";
|
|
2
|
-
const WORKER_VERSION = "0.1.
|
|
2
|
+
const WORKER_VERSION = "0.1.31";
|
|
3
3
|
|
|
4
4
|
const DISCOVERY_TYPES = new Set(["announce", "withdraw", "discover", "peer_list", "redirect"]);
|
|
5
5
|
const NEGOTIATION_TYPES = new Set(["connect_request", "connect_accept", "connect_reject", "offer", "answer", "ice_candidate", "ice_end", "renegotiate"]);
|