pinokiod 2.1.6 → 2.1.8

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.
@@ -38,7 +38,6 @@ class Api {
38
38
  }
39
39
  }
40
40
  async startProxy(scriptPath, uri, name, options) {
41
- console.log("startProxy", { scriptPath, uri, name, options })
42
41
  this.checkProxy({ uri, name })
43
42
  // if the name exists, throw error
44
43
  // if the uri exists, throw error
@@ -58,13 +57,10 @@ class Api {
58
57
  // stop all proxies for the script
59
58
  if (this.proxies[config.script]) {
60
59
  for(let p of this.proxies[config.script]) {
61
- console.log("stopProxy", p.target)
62
60
  this.stopProxy({ uri: p.target })
63
61
  }
64
62
  }
65
63
  } else if (config.uri) {
66
- console.log("stopProxy uri", config)
67
- console.log("this.proxies = ", this.proxies)
68
64
 
69
65
  // stop the proxy
70
66
  this.lproxy.stop(config.uri)
@@ -109,7 +105,6 @@ class Api {
109
105
  // 2. stream a message closing the socket
110
106
 
111
107
 
112
- console.log("stop params", req.params)
113
108
 
114
109
  let requestPath = this.filePath(req.params.uri)
115
110
 
@@ -353,7 +348,6 @@ class Api {
353
348
  return modpath
354
349
  }
355
350
  filePath(uri, cwd) {
356
- console.log({ uri, cwd })
357
351
  let modpath
358
352
  if (uri.startsWith("http")) {
359
353
  // git url
@@ -1115,7 +1109,7 @@ class Api {
1115
1109
  rawrpc: request
1116
1110
  })
1117
1111
  } catch (e) {
1118
- console.log("ERROR", e)
1112
+ console.log("E1112", e)
1119
1113
  this.ondata({
1120
1114
  kernel: true,
1121
1115
  id: request.method,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -259,7 +259,6 @@ class Server {
259
259
  }
260
260
 
261
261
  const env = await this.kernel.env("api/" + name)
262
- console.log(">> ENV", env)
263
262
 
264
263
  //res.render("browser", {
265
264
  res.render("browser-experimental", {
@@ -2204,7 +2203,6 @@ class Server {
2204
2203
  this.app.post("/env", async (req, res) => {
2205
2204
  let fullpath = path.resolve(this.kernel.homedir, req.body.filepath, "ENVIRONMENT")
2206
2205
  let updated = req.body.vals
2207
- console.log("updated", updated)
2208
2206
  await Util.update_env(fullpath, updated)
2209
2207
  res.json({})
2210
2208
  })
@@ -91,13 +91,14 @@ td.key {
91
91
  }
92
92
  <% } %>
93
93
 
94
- header .runner {
95
- display: flex;
96
- }
97
- header .runner .btn {
94
+ header .btn {
95
+ font-family: Sans-serif;
98
96
  display: block;
99
97
  margin-left: 10px;
100
-
98
+ font-style: normal;
99
+ font-size: 12px;
100
+ font-weight: normal;
101
+ padding: 5px 10px;
101
102
  }
102
103
  .disabled {
103
104
  opacity: 0.7;
@@ -278,17 +279,19 @@ document.addEventListener("DOMContentLoaded", async () => {
278
279
  </div>
279
280
  <% } else { %>
280
281
  <header class='navheader grabbable'>
281
- <div class='runner'>
282
- <% if (home) { %>
283
- <a class='home-button btn' href="/"><i class='fa-solid fa-home'></i></a>
284
- <% } %>
285
- <div class='flexible'></div>
286
- <a class='btn' href="<%=editorpath%>"><i class="fa-solid fa-pen-to-square"></i> Edit file</a>
287
- <button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> Open in File Explorer</button>
288
- <div id='save' class='btn'>
289
- <span class='save'><i class="fa-solid fa-check"></i> Save</span>
290
- </div>
291
- </div>
282
+ <h1>
283
+ <% if (home) { %>
284
+ <a class='home-button home' href="/"><i class='fa-solid fa-home'></i></a>
285
+ <% } %>
286
+ <div class='flexible'></div>
287
+ <div class='nav-btns'>
288
+ <a class='btn' href="<%=editorpath%>"><i class="fa-solid fa-pen-to-square"></i> Edit file</a>
289
+ <button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> Open in File Explorer</button>
290
+ <div id='save' class='btn'>
291
+ <span class='save'><i class="fa-solid fa-check"></i> Save</span>
292
+ </div>
293
+ </div>
294
+ </h1>
292
295
  </header>
293
296
  <% } %>
294
297
  <div id='editor' class='<%=init ? "hidden" : ''%>'>
@@ -290,6 +290,9 @@ body.dark .browser-options-row {
290
290
  <button class='btn browse' data-src="<%=item.browser_url%>/browse">
291
291
  <i class='fa-regular fa-folder-open'></i>
292
292
  </button>
293
+ <button class='btn del' data-src="<%=item.url%>">
294
+ <i class="fa-solid fa-trash-can"></i>
295
+ </button>
293
296
  <% if (item.running_scripts) { %>
294
297
  <% item.running_scripts.forEach((s) => { %>
295
298
  <button class='btn shutdown' data-src="<%=s.path%>">
@@ -340,6 +343,9 @@ body.dark .browser-options-row {
340
343
  <button class='btn browse' data-src="<%=item.browser_url%>/browse">
341
344
  <i class='fa-regular fa-folder-open'></i>
342
345
  </button>
346
+ <button class='btn del' data-src="<%=item.url%>">
347
+ <i class="fa-solid fa-trash-can"></i>
348
+ </button>
343
349
  <% if (item.shortcuts && item.shortcuts.length > 0) { %>
344
350
  <div class='btns'>
345
351
  <% item.shortcuts.forEach((btn) => { %>
@@ -722,7 +728,7 @@ document.addEventListener("keydown", (e) => {
722
728
  }
723
729
  }
724
730
  });
725
- document.addEventListener("click", (e) => {
731
+ document.addEventListener("click", async (e) => {
726
732
 
727
733
  let target
728
734
 
@@ -776,6 +782,56 @@ document.addEventListener("click", (e) => {
776
782
  }
777
783
 
778
784
 
785
+ // delete
786
+ if (e.target.classList.contains("del")) {
787
+ target = e.target
788
+ } else {
789
+ target = e.target.closest(".del")
790
+ }
791
+ if (target) {
792
+ e.preventDefault()
793
+ e.stopPropagation()
794
+ let confirmed = confirm("Are you sure you want to delete the folder? All files in the folder will be gone.")
795
+ if (confirmed) {
796
+ let itemEl = target.closest(".line[data-uri]")
797
+ let name = itemEl.getAttribute("data-uri")
798
+ console.log("delete", name)
799
+ Swal.fire({
800
+ html: '<i class="fa-solid fa-circle-notch fa-spin"></i> Deleting',
801
+ customClass: {
802
+ container: "loader-container",
803
+ popup: "loader-popup",
804
+ htmlContainer: "loader-dialog",
805
+ footer: "hidden",
806
+ actions: "hidden"
807
+ }
808
+ });
809
+ debugger
810
+ let res = await fetch("/pinokio/delete", {
811
+ method: "post",
812
+ headers: {
813
+ "Content-Type": "application/json"
814
+ },
815
+ body: JSON.stringify({ name })
816
+ }).then((res) => {
817
+ return res.json()
818
+ })
819
+ console.log("res", res)
820
+ Swal.close()
821
+ if (res) {
822
+ if (res.success) {
823
+ location.href = "/"
824
+ } else if (res.error) {
825
+ alert(res.error)
826
+ }
827
+ }
828
+ } else {
829
+ }
830
+ return
831
+ }
832
+
833
+
834
+
779
835
  if (document.querySelector(".container")) {
780
836
  document.querySelector(".container").addEventListener("click", async (e) => {
781
837
  let el = e.target.closest(".menu-btn")