pinokiod 3.8.80 → 3.8.83

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/peer.js CHANGED
@@ -6,7 +6,6 @@ class PeerDiscovery {
6
6
  this.port = port;
7
7
  this.message = Buffer.from(message);
8
8
  this.interval = interval;
9
- this.socket = dgram.createSocket('udp4');
10
9
  this.peers = new Set();
11
10
  this.name = os.userInfo().username
12
11
  this.host = this._getLocalIPAddress()
@@ -16,7 +15,9 @@ class PeerDiscovery {
16
15
  start() {
17
16
  // Listen for incoming pings
18
17
  console.log("kernel.peer start")
18
+ this.socket = dgram.createSocket('udp4');
19
19
  this.socket.on('message', (msg, rinfo) => {
20
+ console.log("peer message", { msg, rinfo })
20
21
  const ip = rinfo.address;
21
22
  console.log({rinfo})
22
23
  if (msg.toString() === this.message.toString() && this._isLocalLAN(ip)) {
@@ -28,11 +29,14 @@ class PeerDiscovery {
28
29
  });
29
30
 
30
31
  // Enable broadcast
32
+ console.log("binding socket")
31
33
  this.socket.bind(this.port, () => {
34
+ console.log("socket bound")
32
35
  this.socket.setBroadcast(true);
33
36
 
34
37
  // Send broadcast pings every interval
35
38
  setInterval(() => {
39
+ console.log("send message to peers")
36
40
  this.socket.send(this.message, 0, this.message.length, this.port, '255.255.255.255');
37
41
  }, this.interval);
38
42
  });
@@ -20,7 +20,7 @@ class LocalhostHomeRouter {
20
20
  "Access-Control-Allow-Origin": ["*"],
21
21
  "Access-Control-Allow-Methods": ["GET, POST, OPTIONS, PUT, DELETE"],
22
22
  "Access-Control-Allow-Headers": ["*"],
23
- "Vary": ["Origin"]
23
+ "Vary": ["Origin"],
24
24
  }
25
25
  }
26
26
  },
@@ -30,6 +30,19 @@ class LocalhostHomeRouter {
30
30
  }
31
31
  ]
32
32
  },
33
+ {
34
+ "handle": [
35
+ {
36
+ "handler": "headers",
37
+ "request": {
38
+ "set": {
39
+ "X-Forwarded-Proto": ["https"],
40
+ "X-Forwarded-Host": ["{http.request.host}"]
41
+ }
42
+ }
43
+ }
44
+ ]
45
+ },
33
46
  {
34
47
  "match": [{ "host": [ this.router.default_match ] }],
35
48
  "handle": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.8.80",
3
+ "version": "3.8.83",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {