pinokiod 3.8.99 → 3.8.100
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/index.js +1 -1
- package/kernel/procs.js +0 -2
- package/kernel/router/index.js +1 -13
- package/kernel/util.js +0 -1
- package/package.json +1 -1
- package/server/index.js +3 -2
package/kernel/index.js
CHANGED
|
@@ -282,7 +282,7 @@ class Kernel {
|
|
|
282
282
|
// refresh router info
|
|
283
283
|
await this.router.refresh()
|
|
284
284
|
console.log("router info", this.router.published())
|
|
285
|
-
await this.peer.refresh()
|
|
285
|
+
// await this.peer.refresh()
|
|
286
286
|
|
|
287
287
|
if (notify_peers) {
|
|
288
288
|
// broadcast to peers to refresh
|
package/kernel/procs.js
CHANGED
|
@@ -17,7 +17,6 @@ class Procs {
|
|
|
17
17
|
const lines = stdout.trim().split('\n');
|
|
18
18
|
|
|
19
19
|
lines.forEach(line => {
|
|
20
|
-
console.log({ line })
|
|
21
20
|
if (isWin) {
|
|
22
21
|
// Skip headers
|
|
23
22
|
if (!line.startsWith(' TCP')) return;
|
|
@@ -107,7 +106,6 @@ class Procs {
|
|
|
107
106
|
});
|
|
108
107
|
});
|
|
109
108
|
})
|
|
110
|
-
console.log( { list } )
|
|
111
109
|
console.timeEnd("Get list")
|
|
112
110
|
this.info = list
|
|
113
111
|
}
|
package/kernel/router/index.js
CHANGED
|
@@ -36,12 +36,8 @@ class Router {
|
|
|
36
36
|
this._mapping[host][dial] = new Set()
|
|
37
37
|
}
|
|
38
38
|
this._mapping[host][dial].add(match)
|
|
39
|
-
console.log(">this._mapping", this._mapping)
|
|
40
39
|
}
|
|
41
40
|
info() {
|
|
42
|
-
console.log("#### this.mapping", this.mapping)
|
|
43
|
-
|
|
44
|
-
|
|
45
41
|
let mapping = {}
|
|
46
42
|
for(let host in this.mapping) {
|
|
47
43
|
let internal_maps = this.mapping[host]
|
|
@@ -53,14 +49,12 @@ class Router {
|
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
51
|
|
|
56
|
-
console.log("mapping", mapping)
|
|
57
52
|
let json = JSON.stringify(mapping)
|
|
58
53
|
for(let key in this.port_cache) {
|
|
59
54
|
console.log("replacing", key, "with", this.port_cache[key])
|
|
60
55
|
json = json.replaceAll(key, this.port_cache[key])
|
|
61
56
|
}
|
|
62
57
|
let m = JSON.parse(json)
|
|
63
|
-
console.log({ m })
|
|
64
58
|
return m
|
|
65
59
|
// return mapping
|
|
66
60
|
}
|
|
@@ -89,13 +83,13 @@ class Router {
|
|
|
89
83
|
pub[dial] = matches
|
|
90
84
|
}
|
|
91
85
|
}
|
|
86
|
+
console.log({ pub })
|
|
92
87
|
return pub
|
|
93
88
|
}
|
|
94
89
|
async fill() {
|
|
95
90
|
const jsonString = JSON.stringify(this.config)
|
|
96
91
|
// find all PORT_PLACEHOLDER patterns
|
|
97
92
|
const matches = jsonString.match(/:PORT_PLACEHOLDER_[0-9.:]+/g)
|
|
98
|
-
console.log("matches", matches)
|
|
99
93
|
|
|
100
94
|
// iterate through them and see if the port already exists
|
|
101
95
|
let count = matches ? new Set(matches).size : 0
|
|
@@ -114,14 +108,11 @@ class Router {
|
|
|
114
108
|
}
|
|
115
109
|
*/
|
|
116
110
|
|
|
117
|
-
console.log("count", count)
|
|
118
111
|
|
|
119
112
|
let new_config
|
|
120
113
|
|
|
121
114
|
if (count > 0) {
|
|
122
115
|
let ports = await this.kernel.ports(count)
|
|
123
|
-
console.log({ count, ports })
|
|
124
|
-
console.log("PORT_CACHE", this.port_cache)
|
|
125
116
|
let response = Util.fill_object(this.config, /PORT_PLACEHOLDER_.+/, ports, this.port_cache)
|
|
126
117
|
this.config = response.result
|
|
127
118
|
let replaced_map = response.replaced_map
|
|
@@ -132,7 +123,6 @@ class Router {
|
|
|
132
123
|
let local_share_ip = chunks[0]
|
|
133
124
|
let original_port = chunks[1]
|
|
134
125
|
let local_share_port = replaced_map[key]
|
|
135
|
-
console.log({ local_share_ip, local_share_port })
|
|
136
126
|
if (!this.local_network_mapping[local_share_ip]) {
|
|
137
127
|
this.local_network_mapping[local_share_ip] = {}
|
|
138
128
|
}
|
|
@@ -144,8 +134,6 @@ class Router {
|
|
|
144
134
|
}
|
|
145
135
|
this.port_cache = replaced_map
|
|
146
136
|
}
|
|
147
|
-
console.log("port_cache", this.port_cache)
|
|
148
|
-
console.log("port_mapping", this.port_mapping)
|
|
149
137
|
|
|
150
138
|
}
|
|
151
139
|
|
package/kernel/util.js
CHANGED
|
@@ -307,7 +307,6 @@ const update_env = async (filepath, changes) => {
|
|
|
307
307
|
await fs.promises.writeFile(filepath, newval)
|
|
308
308
|
};
|
|
309
309
|
function fill_object(obj, pattern, list, cache) {
|
|
310
|
-
console.log("FILL_OBJECT", { obj, pattern, list, cache })
|
|
311
310
|
const map = {};
|
|
312
311
|
const replaced_map = cache || {}
|
|
313
312
|
let index = 0;
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -2260,6 +2260,7 @@ class Server {
|
|
|
2260
2260
|
|
|
2261
2261
|
|
|
2262
2262
|
await this.kernel.init({ port: this.port})
|
|
2263
|
+
this.kernel.peer.start(this.kernel)
|
|
2263
2264
|
|
|
2264
2265
|
|
|
2265
2266
|
if (needInitHome) {
|
|
@@ -3882,7 +3883,7 @@ class Server {
|
|
|
3882
3883
|
console.log({ peer_info: this.kernel.peer.info })
|
|
3883
3884
|
console.time("check_peer")
|
|
3884
3885
|
let ready = true
|
|
3885
|
-
if (this.kernel.peer.info) {
|
|
3886
|
+
if (this.kernel.peer.info && Object.keys(this.kernel.peer.info).length > 0) {
|
|
3886
3887
|
for(let host in this.kernel.peer.info) {
|
|
3887
3888
|
let info = this.kernel.peer.info[host]
|
|
3888
3889
|
if (info.router && Object.keys(info.router).length > 0) {
|
|
@@ -3996,7 +3997,7 @@ class Server {
|
|
|
3996
3997
|
server: this.listening
|
|
3997
3998
|
});
|
|
3998
3999
|
})
|
|
3999
|
-
this.kernel.peer.start(this.kernel)
|
|
4000
|
+
// this.kernel.peer.start(this.kernel)
|
|
4000
4001
|
|
|
4001
4002
|
|
|
4002
4003
|
}
|