fied 0.2.5 → 0.2.7
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/bin.js +26 -4
- package/package.json +3 -1
package/dist/bin.js
CHANGED
|
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
import WebSocket from "ws";
|
|
9
|
+
import QRCode from "qrcode";
|
|
9
10
|
|
|
10
11
|
// ../crypto/dist/crypto.js
|
|
11
12
|
var ALGORITHM = "AES-GCM";
|
|
@@ -401,16 +402,18 @@ var RelayBridge = class {
|
|
|
401
402
|
return;
|
|
402
403
|
}
|
|
403
404
|
const shareUrl = new URL(`s/${this.sessionId}`, this.relayTarget.httpBase);
|
|
404
|
-
const
|
|
405
|
+
const interactiveUrl = `${shareUrl.toString()}#${this.keyFragment}`;
|
|
406
|
+
const readonlyShareUrl = new URL(`${shareUrl.pathname.replace(/\/$/, "")}/v`, shareUrl);
|
|
407
|
+
const readonlyUrl = `${readonlyShareUrl.toString()}#${this.keyFragment}`;
|
|
405
408
|
if (!this.silent) {
|
|
406
|
-
|
|
407
|
-
|
|
409
|
+
await printShareLinkWithQr("interactive", interactiveUrl);
|
|
410
|
+
await printShareLinkWithQr("view-only", readonlyUrl);
|
|
408
411
|
console.log("");
|
|
409
412
|
console.log(" \x1B[2mThe encryption key is in the URL fragment (#) \u2014 the server never sees it.\x1B[0m");
|
|
410
413
|
console.log(" \x1B[2mPress Ctrl+C to stop sharing.\x1B[0m");
|
|
411
414
|
console.log("");
|
|
412
415
|
}
|
|
413
|
-
void this.onUrl?.(
|
|
416
|
+
void this.onUrl?.(interactiveUrl);
|
|
414
417
|
}
|
|
415
418
|
const wsUrl = new URL(`api/sessions/${this.sessionId}/ws`, this.relayTarget.wsBase);
|
|
416
419
|
wsUrl.searchParams.set("role", "host");
|
|
@@ -570,6 +573,25 @@ function parseResizePayload(payload) {
|
|
|
570
573
|
if (rows < RESIZE_MIN_ROWS || rows > RESIZE_MAX_ROWS) return null;
|
|
571
574
|
return { cols, rows };
|
|
572
575
|
}
|
|
576
|
+
async function printShareLinkWithQr(label, url) {
|
|
577
|
+
console.log(` \x1B[1mShare (${label}):\x1B[0m`);
|
|
578
|
+
console.log(` \x1B[4m\x1B[36m${url}\x1B[0m`);
|
|
579
|
+
console.log("");
|
|
580
|
+
try {
|
|
581
|
+
const qr = await QRCode.toString(url, {
|
|
582
|
+
type: "terminal",
|
|
583
|
+
small: true,
|
|
584
|
+
errorCorrectionLevel: "L"
|
|
585
|
+
});
|
|
586
|
+
const lines = qr.split("\n").filter((line) => line.length > 0).map((line) => ` ${line}`);
|
|
587
|
+
console.log(lines.join("\n"));
|
|
588
|
+
console.log("");
|
|
589
|
+
} catch (err) {
|
|
590
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
591
|
+
console.error(` \x1B[33mQR generation failed:\x1B[0m ${detail}`);
|
|
592
|
+
console.log("");
|
|
593
|
+
}
|
|
594
|
+
}
|
|
573
595
|
|
|
574
596
|
// src/prompt.ts
|
|
575
597
|
import { createInterface } from "node:readline";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fied",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Share your tmux session in the browser with end-to-end encryption",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"node-pty": "^1.2.0-beta.11",
|
|
19
|
+
"qrcode": "^1.5.4",
|
|
19
20
|
"ws": "^8.18.0"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"@fied/crypto": "*",
|
|
23
24
|
"@types/node": "^22.0.0",
|
|
25
|
+
"@types/qrcode": "^1.5.6",
|
|
24
26
|
"@types/ws": "^8.5.0",
|
|
25
27
|
"esbuild": "^0.25.12",
|
|
26
28
|
"typescript": "^5.7.0"
|