pinokiod 3.20.25 → 3.22.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.20.25",
3
+ "version": "3.22.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -3742,7 +3742,12 @@ class Server {
3742
3742
  // }
3743
3743
  // })
3744
3744
  //}))
3745
+ let pinokio_ip
3745
3746
  for(let proc of peer.processes) {
3747
+ if (proc.internal_port === 42000) {
3748
+ // pinokio ip
3749
+ pinokio_ip = proc.external_ip
3750
+ }
3746
3751
  if (proc.external_router) {
3747
3752
  // try to get icons from pinokio
3748
3753
  for(let router of proc.external_router) {
@@ -3755,31 +3760,39 @@ class Server {
3755
3760
  if (exists) {
3756
3761
  let meta = await this.kernel.api.meta(name)
3757
3762
  if (meta.icon) {
3758
- favicons[proc.ip] = meta.icon
3763
+ favicons[proc.external_ip] = meta.icon
3759
3764
  }
3760
3765
  if (meta.title) {
3761
- titles[proc.ip] = meta.title
3766
+ titles[proc.external_ip] = meta.title
3762
3767
  }
3763
3768
  if (meta.description) {
3764
- descriptions[proc.ip] = meta.description
3769
+ descriptions[proc.external_ip] = meta.description
3765
3770
  }
3766
3771
  }
3767
3772
  }
3768
3773
  }
3769
3774
  }
3770
3775
  // if not running from pinokio, try to fetch and infer the favicon
3771
- if (!favicons[proc.ip]) {
3772
- let favicon = await this.kernel.favicon.get("http://" + proc.ip)
3776
+ if (!favicons[proc.external_ip]) {
3777
+ let favicon = await this.kernel.favicon.get("http://" + proc.external_ip)
3773
3778
  if (favicon) {
3774
- favicons[proc.ip] = favicon
3779
+ favicons[proc.external_ip] = favicon
3775
3780
  }
3776
3781
  }
3777
3782
  }
3783
+ for (let external_ip in favicons) {
3784
+ let favicon_path = favicons[external_ip]
3785
+ if (!favicon_path.startsWith("http")) {
3786
+ favicons[external_ip] = "http://" + pinokio_ip + favicon_path
3787
+ }
3788
+ }
3778
3789
  console.timeEnd("Favicon")
3790
+ console.log("favicons", favicons)
3779
3791
 
3780
3792
  let current_urls = await this.current_urls(req.originalUrl.slice(1))
3781
3793
  console.log("LIST", JSON.stringify(list, null, 2))
3782
3794
  res.render("net", {
3795
+ selected_name: req.params.name,
3783
3796
  favicons,
3784
3797
  titles,
3785
3798
  descriptions,
@@ -214,6 +214,7 @@ main {
214
214
  border-left: 10px solid transparent;
215
215
  }
216
216
  aside {
217
+ width: 200px;
217
218
  display: block;
218
219
  flex-shrink: 0;
219
220
  border-right: 1px solid rgba(0,0,0,0.04);
@@ -239,16 +240,23 @@ aside .tab {
239
240
  border-left: 10px solid transparent;
240
241
  }
241
242
  body.dark aside .tab.selected {
243
+
242
244
  color: white;
245
+ /*
243
246
  border-left: 10px solid white;
247
+ */
244
248
  }
245
249
  aside .tab.selected {
250
+ /*
246
251
  border-left: 10px solid black;
252
+ */
247
253
  font-weight: bold;
248
254
  opacity: 1;
249
255
  }
250
256
  body.dark aside .current.selected {
257
+ /*
251
258
  border-left: 10px solid white;
259
+ */
252
260
  }
253
261
  @media only screen and (max-width: 480px) {
254
262
  .btn2 {
@@ -375,18 +383,10 @@ body.dark aside .current.selected {
375
383
  <a href="/" class='tab selected'><i class='fas fa-laptop-code'></i> Local</a>
376
384
  <a href="/network" class='tab'><i class="fa-solid fa-wifi"></i> Network</a>
377
385
  <% if (list.length > 0) { %>
378
- <div class='tab'>
379
- <div class='submenu'>
380
- <% let brands = { win32: "windows", darwin: "apple", linux: "Linux" } %>
381
- <% list.forEach(({ host, name, platform, processes }, index) => { %>
382
- <% if (current_host === host) { %>
383
- <a href="/net/<%=name%>" class='tab <%=current_host === host ? 'current' : ''%>'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (this machine)</div></a>
384
- <% } else { %>
385
- <a href="/net/<%=name%>" class='tab <%=current_host === host ? 'current' : ''%>'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (<%=host%>)</div></a>
386
- <% } %>
387
- <% }) %>
388
- </div>
389
- </div>
386
+ <% let brands = { win32: "windows", darwin: "apple", linux: "Linux" } %>
387
+ <% list.forEach(({ host, name, platform, processes }, index) => { %>
388
+ <a href="/net/<%=name%>" class='submenu tab'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (<%=current_host === host ? 'this machine' : host%>)</a>
389
+ <% }) %>
390
390
  <% } %>
391
391
  <div class='tab'><i class="fa-solid fa-code"></i> Dev</div>
392
392
  </aside>
@@ -296,6 +296,7 @@ main {
296
296
  display: flex;
297
297
  }
298
298
  aside {
299
+ width: 200px;
299
300
  display: block;
300
301
  flex-shrink: 0;
301
302
  border-right: 1px solid rgba(0,0,0,0.04);
@@ -327,14 +328,16 @@ aside .selected {
327
328
  font-weight: bold;
328
329
  opacity: 1;
329
330
  }
330
- body.dark aside .current.selected {
331
+ /*
332
+ body.dark aside .selected {
331
333
  border-left: 10px solid white;
332
334
  }
333
- aside .current.selected {
335
+ aside .selected {
334
336
  border-left: 10px solid black;
335
337
  font-weight: bold;
336
338
  opacity: 1;
337
339
  }
340
+ */
338
341
  .submenu .tab {
339
342
  padding: 0;
340
343
  }
@@ -440,18 +443,14 @@ body.dark .net {
440
443
  <a href="/" class='tab'><i class='fas fa-laptop-code'></i> Local</a>
441
444
  <a href="/network" class='tab'><i class="fa-solid fa-wifi"></i> Network</a>
442
445
  <% if (list.length > 0) { %>
443
- <div class='tab selected'>
444
- <div class='submenu'>
445
- <% let brands = { win32: "windows", darwin: "apple", linux: "Linux" } %>
446
- <% list.forEach(({ host, name, platform, processes }, index) => { %>
447
- <% if (current_host === host) { %>
448
- <a href="/net/<%=name%>" class='tab <%=current_host === host ? 'selected current' : ''%>'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (this machine)</div></a>
449
- <% } else { %>
450
- <a href="/net/<%=name%>" class='tab <%=current_host === host ? 'selected current' : ''%>'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (<%=host%>)</div></a>
451
- <% } %>
452
- <% }) %>
453
- </div>
454
- </div>
446
+ <% let brands = { win32: "windows", darwin: "apple", linux: "Linux" } %>
447
+ <% list.forEach(({ host, name, platform, processes }, index) => { %>
448
+ <% if (selected_name === name) { %>
449
+ <a href="/net/<%=name%>" class='submenu tab selected'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (<%=current_host === host ? 'this machine' : host%>)</a>
450
+ <% } else { %>
451
+ <a href="/net/<%=name%>" class='submenu tab'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (<%=current_host === host ? 'this machine' : host%>)</a>
452
+ <% } %>
453
+ <% }) %>
455
454
  <% } %>
456
455
  <div class='tab'><i class="fa-solid fa-code"></i> Dev</div>
457
456
  </aside>
@@ -481,8 +480,8 @@ body.dark .net {
481
480
  <div class='line align-top' data-index="<%=index%>" data-name="<%=item.name%>" data-title="<%=item.name%>" data-description="<%=item.internal_router.join(' ')%> <%=item.port%>">
482
481
  <h3>
483
482
  <div class='item-icon'>
484
- <% if (favicons[item.ip]) { %>
485
- <img src="<%=favicons[item.ip]%>">
483
+ <% if (favicons[item.external_ip]) { %>
484
+ <img src="<%=favicons[item.external_ip]%>">
486
485
  <% } else { %>
487
486
  <img src="/pinokio-black.png">
488
487
  <% } %>
@@ -198,8 +198,10 @@ a.ln:hover {
198
198
  box-sizing: border-box;
199
199
  }
200
200
  .container {
201
+ /*
201
202
  display: grid;
202
203
  grid-template-columns: repeat(<%=list.length%>, 1fr);
204
+ */
203
205
  }
204
206
  .dark .container-row {
205
207
  background: rgba(255, 255, 255, 0.04);
@@ -400,6 +402,9 @@ input:checked + .slider:before {
400
402
  table h3 {
401
403
  margin: 0;
402
404
  }
405
+ body.dark .desc {
406
+ color: rgba(255,255,255,0.7);
407
+ }
403
408
  .desc {
404
409
  font-size: 14px;
405
410
  color: rgba(0, 0, 0, 0.7);
@@ -435,6 +440,7 @@ main {
435
440
  display: flex;
436
441
  }
437
442
  aside {
443
+ width: 200px;
438
444
  display: block;
439
445
  flex-shrink: 0;
440
446
  border-right: 1px solid rgba(0,0,0,0.04);
@@ -461,14 +467,20 @@ aside .tab {
461
467
  }
462
468
  body.dark aside .tab.selected {
463
469
  color: white;
470
+ /*
464
471
  border-left: 10px solid white;
472
+ */
465
473
  }
466
474
  body.dark aside .selected {
475
+ /*
467
476
  border-left: 10px solid white;
477
+ */
468
478
  }
469
479
  aside .selected {
470
480
  font-weight: bold;
481
+ /*
471
482
  border-left: 10px solid black;
483
+ */
472
484
  opacity: 1;
473
485
  }
474
486
  body.dark aside .current.selected {
@@ -480,7 +492,7 @@ aside .current.selected {
480
492
  opacity: 1;
481
493
  }
482
494
  .submenu .tab {
483
- padding: 0;
495
+ padding: 10px;
484
496
  }
485
497
  .submenu .tab {
486
498
  border-left: 10px solid transparent;
@@ -565,18 +577,10 @@ input[type=search] {
565
577
  <a href="/" class='tab'><i class='fas fa-laptop-code'></i> Local</a>
566
578
  <a href="/network" class='tab selected'><i class="fa-solid fa-wifi"></i> Network</a>
567
579
  <% if (list.length > 0) { %>
568
- <div class='tab'>
569
- <div class='submenu'>
570
- <% let brands = { win32: "windows", darwin: "apple", linux: "Linux" } %>
571
- <% list.forEach(({ host, name, platform, processes }, index) => { %>
572
- <% if (current_host === host) { %>
573
- <a href="/net/<%=name%>" class='tab <%=current_host === host ? 'current' : ''%>'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (this machine)</div></a>
574
- <% } else { %>
575
- <a href="/net/<%=name%>" class='tab <%=current_host === host ? 'current' : ''%>'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (<%=host%>)</div></a>
576
- <% } %>
577
- <% }) %>
578
- </div>
579
- </div>
580
+ <% let brands = { win32: "windows", darwin: "apple", linux: "Linux" } %>
581
+ <% list.forEach(({ host, name, platform, processes }, index) => { %>
582
+ <a href="/net/<%=name%>" class='submenu tab'><i class="fa-brands fa-<%=brands[platform]%>"></i> <%=name%> (<%=current_host === host ? 'this machine' : host%>)</a>
583
+ <% }) %>
580
584
  <% } %>
581
585
  <div class='tab'><i class="fa-solid fa-code"></i> Dev</div>
582
586
  </aside>