mindwire 0.1.23 → 0.1.25
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/cli.js +23 -3
- package/dist/cli.js.map +1 -1
- package/dist/computer.d.ts +16 -0
- package/dist/index.cjs +12 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { MindwireError, TimeoutError, ApiError, RunFailedError, binaryCacheDirectory, cachedExecutable, verifyReleaseBytes, cacheExecutable, executableChecksum } from './chunk-PFYKJ6LX.js';
|
|
3
3
|
import { promisify, parseArgs } from 'util';
|
|
4
|
-
import {
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { realpathSync } from 'fs';
|
|
5
6
|
import * as path2 from 'path';
|
|
6
7
|
import { createHash, randomBytes, randomUUID } from 'crypto';
|
|
7
8
|
import { createInterface } from 'readline/promises';
|
|
@@ -47,6 +48,17 @@ var ComputerApi = class {
|
|
|
47
48
|
revoke(id) {
|
|
48
49
|
return this.client.http.request("DELETE", `/computer/devices/${encodeURIComponent(id)}`);
|
|
49
50
|
}
|
|
51
|
+
forwards() {
|
|
52
|
+
return this.client.http.request("GET", "/computer/forwards");
|
|
53
|
+
}
|
|
54
|
+
/** Authorize a loopback port for this paired device. Renew the same ID every 30s;
|
|
55
|
+
* grants expire after two minutes. Carry traffic using SSH direct-tcpip. */
|
|
56
|
+
forward(request) {
|
|
57
|
+
return this.client.http.request("POST", "/computer/forwards", { body: request });
|
|
58
|
+
}
|
|
59
|
+
closeForward(id) {
|
|
60
|
+
return this.client.http.request("DELETE", `/computer/forwards/${encodeURIComponent(id)}`);
|
|
61
|
+
}
|
|
50
62
|
};
|
|
51
63
|
function computerPairingURI(invitation) {
|
|
52
64
|
const bytes = new TextEncoder().encode(JSON.stringify(invitation));
|
|
@@ -57,7 +69,7 @@ function computerPairingURI(invitation) {
|
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
// src/version.ts
|
|
60
|
-
var SDK_VERSION = "0.1.
|
|
72
|
+
var SDK_VERSION = "0.1.25" ;
|
|
61
73
|
|
|
62
74
|
// src/http.ts
|
|
63
75
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
@@ -2380,7 +2392,15 @@ ${controller.error}` : ""}`
|
|
|
2380
2392
|
throw new Error(`Unknown command ${command}. Run mindwire --help.`);
|
|
2381
2393
|
}
|
|
2382
2394
|
}
|
|
2383
|
-
|
|
2395
|
+
function isCLIEntry() {
|
|
2396
|
+
if (!process.argv[1]) return false;
|
|
2397
|
+
try {
|
|
2398
|
+
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
|
|
2399
|
+
} catch {
|
|
2400
|
+
return false;
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
if (isCLIEntry()) {
|
|
2384
2404
|
void main().catch((error) => {
|
|
2385
2405
|
const message = error instanceof Error ? error.message : String(error);
|
|
2386
2406
|
if (process.argv.includes("--json")) process.stderr.write(JSON.stringify({ event: "error", message }) + "\n");
|