fied 0.2.2 → 0.2.3
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 +4 -20
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -231,7 +231,6 @@ async function share(options) {
|
|
|
231
231
|
console.log("");
|
|
232
232
|
}
|
|
233
233
|
const bridge = new RelayBridge(relayTarget, cryptoKey, keyFragment, pty, options.background, options.sessionId);
|
|
234
|
-
let handoffRequested = false;
|
|
235
234
|
const onUrl = (url) => {
|
|
236
235
|
if (options.background) {
|
|
237
236
|
addSession({
|
|
@@ -242,24 +241,9 @@ async function share(options) {
|
|
|
242
241
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
243
242
|
});
|
|
244
243
|
}
|
|
245
|
-
|
|
246
|
-
return Promise.resolve(options.onShareUrl(url)).then((action) => {
|
|
247
|
-
if (action === "handoff") {
|
|
248
|
-
handoffRequested = true;
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
return Promise.resolve();
|
|
244
|
+
return options.onShareUrl?.(url);
|
|
253
245
|
};
|
|
254
246
|
await bridge.connect(onUrl);
|
|
255
|
-
if (handoffRequested) {
|
|
256
|
-
bridge.destroy();
|
|
257
|
-
try {
|
|
258
|
-
pty.kill();
|
|
259
|
-
} catch {
|
|
260
|
-
}
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
247
|
let closed = false;
|
|
264
248
|
const cleanup = () => {
|
|
265
249
|
if (closed) return;
|
|
@@ -370,7 +354,7 @@ var RelayBridge = class {
|
|
|
370
354
|
console.log(" \x1B[2mPress Ctrl+C to stop sharing.\x1B[0m");
|
|
371
355
|
console.log("");
|
|
372
356
|
}
|
|
373
|
-
|
|
357
|
+
void this.onUrl?.(url);
|
|
374
358
|
}
|
|
375
359
|
const wsUrl = new URL(`api/sessions/${this.sessionId}/ws`, this.relayTarget.wsBase);
|
|
376
360
|
wsUrl.searchParams.set("role", "host");
|
|
@@ -669,7 +653,7 @@ async function main() {
|
|
|
669
653
|
onShareUrl: async (url) => {
|
|
670
654
|
const background = await confirm("Run in background?");
|
|
671
655
|
if (!background) {
|
|
672
|
-
return
|
|
656
|
+
return;
|
|
673
657
|
}
|
|
674
658
|
const parsed = parseShareUrl(url);
|
|
675
659
|
const child = spawnBackground({
|
|
@@ -685,7 +669,7 @@ async function main() {
|
|
|
685
669
|
console.error(" Same share link stays active.");
|
|
686
670
|
console.error(" Run \x1B[1mnpx fied\x1B[0m again to manage.");
|
|
687
671
|
console.error("");
|
|
688
|
-
|
|
672
|
+
setTimeout(() => process.exit(0), 300);
|
|
689
673
|
}
|
|
690
674
|
});
|
|
691
675
|
}
|