pinokiod 1.0.56 → 1.0.58

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.
@@ -45,6 +45,7 @@ class Api {
45
45
  // stop all proxies for the script
46
46
  if (this.proxies[config.script]) {
47
47
  for(let p of this.proxies[config.script]) {
48
+ console.log("P", p)
48
49
  this.stopProxy({ uri: p.target })
49
50
  }
50
51
  }
@@ -54,18 +55,14 @@ class Api {
54
55
  this.lproxy.stop(config.uri)
55
56
 
56
57
  // remove the uri from the proxies array
57
- for(let key in this.proxies) {
58
- let p = this.proxies[key]
59
- if (p.includes(config.uri)) {
60
- let index;
61
- for(let i = 0; i<p.length; i++) {
62
- if (p[i].target === config.uri) {
63
- index = i
64
- break;
65
- }
66
- }
67
- this.proxies[key].splice(index, 1)
68
- }
58
+ for(let scriptPath in this.proxies) {
59
+ let p = this.proxies[scriptPath]
60
+ console.log("pp", p)
61
+ // iterate through p and find the one whose target matches config.uri
62
+ // and remove it
63
+ this.proxies[scriptPath] = this.proxies[scriptPath].filter((item) => {
64
+ return item.target !== config.uri
65
+ })
69
66
  }
70
67
  }
71
68
  console.log("stopped", { proxies: this.proxies })
@@ -94,6 +91,7 @@ class Api {
94
91
  return result
95
92
  }
96
93
  async stop(req, ondata) {
94
+ console.log("STOP")
97
95
  // 1. set the "stop" flag for the uri, so the next execution in the queue for the uri will NOT queue another task
98
96
  // 2. stream a message closing the socket
99
97
 
package/kernel/index.js CHANGED
@@ -24,7 +24,7 @@ const VARS = {
24
24
  //const memwatch = require('@airbnb/node-memwatch');
25
25
  class Kernel {
26
26
  //schema = ">=1.0.0"
27
- schema = ">=1.0.0"
27
+ schema = ">=1.1.0"
28
28
  constructor(store) {
29
29
  this.fetch = fetch
30
30
  this.store = store
@@ -39,42 +39,6 @@ class Kernel {
39
39
  this.procs[uri] = undefined
40
40
  }
41
41
  }
42
- // on(name, event) {
43
- // if (name === "refresh_memory") {
44
- // let urlSet = new Set()
45
- // // start relevant proxies
46
- // for(let scriptPath in this.memory.local) {
47
- // let local = this.memory.local[scriptPath]
48
- // // if 'url' is set
49
- // // 1. check if a proxy is already running
50
- // // 2. if running => ignore
51
- // // 3. if not running => start proxy
52
- // if (local.url) {
53
- // urlSet.add(local.url)
54
- // }
55
- // let local = this.api.proxies[parentPath]
56
- // }
57
- //
58
- // // get all running urls
59
- //
60
- //
61
- // // stop relevant proxies
62
- //
63
- // for(let scriptPath in this.api.proxies) {
64
- // // 1. get all the proxies for a scriptPath
65
- // let proxies = this.api.proxies[scriptPath]
66
- // // 2. iterate through the proxies
67
- // for(let proxy of proxies) {
68
- // if (urlSet.has(proxy.target)) {
69
- // // the proxy target is part of the urlSet => don't do anything since all the relevant proxies have started above
70
- // } else {
71
- // // the proxy target is not part of the urlSet => stop the proxy
72
- // }
73
- // }
74
- // // - if the proxy.target is included in one of the uris in one of the local variables
75
- // }
76
- // }
77
- // }
78
42
  local(...args) {
79
43
  // get local variables at path
80
44
  let v = this.memory.local[path.resolve(...args)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "1.0.56",
3
+ "version": "1.0.58",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -226,7 +226,9 @@ body.dark .frame-link.selected {
226
226
  background: rgba(0,0,0,0.7) !important;
227
227
  }
228
228
  .frame-link .loader {
229
+ /*
229
230
  padding: 5px;
231
+ */
230
232
  }
231
233
  .frame-link .tab {
232
234
  flex-grow: 1;
@@ -1070,42 +1072,44 @@ document.querySelector("aside").addEventListener("click", async (e) => {
1070
1072
 
1071
1073
 
1072
1074
  if (target) {
1073
-
1074
- if (target.classList.contains("reveal")) {
1075
- // nested menu
1076
- target.closest(".nested-menu").querySelector(".submenu").classList.toggle("hidden")
1077
- e.preventDefault()
1078
- e.stopPropagation()
1075
+ if (target.target === "_blank") {
1076
+ // nothing
1079
1077
  } else {
1080
- //location.hash = target.target
1078
+ if (target.classList.contains("reveal")) {
1079
+ // nested menu
1080
+ target.closest(".nested-menu").querySelector(".submenu").classList.toggle("hidden")
1081
+ e.preventDefault()
1082
+ e.stopPropagation()
1083
+ } else {
1084
+ //location.hash = target.target
1081
1085
 
1082
1086
 
1083
- // let id = getTarget(target.getAttribute("href"))
1084
- // console.log("ID", id, target.href)
1085
- // location.hash = id
1087
+ // let id = getTarget(target.getAttribute("href"))
1088
+ // console.log("ID", id, target.href)
1089
+ // location.hash = id
1086
1090
 
1087
- //location.hash = target.getAttribute("href")
1091
+ //location.hash = target.getAttribute("href")
1092
+
1093
+ if (target.closest(".h")) {
1094
+ location.hash = target.target
1095
+ } else {
1096
+ let index = target.getAttribute("data-index")
1097
+ let type = target.closest(".m").getAttribute("data-type")
1088
1098
 
1089
- if (target.closest(".h")) {
1090
- location.hash = target.target
1091
- } else {
1092
- let index = target.getAttribute("data-index")
1093
- let type = target.closest(".m").getAttribute("data-type")
1094
1099
 
1095
- console.log({ type, index })
1100
+ location.hash = type + index
1101
+ }
1096
1102
 
1097
- debugger
1103
+ document.querySelectorAll(".frame-link").forEach((el) => {
1104
+ el.classList.remove("selected")
1105
+ })
1106
+ target.classList.add("selected")
1098
1107
 
1099
- location.hash = type + index
1108
+ renderSelection(e)
1100
1109
  }
1110
+ }
1101
1111
 
1102
- document.querySelectorAll(".frame-link").forEach((el) => {
1103
- el.classList.remove("selected")
1104
- })
1105
- target.classList.add("selected")
1106
1112
 
1107
- renderSelection(e)
1108
- }
1109
1113
 
1110
1114
 
1111
1115
  }
@@ -722,31 +722,12 @@ const reloadMemory = async () => {
722
722
  <a class='path' href="<%=path.path%>"><%-path.name%></a>
723
723
  <% } %>
724
724
  <% }) %>
725
- <!--
726
- <div class='flexible'></div>
727
- <button class='btn2' id='explore'><div><i class="fa-solid fa-globe"></i></div><div>Discover</div></button>
728
- <button class='btn2' id='report'><div><i class="fa-solid fa-bug"></i></div><div>Report Bug</div></button>
729
- <a class='btn2' href="/?mode=settings"><div><i class="fa-solid fa-gear"></i></div><div>Settings</div></a>
730
- <button id='new-window' title='open a new window'><i class="fa-solid fa-plus"></i></button>
731
- -->
732
725
  </h1>
733
726
  <% if (false) { %>
734
727
  <a class='gitremote' data-filepath="<%=filepath%>"><%=filepath%></a>
735
728
  <div class='pinokiourl'><i class="fa-solid fa-link"></i><%=pinokioPath%></div>
736
729
  <% } %>
737
730
  <% if (!install_required) { %>
738
- <!--
739
- <div class='runner'>
740
- <div class='btn run <%= mod && runnable ? "" : "hidden" %>'>
741
- <span class='play'><i class="fa-solid fa-play"></i> Run</span>
742
- <span class='starting hidden'><i class="fa-solid fa-circle-notch fa-spin"></i> Starting...</span>
743
- <span class='stop hidden'><i class="fa-solid fa-stop"></i> Stop</span>
744
- </div>
745
- <div id='save' class='btn disabled'>
746
- <span class='save'><i class="fa-solid fa-check"></i> Save</span>
747
- </div>
748
- </div>
749
- -->
750
731
  <div class='runner'>
751
732
  <div class='btn run <%= mod && runnable ? "" : "hidden" %>'>
752
733
  <span class='play'><i class="fa-solid fa-play"></i> Run</span>
@@ -760,11 +741,6 @@ const reloadMemory = async () => {
760
741
  <div id='save' class='btn disabled'>
761
742
  <span class='save'><i class="fa-solid fa-check"></i> Save</span>
762
743
  </div>
763
- <% if (proxies) { %>
764
- <% proxies.forEach((proxy) => { %>
765
- <a class='btn' target="_blank" href="<%=proxy.proxy%>"><i class='fa-solid fa-up-right-from-square'></i> Proxy <%=proxy.name ? "(" + proxy.name + ")" : proxy.proxy%></a>
766
- <% }) %>
767
- <% } %>
768
744
  </div>
769
745
  <% } %>
770
746
  </header>
@@ -849,12 +825,6 @@ const reloadMemory = async () => {
849
825
  <% } %>
850
826
  <div id='terminal'></div>
851
827
  </div>
852
- <!--
853
- <div class='terminal-container'>
854
- <div id='terminal'></div>
855
- <div id='terminal-resize'><i class="fa-solid fa-up-right-and-down-left-from-center"></i></div>
856
- </div>
857
- -->
858
828
  </div>
859
829
  <footer><b>Ready</b></footer>
860
830
  <% } %>
@@ -714,26 +714,6 @@ const reloadMemory = async () => {
714
714
  <body class='<%=theme%>'>
715
715
  <% } %>
716
716
  <header>
717
- <!--
718
- <h1>
719
- <% paths.forEach((path) => { %>
720
- <% if (path.action) { %>
721
- <a class='path nav-button' id="<%=path.id%>" onclick="<%=path.action%>"><%-path.name%></a>
722
- <% } else if (path.path) { %>
723
- <a class='path' href="<%=path.path%>"><%-path.name%></a>
724
- <% } %>
725
- <% }) %>
726
- <div class='flexible'></div>
727
- <button class='btn2' id='explore'><div><i class="fa-solid fa-globe"></i></div><div>Discover</div></button>
728
- <button class='btn2' id='report'><div><i class="fa-solid fa-bug"></i></div><div>Report Bug</div></button>
729
- <a class='btn2' href="/?mode=settings"><div><i class="fa-solid fa-gear"></i></div><div>Settings</div></a>
730
- <button id='new-window' title='open a new window'><i class="fa-solid fa-plus"></i></button>
731
- </h1>
732
- <a class='gitremote' data-filepath="<%=filepath%>"><%=filepath%></a>
733
- <% if (pinokioPath) { %>
734
- <div class='pinokiourl'><i class="fa-solid fa-link"></i><%=pinokioPath%></div>
735
- <% } %>
736
- -->
737
717
  <% if (!install_required) { %>
738
718
  <div class='runner'>
739
719
  <div class='btn run <%= mod && runnable ? "" : "hidden" %>'>
@@ -742,19 +722,6 @@ const reloadMemory = async () => {
742
722
  <span class='stop hidden'><i class="fa-solid fa-stop"></i> Stop</span>
743
723
  </div>
744
724
  <button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> View File</button>
745
- <% if (proxies) { %>
746
- <% proxies.forEach((proxy) => { %>
747
- <a class='btn' target="_blank" href="<%=proxy.proxy%>"><i class='fa-solid fa-up-right-from-square'></i> Proxy <%=proxy.name ? "(" + proxy.name + ")" : proxy.proxy%></a>
748
- <% }) %>
749
- <% } %>
750
- <!--
751
- <button class='btn' id='source' data-editor-url="<%=editorUrl%>">Navigate</button>
752
- -->
753
- <!--
754
- <div id='save' class='btn disabled'>
755
- <span class='save'><i class="fa-solid fa-check"></i> Save</span>
756
- </div>
757
- -->
758
725
  </div>
759
726
  <% } %>
760
727
  </header>
@@ -10,17 +10,23 @@
10
10
  </div>
11
11
  <% } else { %>
12
12
  <% if (item.btn) { %>
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'>
17
- <div class='tab'><%-item.btn%></div>
18
- <% if (item.running) { %>
13
+ <% if (item.target === "_blank") { %>
14
+ <a data-index="<%=index%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link'>
15
+ <div class='tab'><%-item.btn%></div>
19
16
  <div class='loader'>
20
- <i class='fa-solid fa-spin fa-circle-notch'></i>
17
+ <i class="fa-solid fa-up-right-from-square"></i>
21
18
  </div>
22
- <% } %>
23
- </a>
19
+ </a>
20
+ <% } else { %>
21
+ <a data-index="<%=index%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link'>
22
+ <div class='tab'><%-item.btn%></div>
23
+ <% if (item.running) { %>
24
+ <div class='loader'>
25
+ <i class='fa-solid fa-spin fa-circle-notch'></i>
26
+ </div>
27
+ <% } %>
28
+ </a>
29
+ <% } %>
24
30
  <% } %>
25
31
  <% } %>
26
32
  <% }) %>