pinokiod 3.8.53 → 3.8.54
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.
|
@@ -15,7 +15,7 @@ class LocalhostVariableRouter extends Processor {
|
|
|
15
15
|
let val = local_variables_for_script[key]
|
|
16
16
|
if (val.startsWith("http")) {
|
|
17
17
|
let dial = val.replace(/https?:\/\//, '')
|
|
18
|
-
let name = this.api_name(script_path)
|
|
18
|
+
let name = this.api_name(this.kernel.homedir, script_path)
|
|
19
19
|
console.log({ dial, name, has_port: this.has_port(dial), parsed_dial: this.parse_ip(dial) })
|
|
20
20
|
if (this.has_port(dial)) {
|
|
21
21
|
if (key === "url") {
|
|
@@ -8,14 +8,15 @@ class PeerVariableRouter extends Processor {
|
|
|
8
8
|
this.connector = new Connector(router)
|
|
9
9
|
}
|
|
10
10
|
handle(peer) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
console.log("PeerVariableRouter", peer)
|
|
12
|
+
for(let script_path in peer.memory.local) {
|
|
13
|
+
let local_variables = peer.memory.local[script_path]
|
|
13
14
|
for(let key in local_variables) {
|
|
14
15
|
let val = local_variables[key]
|
|
15
16
|
console.log({ key, val })
|
|
16
17
|
if (val.startsWith("http")) {
|
|
17
18
|
let dial = val.replace(/https?:\/\//, '')
|
|
18
|
-
let name = this.api_name(script_path)
|
|
19
|
+
let name = this.api_name(peer.platform, peer.home, script_path)
|
|
19
20
|
console.log({ dial, name, has_port: this.has_port(dial), parsed_dial: this.parse_ip(dial) })
|
|
20
21
|
if (this.has_port(dial)) {
|
|
21
22
|
let parsed_dial = this.parse_ip(dial)
|
|
@@ -30,7 +31,7 @@ class PeerVariableRouter extends Processor {
|
|
|
30
31
|
host: peer.host,
|
|
31
32
|
})
|
|
32
33
|
}
|
|
33
|
-
connector({
|
|
34
|
+
this.connector.handle({
|
|
34
35
|
match:`${key}.${name}.${peer.name}.localhost`.toLowerCase(),
|
|
35
36
|
connector: {
|
|
36
37
|
host: peer.host,
|
|
@@ -4,11 +4,19 @@ class Processor {
|
|
|
4
4
|
let chunks = str.split(":")
|
|
5
5
|
return chunks.length === 2
|
|
6
6
|
}
|
|
7
|
-
api_name(str) {
|
|
8
|
-
let
|
|
9
|
-
let
|
|
7
|
+
api_name(platform, home, str) {
|
|
8
|
+
let _path = path[platform]
|
|
9
|
+
let api_path
|
|
10
|
+
let rel_path
|
|
11
|
+
if (platform === 'win32') {
|
|
12
|
+
api_path = _path.resolve(home, "api")
|
|
13
|
+
rel_path = _path.relative(api_path, str)
|
|
14
|
+
} else {
|
|
15
|
+
api_path = _path.resolve(home, "api")
|
|
16
|
+
rel_path = _path.relative(api_path, str)
|
|
17
|
+
}
|
|
10
18
|
console.log({ api_path, rel_path, })
|
|
11
|
-
return rel_path.split(
|
|
19
|
+
return rel_path.split(_path.sep)[0]
|
|
12
20
|
}
|
|
13
21
|
parse_ip(str) {
|
|
14
22
|
let chunks = str.split(":")
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -3260,6 +3260,8 @@ class Server {
|
|
|
3260
3260
|
this.app.get("/pinokio/peer", ex((req, res) => {
|
|
3261
3261
|
res.json({
|
|
3262
3262
|
home: this.kernel.homedir,
|
|
3263
|
+
arch: this.kernel.arch,
|
|
3264
|
+
platform: this.kernel.platform,
|
|
3263
3265
|
name: this.kernel.peer.name,
|
|
3264
3266
|
host: this.kernel.peer.host,
|
|
3265
3267
|
router: this.kernel.router.info(),
|