@monotykamary/localterm-server 1.41.2 → 1.41.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-spawn-helper-executable.d.ts","sourceRoot":"","sources":["../src/ensure-spawn-helper-executable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ensure-spawn-helper-executable.d.ts","sourceRoot":"","sources":["../src/ensure-spawn-helper-executable.ts"],"names":[],"mappings":"AAqEA,eAAO,MAAM,2BAA2B,QAAO,IA+B9C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { chmodSync, existsSync } from "node:fs";
|
|
2
|
-
import {
|
|
1
|
+
import { chmodSync, existsSync, statSync } from "node:fs";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
const requireCjs = createRequire(import.meta.url);
|
|
@@ -9,12 +9,59 @@ const candidateSpawnHelperPaths = (nodePtyDir) => [
|
|
|
9
9
|
path.join(nodePtyDir, "build", "Release", "spawn-helper"),
|
|
10
10
|
path.join(nodePtyDir, "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper"),
|
|
11
11
|
];
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
return;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const isExecutable = (filePath) => {
|
|
13
|
+
try {
|
|
14
|
+
return Boolean(statSync(filePath).mode & 0o111);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const hasQuarantine = (target) => {
|
|
21
|
+
try {
|
|
22
|
+
execFileSync("xattr", ["-p", "com.apple.quarantine", target], {
|
|
23
|
+
timeout: 5_000,
|
|
24
|
+
stdio: "pipe",
|
|
25
|
+
});
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const clearQuarantine = (target) => {
|
|
33
|
+
try {
|
|
34
|
+
execFileSync("xattr", ["-d", "com.apple.quarantine", target], {
|
|
35
|
+
timeout: 5_000,
|
|
36
|
+
stdio: "ignore",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// xattr not present or quarantine already cleared
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const hasValidSignature = (target) => {
|
|
44
|
+
try {
|
|
45
|
+
execFileSync("codesign", ["--verify", target], {
|
|
46
|
+
timeout: 10_000,
|
|
47
|
+
stdio: "ignore",
|
|
48
|
+
});
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const adHocSign = (target) => {
|
|
56
|
+
try {
|
|
57
|
+
execFileSync("codesign", ["--force", "--sign", "-", target], {
|
|
58
|
+
timeout: 10_000,
|
|
59
|
+
stdio: "ignore",
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// codesign unavailable; the binary may still work if not quarantined
|
|
64
|
+
}
|
|
18
65
|
};
|
|
19
66
|
export const ensureSpawnHelperExecutable = () => {
|
|
20
67
|
if (alreadyEnsured)
|
|
@@ -31,13 +78,22 @@ export const ensureSpawnHelperExecutable = () => {
|
|
|
31
78
|
for (const candidate of candidateSpawnHelperPaths(nodePtyDir)) {
|
|
32
79
|
if (!existsSync(candidate))
|
|
33
80
|
continue;
|
|
34
|
-
|
|
35
|
-
|
|
81
|
+
if (!isExecutable(candidate)) {
|
|
82
|
+
try {
|
|
83
|
+
chmodSync(candidate, SPAWN_HELPER_MODE);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// filesystem refused chmod (e.g. read-only mount)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (process.platform !== "darwin")
|
|
90
|
+
continue;
|
|
91
|
+
if (hasQuarantine(candidate)) {
|
|
92
|
+
clearQuarantine(candidate);
|
|
36
93
|
}
|
|
37
|
-
|
|
38
|
-
|
|
94
|
+
if (!hasValidSignature(candidate)) {
|
|
95
|
+
adHocSign(candidate);
|
|
39
96
|
}
|
|
40
|
-
clearQuarantineAndResign(candidate);
|
|
41
97
|
}
|
|
42
98
|
};
|
|
43
99
|
//# sourceMappingURL=ensure-spawn-helper-executable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-spawn-helper-executable.js","sourceRoot":"","sources":["../src/ensure-spawn-helper-executable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ensure-spawn-helper-executable.js","sourceRoot":"","sources":["../src/ensure-spawn-helper-executable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B,MAAM,yBAAyB,GAAG,CAAC,UAAkB,EAAY,EAAE,CAAC;IAClE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC;IACzD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,cAAc,C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1
1
|
{
|
|
2
2
|
"name": "@monotykamary/localterm-server",
|
|
3
|
-
"version": "1.41.
|
|
3
|
+
"version": "1.41.4",
|
|
4
4
|
"description": "PTY-backed HTTP/WebSocket server that powers localterm, built on Hono + node-pty.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hono",
|
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
"build": "tsc -p tsconfig.build.json",
|
|
73
73
|
"dev": "tsc -p tsconfig.build.json --watch",
|
|
74
74
|
"test": "vp test --run",
|
|
75
|
-
"typecheck": "tsc --noEmit"
|
|
75
|
+
"typecheck": "tsc -p tsconfig.build.json --noEmit"
|
|
76
76
|
}
|
|
77
77
|
}
|