pinokiod 3.10.8 → 3.10.10
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/kernel/bin/setup.js +4 -0
- package/kernel/procs.js +50 -35
- package/package.json +1 -1
package/kernel/bin/setup.js
CHANGED
|
@@ -57,6 +57,7 @@ module.exports = {
|
|
|
57
57
|
{ name: "conda", },
|
|
58
58
|
{ name: "git", },
|
|
59
59
|
{ name: "node", },
|
|
60
|
+
{ name: "py" },
|
|
60
61
|
],
|
|
61
62
|
conda_requirements: [
|
|
62
63
|
"node",
|
|
@@ -73,6 +74,7 @@ module.exports = {
|
|
|
73
74
|
{ name: "conda", },
|
|
74
75
|
{ name: "git", },
|
|
75
76
|
{ name: "uv", },
|
|
77
|
+
{ name: "py" },
|
|
76
78
|
],
|
|
77
79
|
conda_requirements: [
|
|
78
80
|
"uv",
|
|
@@ -120,6 +122,7 @@ module.exports = {
|
|
|
120
122
|
{ name: "conda", },
|
|
121
123
|
{ name: "git", },
|
|
122
124
|
{ name: "caddy", },
|
|
125
|
+
{ name: "py", },
|
|
123
126
|
],
|
|
124
127
|
conda_requirements: [
|
|
125
128
|
"git",
|
|
@@ -136,6 +139,7 @@ module.exports = {
|
|
|
136
139
|
{ name: "conda", },
|
|
137
140
|
{ name: "git", },
|
|
138
141
|
{ name: "caddy", },
|
|
142
|
+
{ name: "py", },
|
|
139
143
|
],
|
|
140
144
|
conda_requirements: [
|
|
141
145
|
"git",
|
package/kernel/procs.js
CHANGED
|
@@ -6,12 +6,18 @@ const platform = os.platform();
|
|
|
6
6
|
class Procs {
|
|
7
7
|
constructor () {
|
|
8
8
|
console.log("Initializing procs")
|
|
9
|
+
this.cache = {}
|
|
9
10
|
}
|
|
10
11
|
async isHttp(localAddress) {
|
|
12
|
+
if (this.cache.hasOwnProperty(localAddress)) {
|
|
13
|
+
return this.cache[localAddress]
|
|
14
|
+
}
|
|
11
15
|
try {
|
|
12
16
|
await axios.head(`http://${localAddress}`, { timeout: 1000 });
|
|
17
|
+
this.cache[localAddress] = true
|
|
13
18
|
return true;
|
|
14
19
|
} catch (err) {
|
|
20
|
+
this.cache[localAddress] = false
|
|
15
21
|
return false;
|
|
16
22
|
}
|
|
17
23
|
}
|
|
@@ -29,48 +35,57 @@ class Procs {
|
|
|
29
35
|
for(let line of lines) {
|
|
30
36
|
if (isWin) {
|
|
31
37
|
// Skip headers
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
try {
|
|
39
|
+
if (!line.startsWith(' TCP')) continue;
|
|
40
|
+
const parts = line.trim().split(/\s+/);
|
|
41
|
+
const [ , localAddress, , state, pid ] = parts;
|
|
42
|
+
|
|
43
|
+
//if (state !== 'LISTENING') continue;
|
|
44
|
+
const chunks = localAddress.split(":")
|
|
45
|
+
const port = chunks.pop()
|
|
46
|
+
let ip = chunks.pop()
|
|
47
|
+
if (!ip || ip === "*") {
|
|
48
|
+
ip = "127.0.0.1:" + port
|
|
49
|
+
} else {
|
|
50
|
+
ip = localAddress
|
|
51
|
+
}
|
|
35
52
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
ip = "127.0.0.1:" + port
|
|
44
|
-
} else {
|
|
45
|
-
ip = localAddress
|
|
53
|
+
let isHttp = await this.isHttp(ip)
|
|
54
|
+
if (!isHttp) continue
|
|
55
|
+
|
|
56
|
+
if (pids.has(pid+"/"+port)) continue;
|
|
57
|
+
pids.add(pid+"/"+port)
|
|
58
|
+
results.push({ port, pid, ip });
|
|
59
|
+
} catch (e) {
|
|
46
60
|
}
|
|
47
|
-
if (pids.has(pid+"/"+port)) continue;
|
|
48
|
-
pids.add(pid+"/"+port)
|
|
49
|
-
results.push({ port, pid, ip });
|
|
50
61
|
} else {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
// if (!/LISTEN/.test(line)) continue;
|
|
63
|
+
try {
|
|
64
|
+
const parts = line.trim().split(/\s+/);
|
|
65
|
+
const pid = parts[1];
|
|
66
|
+
|
|
67
|
+
const match = line.match(/([^\s]+:\d+)\s/);
|
|
68
|
+
const localAddress = match?.[1];
|
|
54
69
|
|
|
55
|
-
|
|
56
|
-
|
|
70
|
+
const chunks = localAddress.split(":")
|
|
71
|
+
const port = chunks.pop()
|
|
72
|
+
let ip = chunks.pop()
|
|
73
|
+
if (!ip || ip === "*") {
|
|
74
|
+
ip = "127.0.0.1:" + port
|
|
75
|
+
} else {
|
|
76
|
+
ip = localAddress
|
|
77
|
+
}
|
|
57
78
|
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
let isHttp = await this.isHttp(ip)
|
|
80
|
+
if (!isHttp) continue;
|
|
60
81
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
ip = localAddress
|
|
82
|
+
//const portMatch = line.match(/:(\d+)\s/);
|
|
83
|
+
//const port = portMatch?.[1];
|
|
84
|
+
if (pids.has(pid+"/"+port)) continue;
|
|
85
|
+
pids.add(pid+"/"+port)
|
|
86
|
+
if (pid && port) results.push({ port, pid, ip });
|
|
87
|
+
} catch (e) {
|
|
68
88
|
}
|
|
69
|
-
//const portMatch = line.match(/:(\d+)\s/);
|
|
70
|
-
//const port = portMatch?.[1];
|
|
71
|
-
if (pids.has(pid+"/"+port)) continue;
|
|
72
|
-
pids.add(pid+"/"+port)
|
|
73
|
-
if (pid && port) results.push({ port, pid, ip });
|
|
74
89
|
}
|
|
75
90
|
}
|
|
76
91
|
callback(null, results);
|