pinokiod 1.0.31 → 1.0.33

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": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -343,6 +343,7 @@ class Server {
343
343
  } else if (pathComponents.length === 0 && req.query.mode === "settings") {
344
344
  let configArray = [{
345
345
  key: "home",
346
+ description: "* Do NOT use exFAT drives",
346
347
  val: this.kernel.homedir,
347
348
  placeholder: "Enter the absolute path to use as your Pinokio home folder (D:\\pinokio, /Users/alice/pinokiofs, etc.)"
348
349
  }, {
@@ -351,6 +352,7 @@ class Server {
351
352
  options: ["light", "dark"]
352
353
  }]
353
354
  console.log("agent", this.agent)
355
+ console.log({ configArray })
354
356
  res.render("settings", {
355
357
  version: this.version,
356
358
  logo: this.logo,
@@ -1168,10 +1170,16 @@ class Server {
1168
1170
  }
1169
1171
  }
1170
1172
  }
1173
+ config.menu[i].target = "@" + (config.menu[i].id || config.menu[i].src)
1171
1174
  }
1175
+
1176
+
1172
1177
  config.menu = config.menu.filter((item) => {
1173
1178
  return item.btn
1174
1179
  })
1180
+
1181
+
1182
+
1175
1183
  console.log("config", JSON.stringify(config,null,2))
1176
1184
  return config
1177
1185
  } else {
@@ -1602,6 +1610,7 @@ class Server {
1602
1610
  if (req.query.mode === 'settings') {
1603
1611
  let configArray = [{
1604
1612
  key: "home",
1613
+ description: "* Do NOT use exFAT drives",
1605
1614
  val: this.kernel.homedir ? this.kernel.homedir : path.resolve(os.homedir(), "pinokio"),
1606
1615
  placeholder: "Enter the absolute path to use as your Pinokio home folder (D:\\pinokio, /Users/alice/pinokiofs, etc.)"
1607
1616
  }, {
@@ -99,6 +99,9 @@ body.dark .header-item .btn2 {
99
99
  color: var(--darkt-color);
100
100
  */
101
101
  }
102
+ .bar .btn2 i {
103
+ display: block;
104
+ }
102
105
  .header-item > * {
103
106
  display: block;
104
107
  }
@@ -315,7 +318,7 @@ nav .logo {
315
318
  padding: 10px;
316
319
  }
317
320
  #location {
318
- padding: 5px;
321
+ padding: 5px 10px;
319
322
  font-size: 12px;
320
323
  font-family: verdana;
321
324
  }
@@ -428,9 +431,8 @@ body.dark .loader-container {
428
431
  <button class='btn2 logo' id='forward'><i class="fa-solid fa-arrow-right"></i></button>
429
432
  <button class='btn2 logo' id='reload'><i class="fa-solid fa-rotate-right"></i></button>
430
433
  <div id='location'></div>
431
- <div class='flexible'></div>
432
- <a class='btn2' id='open-browser' target="_blank" href=""><i class="fa-solid fa-square-arrow-up-right"></i> External Browser</a>
433
434
  <button class='btn2' id='clone-tab'><i class='fa-regular fa-copy'></i> Clone</button>
435
+ <a class='btn2' id='open-browser' target="_blank" href=""><i class="fa-solid fa-square-arrow-up-right"></i> Popout</a>
434
436
  </div>
435
437
  <!--
436
438
  <div class='flexible'></div>
@@ -441,12 +443,14 @@ body.dark .loader-container {
441
443
  -->
442
444
  </nav>
443
445
  <main class='browserview'>
444
- <% if (false && config.menu) { %>
445
- <% config.menu.forEach((item) => { %>
446
- <% if (item.btn && item.src) { %>
447
- <iframe name='<%=item.src%>' class='hidden'></iframe>
448
- <% } %>
449
- <% }) %>
446
+ <% if (false) { %>
447
+ <% if (config.menu) { %>
448
+ <% config.menu.forEach((item) => { %>
449
+ <% if (item.btn && item.src) { %>
450
+ <iframe name='<%=item.src%>' class='hidden'></iframe>
451
+ <% } %>
452
+ <% }) %>
453
+ <% } %>
450
454
  <% } %>
451
455
  </main>
452
456
  </div>
@@ -467,6 +471,35 @@ const getTarget = (href) => {
467
471
  return u.pathname
468
472
  }
469
473
  }
474
+ const subUrlOf = (s, f) => {
475
+ debugger
476
+
477
+ let subsetUrl = (s.startsWith("http") ? s : "http://localhost" + s)
478
+ let fullUrl = (f.startsWith("http") ? f: "http://localhost" + f)
479
+
480
+ const subsetParsed = new URL(subsetUrl)
481
+ const fullParsed = new URL(fullUrl)
482
+
483
+ if (subsetParsed.pathname !== fullParsed.pathname) {
484
+ return false;
485
+ }
486
+
487
+ // Check if all search parameters in the subset URL are present in the full URL
488
+ for (const [key, val] of subsetParsed.searchParams) {
489
+
490
+ if (!fullParsed.searchParams.has(key)) {
491
+ return false
492
+ }
493
+ console.log("key", key)
494
+ console.log("f", fullParsed.searchParams.get(key))
495
+ console.log("s", val)
496
+ if (fullParsed.searchParams.get(key) !== val) {
497
+ return false
498
+ }
499
+ }
500
+
501
+ return true;
502
+ }
470
503
  const renderCursor = () => {
471
504
  document.querySelectorAll(".selectable").forEach((el) => {
472
505
  el.classList.remove("cursor")
@@ -504,10 +537,18 @@ const renderSelection = (e, force) => {
504
537
  document.querySelector(".bar").classList.remove("hidden")
505
538
  //let id = getTarget(location.hash.slice(1))
506
539
  let id = location.hash.slice(1)
507
- let type = id[0]
508
- let index = id.slice(1)
509
540
 
510
- console.log({ type, index })
541
+
542
+ let selector
543
+ if (id.startsWith("@")) {
544
+ selector = `aside [target='${id.slice(1)}']`
545
+ } else {
546
+ let type = id[0]
547
+ let index = id.slice(1)
548
+ console.log({ type, index })
549
+ selector = `aside .${type} [data-index='${index}']`
550
+ }
551
+
511
552
 
512
553
  // select the selected link
513
554
  // document.querySelectorAll(".frame-link").forEach((el) => {
@@ -529,7 +570,7 @@ const renderSelection = (e, force) => {
529
570
  }
530
571
  } else {
531
572
  // if not triggered by an event, look for the target from the location hash
532
- target = document.querySelector(`aside .${type} [data-index='${index}']`)
573
+ target = document.querySelector(selector)
533
574
  }
534
575
 
535
576
 
@@ -560,6 +601,7 @@ const renderSelection = (e, force) => {
560
601
  })
561
602
 
562
603
 
604
+ debugger
563
605
 
564
606
  // Look for the frame
565
607
  // 1. if it's hard (".h")
@@ -568,7 +610,7 @@ const renderSelection = (e, force) => {
568
610
  // find using the name attribute
569
611
  let targetFrame;
570
612
  if (target.closest(".h")) {
571
- let hardFrames = document.querySelectorAll(".browserview iframe[name^=h]")
613
+ let hardFrames = document.querySelectorAll(".browserview iframe[name^='@']")
572
614
  let port = new URL(target.href).port
573
615
  for(let frame of hardFrames) {
574
616
  console.log({ src: frame.src, href: target.href, target: target.target })
@@ -633,22 +675,30 @@ const renderSelection = (e, force) => {
633
675
  } else {
634
676
  if (e) {
635
677
  if (target.closest(".h")) {
636
- if (target.href === targetFrame.src) {
637
- // same url. don't do anything
638
- e.preventDefault()
639
- e.stopPropagation()
640
- } else {
641
- if (targetFrame.src.includes(target.href)) {
642
- // different url, but the frame's url contains the tab url => don't touch
643
- e.preventDefault()
644
- e.stopPropagation()
645
- } else {
646
- // different url, and the frame's url does not contain the tab url => change the src of the frame and load
647
- targetFrame.src = target.href
648
- e.preventDefault()
649
- e.stopPropagation()
650
- }
678
+ debugger
679
+ e.preventDefault()
680
+ e.stopPropagation()
681
+ let sub = subUrlOf(target.href, targetFrame.src)
682
+ console.log("issub", sub)
683
+ if (!sub) {
684
+ targetFrame.src = target.href
651
685
  }
686
+ //if (target.href === targetFrame.src) {
687
+ // // same url. don't do anything
688
+ // e.preventDefault()
689
+ // e.stopPropagation()
690
+ //} else {
691
+ // if (targetFrame.src.includes(target.href)) {
692
+ // // different url, but the frame's url contains the tab url => don't touch
693
+ // e.preventDefault()
694
+ // e.stopPropagation()
695
+ // } else {
696
+ // // different url, and the frame's url does not contain the tab url => change the src of the frame and load
697
+ // targetFrame.src = target.href
698
+ // e.preventDefault()
699
+ // e.stopPropagation()
700
+ // }
701
+ //}
652
702
  } else if (target.closest(".s")) {
653
703
  // load unconditionally => .s doesn't change
654
704
  e.preventDefault()
@@ -977,12 +1027,19 @@ document.querySelector("aside").addEventListener("click", async (e) => {
977
1027
  // location.hash = id
978
1028
 
979
1029
  //location.hash = target.getAttribute("href")
980
- let index = target.getAttribute("data-index")
981
- let type = target.closest(".m").getAttribute("data-type")
982
1030
 
983
- console.log({ type, index })
1031
+ if (target.closest(".h")) {
1032
+ location.hash = target.target
1033
+ } else {
1034
+ let index = target.getAttribute("data-index")
1035
+ let type = target.closest(".m").getAttribute("data-type")
1036
+
1037
+ console.log({ type, index })
984
1038
 
985
- location.hash = type + index
1039
+ debugger
1040
+
1041
+ location.hash = type + index
1042
+ }
986
1043
 
987
1044
  document.querySelectorAll(".frame-link").forEach((el) => {
988
1045
  el.classList.remove("selected")
@@ -1035,6 +1092,8 @@ const refresh = async () => {
1035
1092
  // frame.removeAttribute("name")
1036
1093
  // location.hash = ""
1037
1094
  // }
1095
+
1096
+
1038
1097
  location.hash = ""
1039
1098
 
1040
1099
 
@@ -1049,13 +1108,21 @@ const refresh = async () => {
1049
1108
  }
1050
1109
  window.addEventListener('message', (event) => {
1051
1110
  console.log("Message received from the child: ", event.data); // Message received from child
1052
- if (event.data && event.data.action) {
1053
- if (event.data.action.type === "newtab") {
1054
- console.log("create tab", event.data.action.url)
1055
- addTab(event.data.action.url)
1111
+ if (event.data) {
1112
+ if (event.data.action) {
1113
+ if (event.data.action.type === "newtab") {
1114
+ console.log("create tab", event.data.action.url)
1115
+ addTab(event.data.action.url)
1116
+ }
1117
+ } else if (event.data.type) {
1118
+ if (event.data.type === 'disconnect') {
1119
+ // location.hash = ""
1120
+ refresh()
1121
+ } else {
1122
+ refresh()
1123
+ }
1056
1124
  }
1057
1125
  } else {
1058
- console.log("data", event.data)
1059
1126
  refresh()
1060
1127
  }
1061
1128
  });
@@ -10,7 +10,10 @@
10
10
  </div>
11
11
  <% } else { %>
12
12
  <% if (item.btn) { %>
13
+ <!--
13
14
  <a data-index="<%=index%>" target="h<%=index%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link'>
15
+ -->
16
+ <a data-index="<%=index%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link'>
14
17
  <div class='tab'><%-item.btn%></div>
15
18
  <% if (item.running) { %>
16
19
  <div class='loader'>
@@ -63,18 +63,28 @@
63
63
  border-top: 1px solid rgba(255,255,255,0.1);
64
64
  border-bottom: 1px solid rgba(255,255,255,0.1);
65
65
  */
66
- padding: 15px 0;
66
+ padding: 20px 0;
67
+ }
68
+ .titleview h1 {
69
+ font-size: 40px;
70
+ text-transform: uppercase;
71
+ letter-spacing: 0;
67
72
  }
68
73
  .item button {
69
74
  padding: 10px 20px;
70
75
  }
71
76
  .item label {
72
77
  display: block;
73
- font-weight: bold;
74
- text-transform: capitalize;
75
- font-size: 14px;
78
+ text-transform: uppercase;
79
+ font-size: 30px;
76
80
  padding-bottom: 5px;
77
81
  }
82
+ .item .explanation {
83
+ padding-top: 5px;
84
+ color: brown;
85
+ font-size: 14px;
86
+ font-weight: bold;
87
+ }
78
88
  body.dark .item input[type=text] {
79
89
  background: rgba(255,255,255,0.1);
80
90
  color: white;
@@ -228,6 +238,9 @@ header .home {
228
238
  <input class='homepath' name="<%=c.key%>" type='text' placeholder="<%=c.placeholder ? c.placeholder : ''%>">
229
239
  <% } %>
230
240
  <% } %>
241
+ <% if (c.description) { %>
242
+ <div class='explanation'><%=c.description%></div>
243
+ <% } %>
231
244
  </div>
232
245
  <% }) %>
233
246
  <br>