freertc 0.1.3 → 0.1.5
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
CHANGED
package/bin/freertc.mjs
CHANGED
|
@@ -34,7 +34,7 @@ Examples:
|
|
|
34
34
|
|
|
35
35
|
function runInProject(command, args, { bootstrap = false } = {}) {
|
|
36
36
|
if (bootstrap) {
|
|
37
|
-
ensureProjectFiles(PROJECT_ROOT
|
|
37
|
+
ensureProjectFiles(PROJECT_ROOT);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const result = spawnSync(command, args, {
|
|
@@ -87,7 +87,7 @@ if (subcommand === 'init' || subcommand === 'install') {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
if (subcommand === 'deploy') {
|
|
90
|
-
ensureProjectFiles(PROJECT_ROOT
|
|
90
|
+
ensureProjectFiles(PROJECT_ROOT);
|
|
91
91
|
requireWranglerConfig();
|
|
92
92
|
const wrangler = resolveWranglerCommand(PROJECT_ROOT);
|
|
93
93
|
runInProject(wrangler.command, [...wrangler.baseArgs, 'deploy', '--env', 'production', ...rest]);
|
package/package.json
CHANGED
|
@@ -7,6 +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.4';
|
|
10
11
|
const DEFAULT_TTL_MS = 30_000;
|
|
11
12
|
const MAX_TTL_MS = 120_000;
|
|
12
13
|
const MAX_MESSAGE_SIZE = 64 * 1024;
|
|
@@ -387,7 +388,12 @@ const server = createServer((req, res) => {
|
|
|
387
388
|
|
|
388
389
|
const reqUrl = new URL(req.url, `http://${req.headers.host || 'localhost'}`);
|
|
389
390
|
if (reqUrl.pathname === '/health') {
|
|
390
|
-
json(res, {
|
|
391
|
+
json(res, {
|
|
392
|
+
ok: true,
|
|
393
|
+
version: WORKER_VERSION,
|
|
394
|
+
protocol_version: PSP_VERSION,
|
|
395
|
+
peers: livePeers.size,
|
|
396
|
+
}, 200);
|
|
391
397
|
return;
|
|
392
398
|
}
|
|
393
399
|
|
|
@@ -59,17 +59,7 @@ export function resolveProjectRoot(startDir = process.cwd()) {
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
function
|
|
63
|
-
if (!fs.existsSync(sourcePath) || !fs.existsSync(targetPath)) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const source = fs.readFileSync(sourcePath);
|
|
68
|
-
const target = fs.readFileSync(targetPath);
|
|
69
|
-
return source.equals(target);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function ensureProjectFiles(projectRoot, { updateExisting = false } = {}) {
|
|
62
|
+
export function ensureProjectFiles(projectRoot) {
|
|
73
63
|
const targetRoot = path.resolve(projectRoot);
|
|
74
64
|
if (targetRoot === PACKAGE_ROOT) {
|
|
75
65
|
return [];
|
|
@@ -85,10 +75,6 @@ export function ensureProjectFiles(projectRoot, { updateExisting = false } = {})
|
|
|
85
75
|
continue;
|
|
86
76
|
}
|
|
87
77
|
|
|
88
|
-
if (fs.existsSync(targetPath) && (!updateExisting || filesMatch(sourcePath, targetPath))) {
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
78
|
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
93
79
|
fs.copyFileSync(sourcePath, targetPath);
|
|
94
80
|
synced.push(targetRelativePath);
|
|
@@ -402,7 +402,7 @@ async function main() {
|
|
|
402
402
|
const forcedMode = modeFromArgs(process.argv);
|
|
403
403
|
|
|
404
404
|
try {
|
|
405
|
-
const copiedFiles = ensureProjectFiles(ROOT
|
|
405
|
+
const copiedFiles = ensureProjectFiles(ROOT);
|
|
406
406
|
|
|
407
407
|
console.log(`\n${PROJECT_NAME} Wrangler Install Wizard\n`);
|
|
408
408
|
console.log(`Using project root: ${ROOT}`);
|
|
@@ -416,7 +416,7 @@ async function main() {
|
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
if (copiedFiles.length > 0) {
|
|
419
|
-
console.log('
|
|
419
|
+
console.log('Overwrote package-managed files in this project:');
|
|
420
420
|
for (const file of copiedFiles) {
|
|
421
421
|
console.log(` - ${file}`);
|
|
422
422
|
}
|
|
@@ -447,7 +447,7 @@ async function main() {
|
|
|
447
447
|
if (copiedFiles.length === 0) {
|
|
448
448
|
console.log('Required worker files already exist in this project.');
|
|
449
449
|
} else {
|
|
450
|
-
console.log('Project files
|
|
450
|
+
console.log('Project files overwritten from the published freertc package.');
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
resolveWrangler();
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const PSP_VERSION = "1.0";
|
|
2
|
+
const WORKER_VERSION = "0.1.4";
|
|
2
3
|
|
|
3
4
|
const DISCOVERY_TYPES = new Set(["announce", "withdraw", "discover", "peer_list", "redirect"]);
|
|
4
5
|
const NEGOTIATION_TYPES = new Set(["connect_request", "connect_accept", "connect_reject", "offer", "answer", "ice_candidate", "ice_end", "renegotiate"]);
|
|
@@ -63,7 +64,12 @@ export default {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
if (url.pathname === "/health") {
|
|
66
|
-
return jsonResponse({
|
|
67
|
+
return jsonResponse({
|
|
68
|
+
ok: true,
|
|
69
|
+
version: WORKER_VERSION,
|
|
70
|
+
protocol_version: PSP_VERSION,
|
|
71
|
+
peers: livePeers.size
|
|
72
|
+
}, 200);
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
// Federation: relay registry endpoints (any worker can serve these from its own D1)
|