@dominevo/types 0.1.1 → 0.1.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/CHANGELOG.md +13 -0
- package/dist/capabilities/local-network.cap.d.ts +1 -1
- package/dist/capabilities/user-management.cap.d.ts +8 -2
- package/dist/capabilities/viewer-link-url.d.ts +3 -3
- package/dist/deps/python-portable-relocate.d.ts +26 -0
- package/dist/esm/capabilities/local-network.cap.mjs +2 -2
- package/dist/esm/capabilities/user-management.cap.mjs +5 -1
- package/dist/esm/capabilities/viewer-link-url.mjs +1 -1
- package/dist/esm/deps/python-downloader.mjs +7 -4
- package/dist/esm/deps/python-portable-relocate.mjs +146 -0
- package/dist/esm/generated/method-descriptions.mjs +1 -1
- package/dist/generated/addon-api.d.ts +38 -4
- package/dist/index.js +9 -5
- package/dist/index.mjs +9 -5
- package/dist/node.js +148 -4
- package/dist/node.mjs +149 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.3] - 2026-11-29
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Portable Python on macOS keeps working after the data folder is moved (the interpreter stub and pip scripts no longer embed an absolute path).
|
|
15
|
+
|
|
16
|
+
## [0.1.2] - 2026-11-29
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- The Dominevo app link and the hosted viewer are now viewer.dominevo.app.
|
|
21
|
+
- Credential sessions list last use: address, client and use count (never used reads as never)
|
|
22
|
+
|
|
10
23
|
## [0.1.1] - 2026-11-28
|
|
11
24
|
|
|
12
25
|
### Changed
|
|
@@ -531,7 +531,7 @@ export declare const localNetworkCapability: {
|
|
|
531
531
|
/**
|
|
532
532
|
* The `notificationTaps` role (D734): where TAPPING a notification opens.
|
|
533
533
|
* `baseUrl: null` means AUTO, which is the Dominevo app link (D709): taps
|
|
534
|
-
* go through `https://
|
|
534
|
+
* go through `https://viewer.dominevo.app/…?hub=<appLinkHub>` and open the
|
|
535
535
|
* app. Any hub address the palette lists can be flagged instead; then a
|
|
536
536
|
* tap opens that address. Only the tap: action buttons, attachment /
|
|
537
537
|
* media links and admin links follow the `publicEndpoint` role
|
|
@@ -252,7 +252,10 @@ declare const OauthSessionSummarySchema: z.ZodObject<{
|
|
|
252
252
|
includeLinked: z.ZodOptional<z.ZodBoolean>;
|
|
253
253
|
}, z.core.$strip>], "type">>>;
|
|
254
254
|
createdAt: z.ZodNumber;
|
|
255
|
-
lastUsedAt: z.ZodNumber
|
|
255
|
+
lastUsedAt: z.ZodNullable<z.ZodNumber>;
|
|
256
|
+
lastUsedFrom: z.ZodNullable<z.ZodString>;
|
|
257
|
+
lastUsedClient: z.ZodNullable<z.ZodString>;
|
|
258
|
+
useCount: z.ZodNumber;
|
|
256
259
|
revokedAt: z.ZodNullable<z.ZodNumber>;
|
|
257
260
|
}, z.core.$strip>;
|
|
258
261
|
/**
|
|
@@ -979,7 +982,10 @@ export declare const userManagementCapability: {
|
|
|
979
982
|
includeLinked: z.ZodOptional<z.ZodBoolean>;
|
|
980
983
|
}, z.core.$strip>], "type">>>;
|
|
981
984
|
createdAt: z.ZodNumber;
|
|
982
|
-
lastUsedAt: z.ZodNumber
|
|
985
|
+
lastUsedAt: z.ZodNullable<z.ZodNumber>;
|
|
986
|
+
lastUsedFrom: z.ZodNullable<z.ZodString>;
|
|
987
|
+
lastUsedClient: z.ZodNullable<z.ZodString>;
|
|
988
|
+
useCount: z.ZodNumber;
|
|
983
989
|
revokedAt: z.ZodNullable<z.ZodNumber>;
|
|
984
990
|
}, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
|
|
985
991
|
/** Revoke one OAuth session so its tokens stop working. */
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* notifications on the admin Network page (`local-network`'s notification
|
|
8
8
|
* endpoint — one flag, one store). Among the addresses that page lists,
|
|
9
9
|
* `local-network` adds one generic entry: the app link,
|
|
10
|
-
* `https://
|
|
10
|
+
* `https://viewer.dominevo.app`, and that entry carries the flag BY DEFAULT.
|
|
11
11
|
* Two forms follow from which address is flagged:
|
|
12
12
|
*
|
|
13
13
|
* - `app` — the app link is flagged:
|
|
14
|
-
* `https://
|
|
14
|
+
* `https://viewer.dominevo.app/<path>?<query>&hub=<hub origin>`. The central
|
|
15
15
|
* domain the native app claims as a Universal Link / App Link
|
|
16
16
|
* (docs/design/2026-08-19-central-link-redirect.md): on a phone with the app
|
|
17
17
|
* it opens the app on that page; anywhere else the hosted viewer opens and
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import type { ConnectionEndpoint } from './local-network.cap.js';
|
|
35
35
|
/** The central link domain the viewer app claims (Universal Links / App Links). */
|
|
36
|
-
export declare const DOMINEVO_APP_LINK_ORIGIN = "https://
|
|
36
|
+
export declare const DOMINEVO_APP_LINK_ORIGIN = "https://viewer.dominevo.app";
|
|
37
37
|
/** Where the hub serves the viewer SPA. */
|
|
38
38
|
export declare const HUB_VIEWER_MOUNT = "/viewer/dominevo";
|
|
39
39
|
/** Which form a viewer link takes — see the module header. */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IScopedLogger } from '../interfaces/logging.js';
|
|
2
|
+
/** The `arch` flag that locks the slice of a universal2 binary to the host. */
|
|
3
|
+
export type ArchFlag = '-arm64' | '-x86_64';
|
|
4
|
+
/** The `arch` flag for a Node `process.arch` value. */
|
|
5
|
+
export declare function archFlagFor(arch: string): ArchFlag;
|
|
6
|
+
/** Name of the renamed interpreter the stubs delegate to. */
|
|
7
|
+
export declare const REAL_PYTHON_NAME = "python3.real";
|
|
8
|
+
/**
|
|
9
|
+
* The text of the arch stub. It resolves `python3.real` relative to its own
|
|
10
|
+
* location (following a symlinked invocation), so it survives a move.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderArchStub(archFlag: ArchFlag): string;
|
|
13
|
+
/**
|
|
14
|
+
* Rewrites the absolute interpreter path of the shebang (line 1) and of pip's
|
|
15
|
+
* `'''exec'` line (line 2) when it lies under a directory other than `binDir`.
|
|
16
|
+
* Any other path in those lines (a comment) and any interpreter that still exists (a system shebang) is left alone.
|
|
17
|
+
* Null when nothing needs to change.
|
|
18
|
+
*/
|
|
19
|
+
export declare function relocateInterpreterHeader(text: string, binDir: string): string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Brings the install in `pythonDir` up to date: the arch stubs are the
|
|
22
|
+
* relative form, and no regular script in `bin/` names an interpreter under
|
|
23
|
+
* another directory. Bounded to `bin/`, to the first two lines, to text files.
|
|
24
|
+
* Never throws; returns how many files it rewrote.
|
|
25
|
+
*/
|
|
26
|
+
export declare function healPortablePython(pythonDir: string, archFlag: ArchFlag, logger: IScopedLogger): number;
|
|
@@ -182,7 +182,7 @@ var NotificationEndpointSchema = /* @__PURE__ */ z.object({
|
|
|
182
182
|
baseUrl: /* @__PURE__ */ z.string().nullable(),
|
|
183
183
|
/**
|
|
184
184
|
* The effective flagged address: the explicit choice, else (AUTO) the
|
|
185
|
-
* Dominevo app link `https://
|
|
185
|
+
* Dominevo app link `https://viewer.dominevo.app` (D709). A pre-D709 hub
|
|
186
186
|
* answered the public tunnel / mesh here, or null.
|
|
187
187
|
*/
|
|
188
188
|
resolved: /* @__PURE__ */ z.string().nullable(),
|
|
@@ -434,7 +434,7 @@ var localNetworkCapability = {
|
|
|
434
434
|
/**
|
|
435
435
|
* The `notificationTaps` role (D734): where TAPPING a notification opens.
|
|
436
436
|
* `baseUrl: null` means AUTO, which is the Dominevo app link (D709): taps
|
|
437
|
-
* go through `https://
|
|
437
|
+
* go through `https://viewer.dominevo.app/…?hub=<appLinkHub>` and open the
|
|
438
438
|
* app. Any hub address the palette lists can be flagged instead; then a
|
|
439
439
|
* tap opens that address. Only the tap: action buttons, attachment /
|
|
440
440
|
* media links and admin links follow the `publicEndpoint` role
|
|
@@ -46,7 +46,11 @@ var OauthSessionSummarySchema = /* @__PURE__ */ z.object({
|
|
|
46
46
|
instanceId: /* @__PURE__ */ z.string().nullable().optional(),
|
|
47
47
|
scopes: /* @__PURE__ */ z.array(TokenScopeSchema),
|
|
48
48
|
createdAt: /* @__PURE__ */ z.number(),
|
|
49
|
-
|
|
49
|
+
/** The last real use of an access token of this link; `null` = never used. A refresh is not a use. */
|
|
50
|
+
lastUsedAt: /* @__PURE__ */ z.number().nullable(),
|
|
51
|
+
lastUsedFrom: /* @__PURE__ */ z.string().nullable(),
|
|
52
|
+
lastUsedClient: /* @__PURE__ */ z.string().nullable(),
|
|
53
|
+
useCount: /* @__PURE__ */ z.number().int().nonnegative(),
|
|
50
54
|
revokedAt: /* @__PURE__ */ z.number().nullable()
|
|
51
55
|
});
|
|
52
56
|
var TotpSetupResultSchema = /* @__PURE__ */ z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/capabilities/viewer-link-url.ts
|
|
2
2
|
/** The central link domain the viewer app claims (Universal Links / App Links). */
|
|
3
|
-
var DOMINEVO_APP_LINK_ORIGIN = "https://
|
|
3
|
+
var DOMINEVO_APP_LINK_ORIGIN = "https://viewer.dominevo.app";
|
|
4
4
|
/** Where the hub serves the viewer SPA. */
|
|
5
5
|
var HUB_VIEWER_MOUNT = "/viewer/dominevo";
|
|
6
6
|
/** True when `baseUrl` names the Dominevo app link rather than a hub address. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { errMsg } from "../utils/err-msg.mjs";
|
|
2
2
|
import { extractArchive } from "./archive-extract.mjs";
|
|
3
3
|
import { verifySha256 } from "./binary-downloader.mjs";
|
|
4
|
+
import { REAL_PYTHON_NAME, archFlagFor, healPortablePython, renderArchStub } from "./python-portable-relocate.mjs";
|
|
4
5
|
import { chmodSync, createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
6
|
import { basename, join } from "node:path";
|
|
6
7
|
import { pipeline } from "node:stream/promises";
|
|
@@ -87,6 +88,7 @@ async function ensurePython(dataDir, logger) {
|
|
|
87
88
|
const pythonDir = join(dataDir, "deps", "python");
|
|
88
89
|
const pythonBin = join(pythonDir, ...pythonInterpreterSegments(process.platform));
|
|
89
90
|
if (existsSync(pythonBin)) {
|
|
91
|
+
if (process.platform === "darwin") healPortablePython(pythonDir, archFlagFor(process.arch), logger);
|
|
90
92
|
logger.debug("Portable Python found", { meta: { pythonBin } });
|
|
91
93
|
return pythonBin;
|
|
92
94
|
}
|
|
@@ -125,18 +127,18 @@ async function ensurePython(dataDir, logger) {
|
|
|
125
127
|
}
|
|
126
128
|
chmodSync(pythonBin, 493);
|
|
127
129
|
if (process.platform === "darwin") {
|
|
128
|
-
const realBin = join(pythonDir, "bin",
|
|
130
|
+
const realBin = join(pythonDir, "bin", REAL_PYTHON_NAME);
|
|
131
|
+
const archFlag = archFlagFor(process.arch);
|
|
129
132
|
if (!existsSync(realBin)) {
|
|
130
133
|
renameSync(pythonBin, realBin);
|
|
131
|
-
|
|
132
|
-
writeFileSync(pythonBin, `#!/bin/sh\nexec /usr/bin/arch ${archFlag} "${realBin}" "$@"\n`);
|
|
134
|
+
writeFileSync(pythonBin, renderArchStub(archFlag));
|
|
133
135
|
chmodSync(pythonBin, 493);
|
|
134
136
|
const pyAlt = join(pythonDir, "bin", "python");
|
|
135
137
|
if (existsSync(pyAlt)) {
|
|
136
138
|
try {
|
|
137
139
|
rmSync(pyAlt, { force: true });
|
|
138
140
|
} catch {}
|
|
139
|
-
writeFileSync(pyAlt,
|
|
141
|
+
writeFileSync(pyAlt, renderArchStub(archFlag));
|
|
140
142
|
chmodSync(pyAlt, 493);
|
|
141
143
|
}
|
|
142
144
|
logger.info("Locked python3 to host arch via shell stub", { meta: {
|
|
@@ -144,6 +146,7 @@ async function ensurePython(dataDir, logger) {
|
|
|
144
146
|
realBin
|
|
145
147
|
} });
|
|
146
148
|
}
|
|
149
|
+
healPortablePython(pythonDir, archFlag, logger);
|
|
147
150
|
}
|
|
148
151
|
logger.info("Portable Python installed", { meta: {
|
|
149
152
|
version: PYTHON_VERSION,
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { errMsg } from "../utils/err-msg.mjs";
|
|
2
|
+
import { chmodSync, closeSync, existsSync, lstatSync, openSync, readFileSync, readSync, readdirSync, renameSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
//#region src/deps/python-portable-relocate.ts
|
|
5
|
+
/**
|
|
6
|
+
* Keeps the macOS portable Python runnable after its folder is moved.
|
|
7
|
+
*
|
|
8
|
+
* The arch-locking stub that replaces `bin/python3` used to embed the absolute
|
|
9
|
+
* path of `python3.real`, and pip's console scripts embed the absolute path of
|
|
10
|
+
* the interpreter that installed them. Move the data directory and every one of
|
|
11
|
+
* them points at a path that no longer exists. The stub now finds the real
|
|
12
|
+
* binary beside itself at run time, and {@link healPortablePython} rewrites the
|
|
13
|
+
* leftovers of an install made before that.
|
|
14
|
+
*/
|
|
15
|
+
/** The `arch` flag for a Node `process.arch` value. */
|
|
16
|
+
function archFlagFor(arch) {
|
|
17
|
+
return arch === "arm64" ? "-arm64" : "-x86_64";
|
|
18
|
+
}
|
|
19
|
+
/** Name of the renamed interpreter the stubs delegate to. */
|
|
20
|
+
var REAL_PYTHON_NAME = "python3.real";
|
|
21
|
+
/** Scripts bigger than this are never rewritten (a binary or a data file). */
|
|
22
|
+
var MAX_SCRIPT_BYTES = 1048576;
|
|
23
|
+
/** How much of a file is read to tell a script from a binary. */
|
|
24
|
+
var PROBE_BYTES = 512;
|
|
25
|
+
/**
|
|
26
|
+
* The text of the arch stub. It resolves `python3.real` relative to its own
|
|
27
|
+
* location (following a symlinked invocation), so it survives a move.
|
|
28
|
+
*/
|
|
29
|
+
function renderArchStub(archFlag) {
|
|
30
|
+
return [
|
|
31
|
+
"#!/bin/sh",
|
|
32
|
+
"p=$0",
|
|
33
|
+
"while [ -L \"$p\" ]; do",
|
|
34
|
+
" l=$(readlink \"$p\")",
|
|
35
|
+
" case $l in /*) p=$l ;; *) p=$(dirname \"$p\")/$l ;; esac",
|
|
36
|
+
"done",
|
|
37
|
+
`exec /usr/bin/arch ${archFlag} "$(cd "$(dirname "$p")" && pwd)/${REAL_PYTHON_NAME}" "$@"`,
|
|
38
|
+
""
|
|
39
|
+
].join("\n");
|
|
40
|
+
}
|
|
41
|
+
/** A shebang naming an absolute portable interpreter: `#!<dir>/bin/python3`. */
|
|
42
|
+
var SHEBANG_PATH = /^(#!)(\/[^"'\n]+?)\/bin\/(python3\.real|python3|python)(?![\w.])/;
|
|
43
|
+
/** The pip console-script re-exec line: `'''exec' "<dir>/bin/python3.real" "$0" "$@"`. */
|
|
44
|
+
var EXEC_LINE_PATH = /^('''exec' ")(\/[^"\n]+?)\/bin\/(python3\.real)(?![\w.])/;
|
|
45
|
+
function relocateLine(line, pattern, binDir) {
|
|
46
|
+
return line.replace(pattern, (whole, lead, dir, name) => `${dir}/bin` === binDir || existsSync(`${dir}/bin/${name}`) ? whole : `${lead}${binDir}/${name}`);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Rewrites the absolute interpreter path of the shebang (line 1) and of pip's
|
|
50
|
+
* `'''exec'` line (line 2) when it lies under a directory other than `binDir`.
|
|
51
|
+
* Any other path in those lines (a comment) and any interpreter that still exists (a system shebang) is left alone.
|
|
52
|
+
* Null when nothing needs to change.
|
|
53
|
+
*/
|
|
54
|
+
function relocateInterpreterHeader(text, binDir) {
|
|
55
|
+
const lines = text.split("\n");
|
|
56
|
+
const first = relocateLine(lines[0] ?? "", SHEBANG_PATH, binDir);
|
|
57
|
+
const second = relocateLine(lines[1] ?? "", EXEC_LINE_PATH, binDir);
|
|
58
|
+
if (first === lines[0] && second === (lines[1] ?? "")) return null;
|
|
59
|
+
return [
|
|
60
|
+
first,
|
|
61
|
+
...lines.length > 1 ? [second] : [],
|
|
62
|
+
...lines.slice(2)
|
|
63
|
+
].join("\n");
|
|
64
|
+
}
|
|
65
|
+
function isRegularFile(path) {
|
|
66
|
+
try {
|
|
67
|
+
return lstatSync(path).isFile();
|
|
68
|
+
} catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Replaces `path` atomically (temp file beside it, same mode, rename): several
|
|
74
|
+
* runners call `ensurePython` at once and none may exec a half-written file.
|
|
75
|
+
*/
|
|
76
|
+
function writeFileAtomic(path, content, mode) {
|
|
77
|
+
const tmp = `${path}.heal-${process.pid}-${Date.now()}`;
|
|
78
|
+
writeFileSync(tmp, content);
|
|
79
|
+
chmodSync(tmp, mode);
|
|
80
|
+
renameSync(tmp, path);
|
|
81
|
+
}
|
|
82
|
+
/** The first `PROBE_BYTES` bytes of a file, without reading the rest. */
|
|
83
|
+
function readProbe(path) {
|
|
84
|
+
const fd = openSync(path, "r");
|
|
85
|
+
try {
|
|
86
|
+
const buf = Buffer.alloc(PROBE_BYTES);
|
|
87
|
+
const n = readSync(fd, buf, 0, PROBE_BYTES, 0);
|
|
88
|
+
return buf.subarray(0, n);
|
|
89
|
+
} finally {
|
|
90
|
+
closeSync(fd);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Brings the install in `pythonDir` up to date: the arch stubs are the
|
|
95
|
+
* relative form, and no regular script in `bin/` names an interpreter under
|
|
96
|
+
* another directory. Bounded to `bin/`, to the first two lines, to text files.
|
|
97
|
+
* Never throws; returns how many files it rewrote.
|
|
98
|
+
*/
|
|
99
|
+
function healPortablePython(pythonDir, archFlag, logger) {
|
|
100
|
+
const binDir = join(pythonDir, "bin");
|
|
101
|
+
let healed = 0;
|
|
102
|
+
try {
|
|
103
|
+
if (!existsSync(join(binDir, "python3.real"))) return 0;
|
|
104
|
+
const stub = renderArchStub(archFlag);
|
|
105
|
+
for (const name of ["python3", "python"]) {
|
|
106
|
+
const path = join(binDir, name);
|
|
107
|
+
if (!isRegularFile(path)) continue;
|
|
108
|
+
const text = readFileSync(path, "utf8");
|
|
109
|
+
if (text === stub || !text.startsWith("#!/bin/sh\n")) continue;
|
|
110
|
+
if (!text.includes("/usr/bin/arch")) continue;
|
|
111
|
+
writeFileAtomic(path, stub, 493);
|
|
112
|
+
healed += 1;
|
|
113
|
+
}
|
|
114
|
+
for (const name of readdirSync(binDir)) {
|
|
115
|
+
const path = join(binDir, name);
|
|
116
|
+
try {
|
|
117
|
+
if (!isRegularFile(path)) continue;
|
|
118
|
+
const stat = lstatSync(path);
|
|
119
|
+
if (stat.size > MAX_SCRIPT_BYTES) continue;
|
|
120
|
+
const probe = readProbe(path);
|
|
121
|
+
if (probe.subarray(0, 2).toString("latin1") !== "#!" || probe.includes(0)) continue;
|
|
122
|
+
const next = relocateInterpreterHeader(readFileSync(path, "utf8"), binDir);
|
|
123
|
+
if (next === null) continue;
|
|
124
|
+
writeFileAtomic(path, next, stat.mode & 511);
|
|
125
|
+
healed += 1;
|
|
126
|
+
} catch (err) {
|
|
127
|
+
logger.warn("Could not repair a portable Python script", { meta: {
|
|
128
|
+
path,
|
|
129
|
+
error: errMsg(err)
|
|
130
|
+
} });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (healed > 0) logger.info("Repaired portable Python after its folder moved", { meta: {
|
|
134
|
+
healed,
|
|
135
|
+
binDir
|
|
136
|
+
} });
|
|
137
|
+
} catch (err) {
|
|
138
|
+
logger.warn("Portable Python repair failed; continuing", { meta: {
|
|
139
|
+
binDir,
|
|
140
|
+
error: errMsg(err)
|
|
141
|
+
} });
|
|
142
|
+
}
|
|
143
|
+
return healed;
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
export { REAL_PYTHON_NAME, archFlagFor, healPortablePython, renderArchStub };
|
|
@@ -667,7 +667,7 @@ var METHOD_DESCRIPTIONS = /* @__PURE__ */ Object.freeze({
|
|
|
667
667
|
"localNetwork.getAllowedAddresses": "Read the operator's allowlist. Empty = \"auto\" (no filter). Used by the admin UI's address selector to seed its checkbox state.",
|
|
668
668
|
"localNetwork.getConnectionEndpoints": "Ordered candidate base URLs (the palette the Network tab shows). Includes LAN IPv4, stable LAN IPv6, the public tunnel, and mesh when joined. Loopback is off by default. The SDK races the subset from getViewerEndpoints, not this full list — IPv6 stays here because WebRTC ICE gathers dual-stack regardless of the HTTP race. Honours getAllowedAddresses() when set — addresses outside the allowlist are dropped (the public tunnel is still included as an escape hatch).",
|
|
669
669
|
"localNetwork.getHubAddresses": "The hub's cluster and browser addresses (deprecated; use getAddresses).",
|
|
670
|
-
"localNetwork.getNotificationEndpoint": "The notificationTaps role (D734): where TAPPING a notification opens. baseUrl: null means AUTO, which is the Dominevo app link (D709): taps go through https://
|
|
670
|
+
"localNetwork.getNotificationEndpoint": "The notificationTaps role (D734): where TAPPING a notification opens. baseUrl: null means AUTO, which is the Dominevo app link (D709): taps go through https://viewer.dominevo.app/…?hub=<appLinkHub> and open the app. Any hub address the palette lists can be flagged instead; then a tap opens that address. Only the tap: action buttons, attachment / media links and admin links follow the publicEndpoint role (getAddresses().roles.publicEndpoint), never this one.",
|
|
671
671
|
"localNetwork.getPreferred": "Auto-selected outbound interface. Heuristic: 1. Skip internal / link-local / 169.254.*. 2. Prefer LAN/wifi (real Ethernet) over docker/vpn. 3. IPv4 wins over IPv6 (compat with legacy consumers). 4. Tie-break on lowest CIDR mask (most-specific subnet). Returns null only when the host has zero non-loopback addresses. Honours getAllowedAddresses() — if the operator pinned an allowlist, only those addresses are candidates.",
|
|
672
672
|
"localNetwork.getScanSubnets": "Extra subnets every scan covers besides the hub's own, as CIDR strings.",
|
|
673
673
|
"localNetwork.getTlsStatus": "Live TLS material for the Network → Local access certificate card. LAN HTTP / hostname are scoped settings (the cap's own form), not a second store — this query is status, not configuration.",
|
|
@@ -14800,6 +14800,9 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
14800
14800
|
createdAt: number;
|
|
14801
14801
|
expiresAt: number | null;
|
|
14802
14802
|
lastUsedAt: number | null;
|
|
14803
|
+
lastUsedFrom: string | null;
|
|
14804
|
+
lastUsedClient: string | null;
|
|
14805
|
+
useCount: number;
|
|
14803
14806
|
revokedAt: number | null;
|
|
14804
14807
|
};
|
|
14805
14808
|
};
|
|
@@ -14862,6 +14865,9 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
14862
14865
|
createdAt: number;
|
|
14863
14866
|
expiresAt: number | null;
|
|
14864
14867
|
lastUsedAt: number | null;
|
|
14868
|
+
lastUsedFrom: string | null;
|
|
14869
|
+
lastUsedClient: string | null;
|
|
14870
|
+
useCount: number;
|
|
14865
14871
|
revokedAt: number | null;
|
|
14866
14872
|
}[];
|
|
14867
14873
|
meta: object;
|
|
@@ -14924,6 +14930,9 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
14924
14930
|
createdAt: number;
|
|
14925
14931
|
expiresAt: number | null;
|
|
14926
14932
|
lastUsedAt: number | null;
|
|
14933
|
+
lastUsedFrom: string | null;
|
|
14934
|
+
lastUsedClient: string | null;
|
|
14935
|
+
useCount: number;
|
|
14927
14936
|
revokedAt: number | null;
|
|
14928
14937
|
};
|
|
14929
14938
|
meta: object;
|
|
@@ -14941,6 +14950,7 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
14941
14950
|
input: {
|
|
14942
14951
|
limit?: number | undefined;
|
|
14943
14952
|
userId?: string | undefined;
|
|
14953
|
+
credentialId?: string | undefined;
|
|
14944
14954
|
} | undefined;
|
|
14945
14955
|
output: {
|
|
14946
14956
|
id: string;
|
|
@@ -14948,6 +14958,7 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
14948
14958
|
action: string;
|
|
14949
14959
|
userId?: string | undefined;
|
|
14950
14960
|
ip?: string | undefined;
|
|
14961
|
+
credentialId?: string | undefined;
|
|
14951
14962
|
detail?: Record<string, string | number | boolean> | undefined;
|
|
14952
14963
|
}[];
|
|
14953
14964
|
meta: object;
|
|
@@ -15279,7 +15290,10 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
15279
15290
|
method: string;
|
|
15280
15291
|
refreshable: boolean;
|
|
15281
15292
|
createdAt: number;
|
|
15282
|
-
lastUsedAt: number;
|
|
15293
|
+
lastUsedAt: number | null;
|
|
15294
|
+
lastUsedFrom: string | null;
|
|
15295
|
+
lastUsedClient: string | null;
|
|
15296
|
+
useCount: number;
|
|
15283
15297
|
expiresAt: number;
|
|
15284
15298
|
client: string | null;
|
|
15285
15299
|
ip: string | null;
|
|
@@ -15306,7 +15320,10 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
15306
15320
|
method: string;
|
|
15307
15321
|
refreshable: boolean;
|
|
15308
15322
|
createdAt: number;
|
|
15309
|
-
lastUsedAt: number;
|
|
15323
|
+
lastUsedAt: number | null;
|
|
15324
|
+
lastUsedFrom: string | null;
|
|
15325
|
+
lastUsedClient: string | null;
|
|
15326
|
+
useCount: number;
|
|
15310
15327
|
expiresAt: number;
|
|
15311
15328
|
client: string | null;
|
|
15312
15329
|
ip: string | null;
|
|
@@ -15891,6 +15908,9 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
15891
15908
|
createdAt: number;
|
|
15892
15909
|
expiresAt: number | null;
|
|
15893
15910
|
lastUsedAt: number | null;
|
|
15911
|
+
lastUsedFrom: string | null;
|
|
15912
|
+
lastUsedClient: string | null;
|
|
15913
|
+
useCount: number;
|
|
15894
15914
|
revokedAt: number | null;
|
|
15895
15915
|
};
|
|
15896
15916
|
};
|
|
@@ -15953,6 +15973,9 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
15953
15973
|
createdAt: number;
|
|
15954
15974
|
expiresAt: number | null;
|
|
15955
15975
|
lastUsedAt: number | null;
|
|
15976
|
+
lastUsedFrom: string | null;
|
|
15977
|
+
lastUsedClient: string | null;
|
|
15978
|
+
useCount: number;
|
|
15956
15979
|
revokedAt: number | null;
|
|
15957
15980
|
}[];
|
|
15958
15981
|
meta: object;
|
|
@@ -16015,6 +16038,9 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
16015
16038
|
createdAt: number;
|
|
16016
16039
|
expiresAt: number | null;
|
|
16017
16040
|
lastUsedAt: number | null;
|
|
16041
|
+
lastUsedFrom: string | null;
|
|
16042
|
+
lastUsedClient: string | null;
|
|
16043
|
+
useCount: number;
|
|
16018
16044
|
revokedAt: number | null;
|
|
16019
16045
|
};
|
|
16020
16046
|
meta: object;
|
|
@@ -16032,6 +16058,7 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
16032
16058
|
input: {
|
|
16033
16059
|
limit?: number | undefined;
|
|
16034
16060
|
userId?: string | undefined;
|
|
16061
|
+
credentialId?: string | undefined;
|
|
16035
16062
|
} | undefined;
|
|
16036
16063
|
output: {
|
|
16037
16064
|
id: string;
|
|
@@ -16039,6 +16066,7 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
16039
16066
|
action: string;
|
|
16040
16067
|
userId?: string | undefined;
|
|
16041
16068
|
ip?: string | undefined;
|
|
16069
|
+
credentialId?: string | undefined;
|
|
16042
16070
|
detail?: Record<string, string | number | boolean> | undefined;
|
|
16043
16071
|
}[];
|
|
16044
16072
|
meta: object;
|
|
@@ -16370,7 +16398,10 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
16370
16398
|
method: string;
|
|
16371
16399
|
refreshable: boolean;
|
|
16372
16400
|
createdAt: number;
|
|
16373
|
-
lastUsedAt: number;
|
|
16401
|
+
lastUsedAt: number | null;
|
|
16402
|
+
lastUsedFrom: string | null;
|
|
16403
|
+
lastUsedClient: string | null;
|
|
16404
|
+
useCount: number;
|
|
16374
16405
|
expiresAt: number;
|
|
16375
16406
|
client: string | null;
|
|
16376
16407
|
ip: string | null;
|
|
@@ -16397,7 +16428,10 @@ export type AppRouter = TrpcCoreRouter<{
|
|
|
16397
16428
|
method: string;
|
|
16398
16429
|
refreshable: boolean;
|
|
16399
16430
|
createdAt: number;
|
|
16400
|
-
lastUsedAt: number;
|
|
16431
|
+
lastUsedAt: number | null;
|
|
16432
|
+
lastUsedFrom: string | null;
|
|
16433
|
+
lastUsedClient: string | null;
|
|
16434
|
+
useCount: number;
|
|
16401
16435
|
expiresAt: number;
|
|
16402
16436
|
client: string | null;
|
|
16403
16437
|
ip: string | null;
|
package/dist/index.js
CHANGED
|
@@ -73731,7 +73731,7 @@ list: /* @__PURE__ */ require_runtime_capabilities.method(/* @__PURE__ */ zod.z.
|
|
|
73731
73731
|
//#endregion
|
|
73732
73732
|
//#region src/capabilities/viewer-link-url.ts
|
|
73733
73733
|
/** The central link domain the viewer app claims (Universal Links / App Links). */
|
|
73734
|
-
var DOMINEVO_APP_LINK_ORIGIN = "https://
|
|
73734
|
+
var DOMINEVO_APP_LINK_ORIGIN = "https://viewer.dominevo.app";
|
|
73735
73735
|
/** Where the hub serves the viewer SPA. */
|
|
73736
73736
|
var HUB_VIEWER_MOUNT = "/viewer/dominevo";
|
|
73737
73737
|
/** True when `baseUrl` names the Dominevo app link rather than a hub address. */
|
|
@@ -74342,7 +74342,7 @@ var NotificationEndpointSchema = /* @__PURE__ */ zod.z.object({
|
|
|
74342
74342
|
baseUrl: /* @__PURE__ */ zod.z.string().nullable(),
|
|
74343
74343
|
/**
|
|
74344
74344
|
* The effective flagged address: the explicit choice, else (AUTO) the
|
|
74345
|
-
* Dominevo app link `https://
|
|
74345
|
+
* Dominevo app link `https://viewer.dominevo.app` (D709). A pre-D709 hub
|
|
74346
74346
|
* answered the public tunnel / mesh here, or null.
|
|
74347
74347
|
*/
|
|
74348
74348
|
resolved: /* @__PURE__ */ zod.z.string().nullable(),
|
|
@@ -74594,7 +74594,7 @@ var localNetworkCapability = {
|
|
|
74594
74594
|
/**
|
|
74595
74595
|
* The `notificationTaps` role (D734): where TAPPING a notification opens.
|
|
74596
74596
|
* `baseUrl: null` means AUTO, which is the Dominevo app link (D709): taps
|
|
74597
|
-
* go through `https://
|
|
74597
|
+
* go through `https://viewer.dominevo.app/…?hub=<appLinkHub>` and open the
|
|
74598
74598
|
* app. Any hub address the palette lists can be flagged instead; then a
|
|
74599
74599
|
* tap opens that address. Only the tap: action buttons, attachment /
|
|
74600
74600
|
* media links and admin links follow the `publicEndpoint` role
|
|
@@ -107697,7 +107697,11 @@ var OauthSessionSummarySchema = /* @__PURE__ */ zod.z.object({
|
|
|
107697
107697
|
instanceId: /* @__PURE__ */ zod.z.string().nullable().optional(),
|
|
107698
107698
|
scopes: /* @__PURE__ */ zod.z.array(TokenScopeSchema),
|
|
107699
107699
|
createdAt: /* @__PURE__ */ zod.z.number(),
|
|
107700
|
-
|
|
107700
|
+
/** The last real use of an access token of this link; `null` = never used. A refresh is not a use. */
|
|
107701
|
+
lastUsedAt: /* @__PURE__ */ zod.z.number().nullable(),
|
|
107702
|
+
lastUsedFrom: /* @__PURE__ */ zod.z.string().nullable(),
|
|
107703
|
+
lastUsedClient: /* @__PURE__ */ zod.z.string().nullable(),
|
|
107704
|
+
useCount: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
107701
107705
|
revokedAt: /* @__PURE__ */ zod.z.number().nullable()
|
|
107702
107706
|
});
|
|
107703
107707
|
var TotpSetupResultSchema = /* @__PURE__ */ zod.z.object({
|
|
@@ -142063,7 +142067,7 @@ var METHOD_DESCRIPTIONS = /* @__PURE__ */ Object.freeze({
|
|
|
142063
142067
|
"localNetwork.getAllowedAddresses": "Read the operator's allowlist. Empty = \"auto\" (no filter). Used by the admin UI's address selector to seed its checkbox state.",
|
|
142064
142068
|
"localNetwork.getConnectionEndpoints": "Ordered candidate base URLs (the palette the Network tab shows). Includes LAN IPv4, stable LAN IPv6, the public tunnel, and mesh when joined. Loopback is off by default. The SDK races the subset from getViewerEndpoints, not this full list — IPv6 stays here because WebRTC ICE gathers dual-stack regardless of the HTTP race. Honours getAllowedAddresses() when set — addresses outside the allowlist are dropped (the public tunnel is still included as an escape hatch).",
|
|
142065
142069
|
"localNetwork.getHubAddresses": "The hub's cluster and browser addresses (deprecated; use getAddresses).",
|
|
142066
|
-
"localNetwork.getNotificationEndpoint": "The notificationTaps role (D734): where TAPPING a notification opens. baseUrl: null means AUTO, which is the Dominevo app link (D709): taps go through https://
|
|
142070
|
+
"localNetwork.getNotificationEndpoint": "The notificationTaps role (D734): where TAPPING a notification opens. baseUrl: null means AUTO, which is the Dominevo app link (D709): taps go through https://viewer.dominevo.app/…?hub=<appLinkHub> and open the app. Any hub address the palette lists can be flagged instead; then a tap opens that address. Only the tap: action buttons, attachment / media links and admin links follow the publicEndpoint role (getAddresses().roles.publicEndpoint), never this one.",
|
|
142067
142071
|
"localNetwork.getPreferred": "Auto-selected outbound interface. Heuristic: 1. Skip internal / link-local / 169.254.*. 2. Prefer LAN/wifi (real Ethernet) over docker/vpn. 3. IPv4 wins over IPv6 (compat with legacy consumers). 4. Tie-break on lowest CIDR mask (most-specific subnet). Returns null only when the host has zero non-loopback addresses. Honours getAllowedAddresses() — if the operator pinned an allowlist, only those addresses are candidates.",
|
|
142068
142072
|
"localNetwork.getScanSubnets": "Extra subnets every scan covers besides the hub's own, as CIDR strings.",
|
|
142069
142073
|
"localNetwork.getTlsStatus": "Live TLS material for the Network → Local access certificate card. LAN HTTP / hostname are scoped settings (the cap's own form), not a second store — this query is status, not configuration.",
|
package/dist/index.mjs
CHANGED
|
@@ -73730,7 +73730,7 @@ list: /* @__PURE__ */ method(/* @__PURE__ */ z.void(), /* @__PURE__ */ z.array(L
|
|
|
73730
73730
|
//#endregion
|
|
73731
73731
|
//#region src/capabilities/viewer-link-url.ts
|
|
73732
73732
|
/** The central link domain the viewer app claims (Universal Links / App Links). */
|
|
73733
|
-
var DOMINEVO_APP_LINK_ORIGIN = "https://
|
|
73733
|
+
var DOMINEVO_APP_LINK_ORIGIN = "https://viewer.dominevo.app";
|
|
73734
73734
|
/** Where the hub serves the viewer SPA. */
|
|
73735
73735
|
var HUB_VIEWER_MOUNT = "/viewer/dominevo";
|
|
73736
73736
|
/** True when `baseUrl` names the Dominevo app link rather than a hub address. */
|
|
@@ -74341,7 +74341,7 @@ var NotificationEndpointSchema = /* @__PURE__ */ z.object({
|
|
|
74341
74341
|
baseUrl: /* @__PURE__ */ z.string().nullable(),
|
|
74342
74342
|
/**
|
|
74343
74343
|
* The effective flagged address: the explicit choice, else (AUTO) the
|
|
74344
|
-
* Dominevo app link `https://
|
|
74344
|
+
* Dominevo app link `https://viewer.dominevo.app` (D709). A pre-D709 hub
|
|
74345
74345
|
* answered the public tunnel / mesh here, or null.
|
|
74346
74346
|
*/
|
|
74347
74347
|
resolved: /* @__PURE__ */ z.string().nullable(),
|
|
@@ -74593,7 +74593,7 @@ var localNetworkCapability = {
|
|
|
74593
74593
|
/**
|
|
74594
74594
|
* The `notificationTaps` role (D734): where TAPPING a notification opens.
|
|
74595
74595
|
* `baseUrl: null` means AUTO, which is the Dominevo app link (D709): taps
|
|
74596
|
-
* go through `https://
|
|
74596
|
+
* go through `https://viewer.dominevo.app/…?hub=<appLinkHub>` and open the
|
|
74597
74597
|
* app. Any hub address the palette lists can be flagged instead; then a
|
|
74598
74598
|
* tap opens that address. Only the tap: action buttons, attachment /
|
|
74599
74599
|
* media links and admin links follow the `publicEndpoint` role
|
|
@@ -107696,7 +107696,11 @@ var OauthSessionSummarySchema = /* @__PURE__ */ z.object({
|
|
|
107696
107696
|
instanceId: /* @__PURE__ */ z.string().nullable().optional(),
|
|
107697
107697
|
scopes: /* @__PURE__ */ z.array(TokenScopeSchema),
|
|
107698
107698
|
createdAt: /* @__PURE__ */ z.number(),
|
|
107699
|
-
|
|
107699
|
+
/** The last real use of an access token of this link; `null` = never used. A refresh is not a use. */
|
|
107700
|
+
lastUsedAt: /* @__PURE__ */ z.number().nullable(),
|
|
107701
|
+
lastUsedFrom: /* @__PURE__ */ z.string().nullable(),
|
|
107702
|
+
lastUsedClient: /* @__PURE__ */ z.string().nullable(),
|
|
107703
|
+
useCount: /* @__PURE__ */ z.number().int().nonnegative(),
|
|
107700
107704
|
revokedAt: /* @__PURE__ */ z.number().nullable()
|
|
107701
107705
|
});
|
|
107702
107706
|
var TotpSetupResultSchema = /* @__PURE__ */ z.object({
|
|
@@ -142062,7 +142066,7 @@ var METHOD_DESCRIPTIONS = /* @__PURE__ */ Object.freeze({
|
|
|
142062
142066
|
"localNetwork.getAllowedAddresses": "Read the operator's allowlist. Empty = \"auto\" (no filter). Used by the admin UI's address selector to seed its checkbox state.",
|
|
142063
142067
|
"localNetwork.getConnectionEndpoints": "Ordered candidate base URLs (the palette the Network tab shows). Includes LAN IPv4, stable LAN IPv6, the public tunnel, and mesh when joined. Loopback is off by default. The SDK races the subset from getViewerEndpoints, not this full list — IPv6 stays here because WebRTC ICE gathers dual-stack regardless of the HTTP race. Honours getAllowedAddresses() when set — addresses outside the allowlist are dropped (the public tunnel is still included as an escape hatch).",
|
|
142064
142068
|
"localNetwork.getHubAddresses": "The hub's cluster and browser addresses (deprecated; use getAddresses).",
|
|
142065
|
-
"localNetwork.getNotificationEndpoint": "The notificationTaps role (D734): where TAPPING a notification opens. baseUrl: null means AUTO, which is the Dominevo app link (D709): taps go through https://
|
|
142069
|
+
"localNetwork.getNotificationEndpoint": "The notificationTaps role (D734): where TAPPING a notification opens. baseUrl: null means AUTO, which is the Dominevo app link (D709): taps go through https://viewer.dominevo.app/…?hub=<appLinkHub> and open the app. Any hub address the palette lists can be flagged instead; then a tap opens that address. Only the tap: action buttons, attachment / media links and admin links follow the publicEndpoint role (getAddresses().roles.publicEndpoint), never this one.",
|
|
142066
142070
|
"localNetwork.getPreferred": "Auto-selected outbound interface. Heuristic: 1. Skip internal / link-local / 169.254.*. 2. Prefer LAN/wifi (real Ethernet) over docker/vpn. 3. IPv4 wins over IPv6 (compat with legacy consumers). 4. Tie-break on lowest CIDR mask (most-specific subnet). Returns null only when the host has zero non-loopback addresses. Honours getAllowedAddresses() — if the operator pinned an allowlist, only those addresses are candidates.",
|
|
142067
142071
|
"localNetwork.getScanSubnets": "Extra subnets every scan covers besides the hub's own, as CIDR strings.",
|
|
142068
142072
|
"localNetwork.getTlsStatus": "Live TLS material for the Network → Local access certificate card. LAN HTTP / hostname are scoped settings (the cap's own form), not a second store — this query is status, not configuration.",
|
package/dist/node.js
CHANGED
|
@@ -650,6 +650,148 @@ function writeOwnerOnlyFileSync(target, data, overrides = {}) {
|
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
//#endregion
|
|
653
|
+
//#region src/deps/python-portable-relocate.ts
|
|
654
|
+
/**
|
|
655
|
+
* Keeps the macOS portable Python runnable after its folder is moved.
|
|
656
|
+
*
|
|
657
|
+
* The arch-locking stub that replaces `bin/python3` used to embed the absolute
|
|
658
|
+
* path of `python3.real`, and pip's console scripts embed the absolute path of
|
|
659
|
+
* the interpreter that installed them. Move the data directory and every one of
|
|
660
|
+
* them points at a path that no longer exists. The stub now finds the real
|
|
661
|
+
* binary beside itself at run time, and {@link healPortablePython} rewrites the
|
|
662
|
+
* leftovers of an install made before that.
|
|
663
|
+
*/
|
|
664
|
+
/** The `arch` flag for a Node `process.arch` value. */
|
|
665
|
+
function archFlagFor(arch) {
|
|
666
|
+
return arch === "arm64" ? "-arm64" : "-x86_64";
|
|
667
|
+
}
|
|
668
|
+
/** Name of the renamed interpreter the stubs delegate to. */
|
|
669
|
+
var REAL_PYTHON_NAME = "python3.real";
|
|
670
|
+
/** Scripts bigger than this are never rewritten (a binary or a data file). */
|
|
671
|
+
var MAX_SCRIPT_BYTES = 1048576;
|
|
672
|
+
/** How much of a file is read to tell a script from a binary. */
|
|
673
|
+
var PROBE_BYTES = 512;
|
|
674
|
+
/**
|
|
675
|
+
* The text of the arch stub. It resolves `python3.real` relative to its own
|
|
676
|
+
* location (following a symlinked invocation), so it survives a move.
|
|
677
|
+
*/
|
|
678
|
+
function renderArchStub(archFlag) {
|
|
679
|
+
return [
|
|
680
|
+
"#!/bin/sh",
|
|
681
|
+
"p=$0",
|
|
682
|
+
"while [ -L \"$p\" ]; do",
|
|
683
|
+
" l=$(readlink \"$p\")",
|
|
684
|
+
" case $l in /*) p=$l ;; *) p=$(dirname \"$p\")/$l ;; esac",
|
|
685
|
+
"done",
|
|
686
|
+
`exec /usr/bin/arch ${archFlag} "$(cd "$(dirname "$p")" && pwd)/${REAL_PYTHON_NAME}" "$@"`,
|
|
687
|
+
""
|
|
688
|
+
].join("\n");
|
|
689
|
+
}
|
|
690
|
+
/** A shebang naming an absolute portable interpreter: `#!<dir>/bin/python3`. */
|
|
691
|
+
var SHEBANG_PATH = /^(#!)(\/[^"'\n]+?)\/bin\/(python3\.real|python3|python)(?![\w.])/;
|
|
692
|
+
/** The pip console-script re-exec line: `'''exec' "<dir>/bin/python3.real" "$0" "$@"`. */
|
|
693
|
+
var EXEC_LINE_PATH = /^('''exec' ")(\/[^"\n]+?)\/bin\/(python3\.real)(?![\w.])/;
|
|
694
|
+
function relocateLine(line, pattern, binDir) {
|
|
695
|
+
return line.replace(pattern, (whole, lead, dir, name) => `${dir}/bin` === binDir || (0, node_fs.existsSync)(`${dir}/bin/${name}`) ? whole : `${lead}${binDir}/${name}`);
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Rewrites the absolute interpreter path of the shebang (line 1) and of pip's
|
|
699
|
+
* `'''exec'` line (line 2) when it lies under a directory other than `binDir`.
|
|
700
|
+
* Any other path in those lines (a comment) and any interpreter that still exists (a system shebang) is left alone.
|
|
701
|
+
* Null when nothing needs to change.
|
|
702
|
+
*/
|
|
703
|
+
function relocateInterpreterHeader(text, binDir) {
|
|
704
|
+
const lines = text.split("\n");
|
|
705
|
+
const first = relocateLine(lines[0] ?? "", SHEBANG_PATH, binDir);
|
|
706
|
+
const second = relocateLine(lines[1] ?? "", EXEC_LINE_PATH, binDir);
|
|
707
|
+
if (first === lines[0] && second === (lines[1] ?? "")) return null;
|
|
708
|
+
return [
|
|
709
|
+
first,
|
|
710
|
+
...lines.length > 1 ? [second] : [],
|
|
711
|
+
...lines.slice(2)
|
|
712
|
+
].join("\n");
|
|
713
|
+
}
|
|
714
|
+
function isRegularFile(path) {
|
|
715
|
+
try {
|
|
716
|
+
return (0, node_fs.lstatSync)(path).isFile();
|
|
717
|
+
} catch {
|
|
718
|
+
return false;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Replaces `path` atomically (temp file beside it, same mode, rename): several
|
|
723
|
+
* runners call `ensurePython` at once and none may exec a half-written file.
|
|
724
|
+
*/
|
|
725
|
+
function writeFileAtomic$1(path, content, mode) {
|
|
726
|
+
const tmp = `${path}.heal-${process.pid}-${Date.now()}`;
|
|
727
|
+
(0, node_fs.writeFileSync)(tmp, content);
|
|
728
|
+
(0, node_fs.chmodSync)(tmp, mode);
|
|
729
|
+
(0, node_fs.renameSync)(tmp, path);
|
|
730
|
+
}
|
|
731
|
+
/** The first `PROBE_BYTES` bytes of a file, without reading the rest. */
|
|
732
|
+
function readProbe(path) {
|
|
733
|
+
const fd = (0, node_fs.openSync)(path, "r");
|
|
734
|
+
try {
|
|
735
|
+
const buf = Buffer.alloc(PROBE_BYTES);
|
|
736
|
+
const n = (0, node_fs.readSync)(fd, buf, 0, PROBE_BYTES, 0);
|
|
737
|
+
return buf.subarray(0, n);
|
|
738
|
+
} finally {
|
|
739
|
+
(0, node_fs.closeSync)(fd);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Brings the install in `pythonDir` up to date: the arch stubs are the
|
|
744
|
+
* relative form, and no regular script in `bin/` names an interpreter under
|
|
745
|
+
* another directory. Bounded to `bin/`, to the first two lines, to text files.
|
|
746
|
+
* Never throws; returns how many files it rewrote.
|
|
747
|
+
*/
|
|
748
|
+
function healPortablePython(pythonDir, archFlag, logger) {
|
|
749
|
+
const binDir = (0, node_path.join)(pythonDir, "bin");
|
|
750
|
+
let healed = 0;
|
|
751
|
+
try {
|
|
752
|
+
if (!(0, node_fs.existsSync)((0, node_path.join)(binDir, "python3.real"))) return 0;
|
|
753
|
+
const stub = renderArchStub(archFlag);
|
|
754
|
+
for (const name of ["python3", "python"]) {
|
|
755
|
+
const path = (0, node_path.join)(binDir, name);
|
|
756
|
+
if (!isRegularFile(path)) continue;
|
|
757
|
+
const text = (0, node_fs.readFileSync)(path, "utf8");
|
|
758
|
+
if (text === stub || !text.startsWith("#!/bin/sh\n")) continue;
|
|
759
|
+
if (!text.includes("/usr/bin/arch")) continue;
|
|
760
|
+
writeFileAtomic$1(path, stub, 493);
|
|
761
|
+
healed += 1;
|
|
762
|
+
}
|
|
763
|
+
for (const name of (0, node_fs.readdirSync)(binDir)) {
|
|
764
|
+
const path = (0, node_path.join)(binDir, name);
|
|
765
|
+
try {
|
|
766
|
+
if (!isRegularFile(path)) continue;
|
|
767
|
+
const stat = (0, node_fs.lstatSync)(path);
|
|
768
|
+
if (stat.size > MAX_SCRIPT_BYTES) continue;
|
|
769
|
+
const probe = readProbe(path);
|
|
770
|
+
if (probe.subarray(0, 2).toString("latin1") !== "#!" || probe.includes(0)) continue;
|
|
771
|
+
const next = relocateInterpreterHeader((0, node_fs.readFileSync)(path, "utf8"), binDir);
|
|
772
|
+
if (next === null) continue;
|
|
773
|
+
writeFileAtomic$1(path, next, stat.mode & 511);
|
|
774
|
+
healed += 1;
|
|
775
|
+
} catch (err) {
|
|
776
|
+
logger.warn("Could not repair a portable Python script", { meta: {
|
|
777
|
+
path,
|
|
778
|
+
error: require_composed_stable_id.errMsg(err)
|
|
779
|
+
} });
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
if (healed > 0) logger.info("Repaired portable Python after its folder moved", { meta: {
|
|
783
|
+
healed,
|
|
784
|
+
binDir
|
|
785
|
+
} });
|
|
786
|
+
} catch (err) {
|
|
787
|
+
logger.warn("Portable Python repair failed; continuing", { meta: {
|
|
788
|
+
binDir,
|
|
789
|
+
error: require_composed_stable_id.errMsg(err)
|
|
790
|
+
} });
|
|
791
|
+
}
|
|
792
|
+
return healed;
|
|
793
|
+
}
|
|
794
|
+
//#endregion
|
|
653
795
|
//#region src/deps/python-downloader.ts
|
|
654
796
|
/**
|
|
655
797
|
* Download portable Python (headless) from bjia56/portable-python.
|
|
@@ -730,6 +872,7 @@ async function ensurePython(dataDir, logger) {
|
|
|
730
872
|
const pythonDir = (0, node_path.join)(dataDir, "deps", "python");
|
|
731
873
|
const pythonBin = (0, node_path.join)(pythonDir, ...pythonInterpreterSegments(process.platform));
|
|
732
874
|
if ((0, node_fs.existsSync)(pythonBin)) {
|
|
875
|
+
if (process.platform === "darwin") healPortablePython(pythonDir, archFlagFor(process.arch), logger);
|
|
733
876
|
logger.debug("Portable Python found", { meta: { pythonBin } });
|
|
734
877
|
return pythonBin;
|
|
735
878
|
}
|
|
@@ -768,18 +911,18 @@ async function ensurePython(dataDir, logger) {
|
|
|
768
911
|
}
|
|
769
912
|
(0, node_fs.chmodSync)(pythonBin, 493);
|
|
770
913
|
if (process.platform === "darwin") {
|
|
771
|
-
const realBin = (0, node_path.join)(pythonDir, "bin",
|
|
914
|
+
const realBin = (0, node_path.join)(pythonDir, "bin", REAL_PYTHON_NAME);
|
|
915
|
+
const archFlag = archFlagFor(process.arch);
|
|
772
916
|
if (!(0, node_fs.existsSync)(realBin)) {
|
|
773
917
|
(0, node_fs.renameSync)(pythonBin, realBin);
|
|
774
|
-
|
|
775
|
-
(0, node_fs.writeFileSync)(pythonBin, `#!/bin/sh\nexec /usr/bin/arch ${archFlag} "${realBin}" "$@"\n`);
|
|
918
|
+
(0, node_fs.writeFileSync)(pythonBin, renderArchStub(archFlag));
|
|
776
919
|
(0, node_fs.chmodSync)(pythonBin, 493);
|
|
777
920
|
const pyAlt = (0, node_path.join)(pythonDir, "bin", "python");
|
|
778
921
|
if ((0, node_fs.existsSync)(pyAlt)) {
|
|
779
922
|
try {
|
|
780
923
|
(0, node_fs.rmSync)(pyAlt, { force: true });
|
|
781
924
|
} catch {}
|
|
782
|
-
(0, node_fs.writeFileSync)(pyAlt,
|
|
925
|
+
(0, node_fs.writeFileSync)(pyAlt, renderArchStub(archFlag));
|
|
783
926
|
(0, node_fs.chmodSync)(pyAlt, 493);
|
|
784
927
|
}
|
|
785
928
|
logger.info("Locked python3 to host arch via shell stub", { meta: {
|
|
@@ -787,6 +930,7 @@ async function ensurePython(dataDir, logger) {
|
|
|
787
930
|
realBin
|
|
788
931
|
} });
|
|
789
932
|
}
|
|
933
|
+
healPortablePython(pythonDir, archFlag, logger);
|
|
790
934
|
}
|
|
791
935
|
logger.info("Portable Python installed", { meta: {
|
|
792
936
|
version: PYTHON_VERSION,
|
package/dist/node.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as errMsg } from "./composed-stable-id-C7b2bPOX.mjs";
|
|
2
2
|
import { Cr as egressTransportFromRequest, Nr as isSoftwareDecode, Sr as canonicalEgressPlan, X as compositionSourceKey, _r as chooseFfmpegBinary, a as directedBroadcastOf, br as getFfmpegArtifact, c as implementedMethodsOf, gr as FFMPEG_PATH_ENV, i as buildMagicPacket, kr as buildFfmpegArgs, o as ipv4ToUint32, p as CUSTOMIZATION_BLOCK_NAME_PREFIX, s as parseMacAddress, vr as ffmpegBinaryName, wr as Fmp4BoxSplitter, xr as getFfmpegDownloadUrl, yr as FFMPEG_RELEASE } from "./wake-on-lan-DqbzeHhm.mjs";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
|
-
import { chmodSync, copyFileSync, createWriteStream, existsSync, mkdirSync, promises, readFileSync, readdirSync, realpathSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { chmodSync, closeSync, copyFileSync, createWriteStream, existsSync, lstatSync, mkdirSync, openSync, promises, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
6
6
|
import path, { basename, dirname, join, resolve, sep } from "node:path";
|
|
7
7
|
import { pipeline } from "node:stream/promises";
|
|
@@ -627,6 +627,148 @@ function writeOwnerOnlyFileSync(target, data, overrides = {}) {
|
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
//#endregion
|
|
630
|
+
//#region src/deps/python-portable-relocate.ts
|
|
631
|
+
/**
|
|
632
|
+
* Keeps the macOS portable Python runnable after its folder is moved.
|
|
633
|
+
*
|
|
634
|
+
* The arch-locking stub that replaces `bin/python3` used to embed the absolute
|
|
635
|
+
* path of `python3.real`, and pip's console scripts embed the absolute path of
|
|
636
|
+
* the interpreter that installed them. Move the data directory and every one of
|
|
637
|
+
* them points at a path that no longer exists. The stub now finds the real
|
|
638
|
+
* binary beside itself at run time, and {@link healPortablePython} rewrites the
|
|
639
|
+
* leftovers of an install made before that.
|
|
640
|
+
*/
|
|
641
|
+
/** The `arch` flag for a Node `process.arch` value. */
|
|
642
|
+
function archFlagFor(arch) {
|
|
643
|
+
return arch === "arm64" ? "-arm64" : "-x86_64";
|
|
644
|
+
}
|
|
645
|
+
/** Name of the renamed interpreter the stubs delegate to. */
|
|
646
|
+
var REAL_PYTHON_NAME = "python3.real";
|
|
647
|
+
/** Scripts bigger than this are never rewritten (a binary or a data file). */
|
|
648
|
+
var MAX_SCRIPT_BYTES = 1048576;
|
|
649
|
+
/** How much of a file is read to tell a script from a binary. */
|
|
650
|
+
var PROBE_BYTES = 512;
|
|
651
|
+
/**
|
|
652
|
+
* The text of the arch stub. It resolves `python3.real` relative to its own
|
|
653
|
+
* location (following a symlinked invocation), so it survives a move.
|
|
654
|
+
*/
|
|
655
|
+
function renderArchStub(archFlag) {
|
|
656
|
+
return [
|
|
657
|
+
"#!/bin/sh",
|
|
658
|
+
"p=$0",
|
|
659
|
+
"while [ -L \"$p\" ]; do",
|
|
660
|
+
" l=$(readlink \"$p\")",
|
|
661
|
+
" case $l in /*) p=$l ;; *) p=$(dirname \"$p\")/$l ;; esac",
|
|
662
|
+
"done",
|
|
663
|
+
`exec /usr/bin/arch ${archFlag} "$(cd "$(dirname "$p")" && pwd)/${REAL_PYTHON_NAME}" "$@"`,
|
|
664
|
+
""
|
|
665
|
+
].join("\n");
|
|
666
|
+
}
|
|
667
|
+
/** A shebang naming an absolute portable interpreter: `#!<dir>/bin/python3`. */
|
|
668
|
+
var SHEBANG_PATH = /^(#!)(\/[^"'\n]+?)\/bin\/(python3\.real|python3|python)(?![\w.])/;
|
|
669
|
+
/** The pip console-script re-exec line: `'''exec' "<dir>/bin/python3.real" "$0" "$@"`. */
|
|
670
|
+
var EXEC_LINE_PATH = /^('''exec' ")(\/[^"\n]+?)\/bin\/(python3\.real)(?![\w.])/;
|
|
671
|
+
function relocateLine(line, pattern, binDir) {
|
|
672
|
+
return line.replace(pattern, (whole, lead, dir, name) => `${dir}/bin` === binDir || existsSync(`${dir}/bin/${name}`) ? whole : `${lead}${binDir}/${name}`);
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Rewrites the absolute interpreter path of the shebang (line 1) and of pip's
|
|
676
|
+
* `'''exec'` line (line 2) when it lies under a directory other than `binDir`.
|
|
677
|
+
* Any other path in those lines (a comment) and any interpreter that still exists (a system shebang) is left alone.
|
|
678
|
+
* Null when nothing needs to change.
|
|
679
|
+
*/
|
|
680
|
+
function relocateInterpreterHeader(text, binDir) {
|
|
681
|
+
const lines = text.split("\n");
|
|
682
|
+
const first = relocateLine(lines[0] ?? "", SHEBANG_PATH, binDir);
|
|
683
|
+
const second = relocateLine(lines[1] ?? "", EXEC_LINE_PATH, binDir);
|
|
684
|
+
if (first === lines[0] && second === (lines[1] ?? "")) return null;
|
|
685
|
+
return [
|
|
686
|
+
first,
|
|
687
|
+
...lines.length > 1 ? [second] : [],
|
|
688
|
+
...lines.slice(2)
|
|
689
|
+
].join("\n");
|
|
690
|
+
}
|
|
691
|
+
function isRegularFile(path) {
|
|
692
|
+
try {
|
|
693
|
+
return lstatSync(path).isFile();
|
|
694
|
+
} catch {
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Replaces `path` atomically (temp file beside it, same mode, rename): several
|
|
700
|
+
* runners call `ensurePython` at once and none may exec a half-written file.
|
|
701
|
+
*/
|
|
702
|
+
function writeFileAtomic$1(path, content, mode) {
|
|
703
|
+
const tmp = `${path}.heal-${process.pid}-${Date.now()}`;
|
|
704
|
+
writeFileSync(tmp, content);
|
|
705
|
+
chmodSync(tmp, mode);
|
|
706
|
+
renameSync(tmp, path);
|
|
707
|
+
}
|
|
708
|
+
/** The first `PROBE_BYTES` bytes of a file, without reading the rest. */
|
|
709
|
+
function readProbe(path) {
|
|
710
|
+
const fd = openSync(path, "r");
|
|
711
|
+
try {
|
|
712
|
+
const buf = Buffer.alloc(PROBE_BYTES);
|
|
713
|
+
const n = readSync(fd, buf, 0, PROBE_BYTES, 0);
|
|
714
|
+
return buf.subarray(0, n);
|
|
715
|
+
} finally {
|
|
716
|
+
closeSync(fd);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Brings the install in `pythonDir` up to date: the arch stubs are the
|
|
721
|
+
* relative form, and no regular script in `bin/` names an interpreter under
|
|
722
|
+
* another directory. Bounded to `bin/`, to the first two lines, to text files.
|
|
723
|
+
* Never throws; returns how many files it rewrote.
|
|
724
|
+
*/
|
|
725
|
+
function healPortablePython(pythonDir, archFlag, logger) {
|
|
726
|
+
const binDir = join(pythonDir, "bin");
|
|
727
|
+
let healed = 0;
|
|
728
|
+
try {
|
|
729
|
+
if (!existsSync(join(binDir, "python3.real"))) return 0;
|
|
730
|
+
const stub = renderArchStub(archFlag);
|
|
731
|
+
for (const name of ["python3", "python"]) {
|
|
732
|
+
const path = join(binDir, name);
|
|
733
|
+
if (!isRegularFile(path)) continue;
|
|
734
|
+
const text = readFileSync(path, "utf8");
|
|
735
|
+
if (text === stub || !text.startsWith("#!/bin/sh\n")) continue;
|
|
736
|
+
if (!text.includes("/usr/bin/arch")) continue;
|
|
737
|
+
writeFileAtomic$1(path, stub, 493);
|
|
738
|
+
healed += 1;
|
|
739
|
+
}
|
|
740
|
+
for (const name of readdirSync(binDir)) {
|
|
741
|
+
const path = join(binDir, name);
|
|
742
|
+
try {
|
|
743
|
+
if (!isRegularFile(path)) continue;
|
|
744
|
+
const stat = lstatSync(path);
|
|
745
|
+
if (stat.size > MAX_SCRIPT_BYTES) continue;
|
|
746
|
+
const probe = readProbe(path);
|
|
747
|
+
if (probe.subarray(0, 2).toString("latin1") !== "#!" || probe.includes(0)) continue;
|
|
748
|
+
const next = relocateInterpreterHeader(readFileSync(path, "utf8"), binDir);
|
|
749
|
+
if (next === null) continue;
|
|
750
|
+
writeFileAtomic$1(path, next, stat.mode & 511);
|
|
751
|
+
healed += 1;
|
|
752
|
+
} catch (err) {
|
|
753
|
+
logger.warn("Could not repair a portable Python script", { meta: {
|
|
754
|
+
path,
|
|
755
|
+
error: errMsg(err)
|
|
756
|
+
} });
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
if (healed > 0) logger.info("Repaired portable Python after its folder moved", { meta: {
|
|
760
|
+
healed,
|
|
761
|
+
binDir
|
|
762
|
+
} });
|
|
763
|
+
} catch (err) {
|
|
764
|
+
logger.warn("Portable Python repair failed; continuing", { meta: {
|
|
765
|
+
binDir,
|
|
766
|
+
error: errMsg(err)
|
|
767
|
+
} });
|
|
768
|
+
}
|
|
769
|
+
return healed;
|
|
770
|
+
}
|
|
771
|
+
//#endregion
|
|
630
772
|
//#region src/deps/python-downloader.ts
|
|
631
773
|
/**
|
|
632
774
|
* Download portable Python (headless) from bjia56/portable-python.
|
|
@@ -707,6 +849,7 @@ async function ensurePython(dataDir, logger) {
|
|
|
707
849
|
const pythonDir = join(dataDir, "deps", "python");
|
|
708
850
|
const pythonBin = join(pythonDir, ...pythonInterpreterSegments(process.platform));
|
|
709
851
|
if (existsSync(pythonBin)) {
|
|
852
|
+
if (process.platform === "darwin") healPortablePython(pythonDir, archFlagFor(process.arch), logger);
|
|
710
853
|
logger.debug("Portable Python found", { meta: { pythonBin } });
|
|
711
854
|
return pythonBin;
|
|
712
855
|
}
|
|
@@ -745,18 +888,18 @@ async function ensurePython(dataDir, logger) {
|
|
|
745
888
|
}
|
|
746
889
|
chmodSync(pythonBin, 493);
|
|
747
890
|
if (process.platform === "darwin") {
|
|
748
|
-
const realBin = join(pythonDir, "bin",
|
|
891
|
+
const realBin = join(pythonDir, "bin", REAL_PYTHON_NAME);
|
|
892
|
+
const archFlag = archFlagFor(process.arch);
|
|
749
893
|
if (!existsSync(realBin)) {
|
|
750
894
|
renameSync(pythonBin, realBin);
|
|
751
|
-
|
|
752
|
-
writeFileSync(pythonBin, `#!/bin/sh\nexec /usr/bin/arch ${archFlag} "${realBin}" "$@"\n`);
|
|
895
|
+
writeFileSync(pythonBin, renderArchStub(archFlag));
|
|
753
896
|
chmodSync(pythonBin, 493);
|
|
754
897
|
const pyAlt = join(pythonDir, "bin", "python");
|
|
755
898
|
if (existsSync(pyAlt)) {
|
|
756
899
|
try {
|
|
757
900
|
rmSync(pyAlt, { force: true });
|
|
758
901
|
} catch {}
|
|
759
|
-
writeFileSync(pyAlt,
|
|
902
|
+
writeFileSync(pyAlt, renderArchStub(archFlag));
|
|
760
903
|
chmodSync(pyAlt, 493);
|
|
761
904
|
}
|
|
762
905
|
logger.info("Locked python3 to host arch via shell stub", { meta: {
|
|
@@ -764,6 +907,7 @@ async function ensurePython(dataDir, logger) {
|
|
|
764
907
|
realBin
|
|
765
908
|
} });
|
|
766
909
|
}
|
|
910
|
+
healPortablePython(pythonDir, archFlag, logger);
|
|
767
911
|
}
|
|
768
912
|
logger.info("Portable Python installed", { meta: {
|
|
769
913
|
version: PYTHON_VERSION,
|