pinokiod 3.84.0 → 3.85.0

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
@@ -28,7 +28,7 @@ class PeerDiscovery {
28
28
  for(let host of peer_array) {
29
29
  if (this.host !== host) {
30
30
  let result = await this._refresh(host)
31
- console.log("check peeers", { host, result })
31
+ console.log("check peers", { host, result })
32
32
  if (!result) {
33
33
  console.log("delete host", host)
34
34
  this.peers.delete(host)
@@ -367,15 +367,21 @@ class PeerDiscovery {
367
367
  let d = Date.now()
368
368
  let router_info = await this.router_info()
369
369
  let installed = await this.installed()
370
- let peers = Object.values(this.info).filter((info) => {
371
- return info.host !== this.host
372
- }).map((info) => {
373
- return {
374
- name: info.name,
375
- host: info.host
376
- }
377
- })
370
+ let peers
371
+ if (this.info) {
372
+ peers = Object.values(this.info).filter((info) => {
373
+ return info.host !== this.host
374
+ }).map((info) => {
375
+ return {
376
+ name: info.name,
377
+ host: info.host
378
+ }
379
+ })
380
+ } else {
381
+ peers = []
382
+ }
378
383
  return {
384
+ active: this.active,
379
385
  version: this.kernel.version,
380
386
  home: this.kernel.homedir,
381
387
  arch: this.kernel.arch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.84.0",
3
+ "version": "3.85.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2664,11 +2664,13 @@ class Server {
2664
2664
  }
2665
2665
  getPeers() {
2666
2666
  let list = []
2667
- for(let key in this.kernel.peer.info) {
2668
- // if (key !== this.kernel.peer.host) {
2667
+ if (this.kernel.peer.active) {
2668
+ for(let key in this.kernel.peer.info) {
2669
2669
  let info = this.kernel.peer.info[key]
2670
- list.push(info)
2671
- // }
2670
+ if (info.active) {
2671
+ list.push(info)
2672
+ }
2673
+ }
2672
2674
  }
2673
2675
  return list
2674
2676
  }
@@ -4241,10 +4243,11 @@ class Server {
4241
4243
  return
4242
4244
  }
4243
4245
 
4244
-
4245
4246
  // let list = this.getPeerInfo()
4246
4247
  // console.log("peeerInfo", JSON.stringify(list, null, 2))
4248
+ console.time("check peers")
4247
4249
  await this.kernel.peer.check_peers()
4250
+ console.timeEnd("check peers")
4248
4251
 
4249
4252
 
4250
4253
  let peers = []
@@ -3,7 +3,7 @@
3
3
  width: 100%;
4
4
  }
5
5
  .url-modal-overlay .url-dropdown {
6
- max-height: 50%;
6
+ max-height: 50vh;
7
7
  }
8
8
  .url-dropdown {
9
9
  position: absolute;
@@ -335,10 +335,22 @@ function initUrlDropdown(config = {}) {
335
335
  const url = this.getAttribute('data-url');
336
336
  const type = this.getAttribute('data-host-type');
337
337
  urlInput.value = url;
338
- urlInput.setAttribute("data-host-type", type)
338
+ urlInput.setAttribute("data-host-type", type);
339
339
  hideDropdown();
340
- // Submit the form
341
- urlInput.closest('form').dispatchEvent(new Event('submit'));
340
+
341
+ // Navigate directly instead of dispatching submit event
342
+ if (type === "local") {
343
+ let redirect_uri = "/container?url=" + url;
344
+ location.href = redirect_uri;
345
+ } else {
346
+ let u = new URL(url);
347
+ if (String(u.port) === "42000") {
348
+ window.open(url, "_blank", 'self');
349
+ } else {
350
+ let redirect_uri = "/container?url=" + url;
351
+ location.href = redirect_uri;
352
+ }
353
+ }
342
354
  });
343
355
  });
344
356
 
@@ -558,10 +570,25 @@ function initUrlDropdown(config = {}) {
558
570
  modalDropdown.querySelectorAll('.url-dropdown-item:not(.non-selectable)').forEach(item => {
559
571
  item.addEventListener('click', function() {
560
572
  const url = this.getAttribute('data-url');
573
+ const type = this.getAttribute('data-host-type');
561
574
  modalInput.value = url;
562
575
  urlInput.value = url;
563
- urlInput.closest('form').dispatchEvent(new Event('submit'));
576
+ urlInput.setAttribute("data-host-type", type);
564
577
  closeMobileModal();
578
+
579
+ // Navigate directly instead of dispatching submit event
580
+ if (type === "local") {
581
+ let redirect_uri = "/container?url=" + url;
582
+ location.href = redirect_uri;
583
+ } else {
584
+ let u = new URL(url);
585
+ if (String(u.port) === "42000") {
586
+ window.open(url, "_blank", 'self');
587
+ } else {
588
+ let redirect_uri = "/container?url=" + url;
589
+ location.href = redirect_uri;
590
+ }
591
+ }
565
592
  });
566
593
  });
567
594
 
@@ -936,6 +936,7 @@ body.dark .troubleshoot {
936
936
  color: rgba(255,255,255,0.5);
937
937
  }
938
938
  .troubleshoot {
939
+ padding-top: 15px;
939
940
  color: rgba(0,0,0,0.5);
940
941
  }
941
942
  .network-name.expanded .btn {
@@ -1126,7 +1127,6 @@ document.addEventListener('DOMContentLoaded', function() {
1126
1127
  </div>
1127
1128
  </div>
1128
1129
  <div class='advanced'>
1129
- <br>
1130
1130
  <!--
1131
1131
  <div id='advanced-label' class='link-label label'>Advanced</div>
1132
1132
  <div id='reset-label' class='btn'>Reset</div>