pinokiod 3.9.19 → 3.9.21

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.9.19",
3
+ "version": "3.9.21",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -276,6 +276,7 @@ class Server {
276
276
  }
277
277
  let browser_browse_url = browser_url + "/browse"
278
278
  return {
279
+ filepath: this.kernel.path("api", name),
279
280
  icon,
280
281
  iconpath,
281
282
  path: apipath,
@@ -669,6 +670,7 @@ class Server {
669
670
  bin: this.kernel.bin.preset("ai"),
670
671
  })
671
672
  res.render("download", {
673
+ portal: this.portal,
672
674
  error,
673
675
  current: req.originalUrl,
674
676
  install_required,
@@ -39,7 +39,18 @@ document.addEventListener("DOMContentLoaded", () => {
39
39
  document.querySelector("#create-new-folder").addEventListener("click", async (e) => {
40
40
  e.preventDefault()
41
41
  e.stopPropagation()
42
- let folder = prompt("Enter a folder name to create")
42
+ let result = await Swal.fire({
43
+ title: "Create",
44
+ inputPlaceholder: "Enter a folder name to create",
45
+ allowOutsideClick: true,
46
+ confirmButtonText: 'Create',
47
+ input: "text",
48
+ })
49
+ if (result.isDismissed) {
50
+ return false
51
+ }
52
+ let folder = result.value
53
+ //let folder = prompt("Enter a folder name to create")
43
54
  if (folder && folder.length > 0) {
44
55
  } else {
45
56
  alert("Please enter a folder name")
@@ -109,7 +109,11 @@ const FSEditor = async ({title, description, old_path, icon, iconpath, redirect,
109
109
  if (dirty) {
110
110
  formData.append("icon_dirty", true)
111
111
  }
112
- formData.append("icon_path", iconpath)
112
+ if (iconpath) {
113
+ formData.append("icon_path", iconpath)
114
+ } else {
115
+ formData.append("icon_path", "icon.png")
116
+ }
113
117
  let title = Swal.getPopup().querySelector('#new-folder-title').value
114
118
  let description = Swal.getPopup().querySelector('#new-folder-description').value
115
119
  let folder_path_el = Swal.getPopup().querySelector('#new-folder-path')
@@ -171,7 +175,8 @@ const FSEditor = async ({title, description, old_path, icon, iconpath, redirect,
171
175
  dirty = true
172
176
  // make sure the image mime type is transformed into the same type as the existing image
173
177
  pond.setOptions({
174
- imageTransformOutputMimeType: initial_file.fileType
178
+ //imageTransformOutputMimeType: initial_file.fileType
179
+ imageTransformOutputMimeType: "image/png"
175
180
  })
176
181
  }
177
182
  initial_file = file
@@ -1463,8 +1463,12 @@ body.dark .swal2-modal input {
1463
1463
  border-radius: 2px !important;
1464
1464
  }
1465
1465
  body.dark .swal2-styled.swal2-confirm{
1466
+ /*
1466
1467
  background: rgba(255,255,255,0.9) !important;
1467
1468
  color: black;
1469
+ */
1470
+ color: rgba(255,255,255,0.8) !important;
1471
+ border: 1px solid rgba(255,255,255,0.8) !important;
1468
1472
  /*
1469
1473
  background: var(--dark-btn-bg);
1470
1474
  color: var(--dark-btn-color);
@@ -1020,51 +1020,20 @@ body.dark .appcanvas {
1020
1020
  // }
1021
1021
  }
1022
1022
  const renderSelection = (e, force) => {
1023
- console.log("renderSelection", { e, force, started_script })
1024
- // if the renderSelection was NOT caused by the user (e is null) ==> automatic execution
1025
- // and the user has already interacted with the page, don't renderselection
1026
- console.log("> 1")
1027
- // let selection
1028
- // if (interacted) {
1029
- // if (e) {
1030
- // selection = document.querySelector("[data-default]")
1031
- // } else {
1032
- // if (started_script) {
1033
- // selection = document.querySelector(`[data-key="${started_script}"]`)
1034
- // started_script = null
1035
- // } else {
1036
- // return
1037
- // }
1038
- // }
1039
- // } else {
1040
- // selection = document.querySelector("[data-default]")
1041
- // }
1042
- let init = document.querySelector("[data-init]")
1043
- if (init) {
1044
- location.href = init.href
1045
- return
1046
- }
1047
- let selection = document.querySelector("[data-default]")
1048
-
1049
- // console.log("> 3")
1050
- // let selection
1051
- // if (started_script) {
1052
- // selection = document.querySelector(`[data-filepath="${started_script}"]`)
1053
- // started_script = null
1054
- // } else {
1055
- // // if the menu has a default item, or if the url specifies a selection
1056
- // selection = document.querySelector("[data-default]")
1057
- // }
1023
+ let init = document.querySelector("[data-init]")
1024
+ if (init) {
1025
+ location.href = init.href
1026
+ return
1027
+ }
1028
+ let selection = null
1029
+ <% if (type === "run" && env.PINOKIO_SCRIPT_DEFAULT && env.PINOKIO_SCRIPT_DEFAULT.toString().toLowerCase() === "true") { %>
1030
+ selection = document.querySelector("[data-default]")
1031
+ <% } %>
1058
1032
  console.log({ selection })
1059
- // let selection = document.querySelector("[data-default]")
1060
1033
  if (selection || location.hash && location.hash.length > 0) {
1061
1034
  let target
1062
1035
  if (location.hash && location.hash.length > 0) {
1063
- // document.querySelector(".bar").classList.remove("hidden")
1064
- //let id = getTarget(location.hash.slice(1))
1065
1036
  let id = location.hash.slice(1)
1066
-
1067
-
1068
1037
  let selector
1069
1038
  if (id.startsWith("@")) {
1070
1039
  //selector = `aside [target='${id.slice(1)}']`
@@ -1372,9 +1341,7 @@ body.dark .appcanvas {
1372
1341
 
1373
1342
  }
1374
1343
  }
1375
- <% if (type === "run" && env.PINOKIO_SCRIPT_DEFAULT && env.PINOKIO_SCRIPT_DEFAULT.toString().toLowerCase() === "true") { %>
1376
1344
  renderSelection()
1377
- <% } %>
1378
1345
  //renderCursor()
1379
1346
  //Reporter()
1380
1347
  <% if (agent === "electron") { %>
@@ -1471,7 +1438,9 @@ body.dark .appcanvas {
1471
1438
  description: `<%=config.description%>`,
1472
1439
  old_path: `<%=name%>`,
1473
1440
  icon: `<%=config.icon%>`,
1474
- iconpath: `<%=config.iconpath%>`,
1441
+ <% if (config.iconpath) { %>
1442
+ iconpath: `<%-JSON.stringify(config.iconpath).slice(1, -1)%>`,
1443
+ <% } %>
1475
1444
  move: true,
1476
1445
  edit: true,
1477
1446
  redirect: (new_path) => {
@@ -1487,7 +1456,9 @@ body.dark .appcanvas {
1487
1456
  description: `<%=config.description%>`,
1488
1457
  old_path: `<%=name%>`,
1489
1458
  icon: `<%=config.icon%>`,
1490
- iconpath: `<%=config.iconpath%>`,
1459
+ <% if (config.iconpath) { %>
1460
+ iconpath: `<%-JSON.stringify(config.iconpath).slice(1, -1)%>`,
1461
+ <% } %>
1491
1462
  edit: true,
1492
1463
  redirect: (new_path) => {
1493
1464
  return "./" + new_path
@@ -1502,7 +1473,9 @@ body.dark .appcanvas {
1502
1473
  description: `<%=config.description%>`,
1503
1474
  old_path: `<%=name%>`,
1504
1475
  icon: `<%=config.icon%>`,
1505
- iconpath: `<%=config.iconpath%>`,
1476
+ <% if (config.iconpath) { %>
1477
+ iconpath: `<%-JSON.stringify(config.iconpath).slice(1, -1)%>`,
1478
+ <% } %>
1506
1479
  copy: true,
1507
1480
  edit: true,
1508
1481
  redirect: (new_path) => {
@@ -1821,18 +1794,7 @@ body.dark .appcanvas {
1821
1794
  // render the selected frame only if not silent
1822
1795
  if (silent) {
1823
1796
  } else {
1824
- if (options && options.nodelay) {
1825
- } else {
1826
- // await new Promise((resolve, reject) => {
1827
- // setTimeout(() => {
1828
- // resolve()
1829
- // }, 500)
1830
- // })
1831
- }
1832
- <% if (type === "run" && env.PINOKIO_SCRIPT_DEFAULT && env.PINOKIO_SCRIPT_DEFAULT.toString().toLowerCase() === "true") { %>
1833
-
1834
- renderSelection()
1835
- <% } %>
1797
+ renderSelection()
1836
1798
  }
1837
1799
  }
1838
1800
  if (document.querySelector("#genlog")) {
@@ -1870,6 +1832,7 @@ body.dark .appcanvas {
1870
1832
  } else if (event.data.action.type === "title") {
1871
1833
  console.log("title", event.data)
1872
1834
  } else if (event.data.action.type === "location") {
1835
+ console.log("EVENT", event)
1873
1836
  let url = event.data.action.url
1874
1837
  console.log({ action: event.data.action })
1875
1838
 
@@ -179,6 +179,7 @@ pre {
179
179
  </style>
180
180
  <link href="/highlight.css" rel="stylesheet" />
181
181
  <script src="/hotkeys.min.js"></script>
182
+ <script src="/sweetalert2.js"></script>
182
183
  <script src="/common.js"></script>
183
184
  <script src="/opener.js"></script>
184
185
  <script src="/highlight.js"></script>
@@ -150,6 +150,7 @@ body.dark .card {
150
150
  }
151
151
  </style>
152
152
  <script src="/hotkeys.min.js"></script>
153
+ <script src="/sweetalert2.js"></script>
153
154
  <script src="/common.js"></script>
154
155
  <script src="/opener.js"></script>
155
156
  </head>
@@ -23,20 +23,6 @@ body.frozen {
23
23
  overflow: auto !important;
24
24
  }
25
25
 
26
- body {
27
- height: 100%;
28
- overflow: auto;
29
- background: rgb(44, 29, 22);
30
- display: flex;
31
- flex-direction: column;
32
- }
33
- body {
34
- /*
35
- background: white;
36
- background: rgb(44, 29, 22);
37
- */
38
- background: var(--dark-bg);
39
- }
40
26
  .line2 {
41
27
  display: flex;
42
28
  align-items: center;
@@ -128,17 +114,27 @@ body {
128
114
  <% } %>
129
115
  <header class='grabbable'>
130
116
  <h1>
131
- <a class='path' href="/"><%-logo%></a>
117
+ <a class='home' href="/"><i class="fa-solid fa-house"></i></a>
118
+ <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
119
+ <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
120
+ <a class='btn2 create-new' id='create-new-folder'><div><i class='fa-solid fa-plus'></i></div><div>New</div></a>
121
+ <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
122
+ <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
123
+ <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
132
124
  <div class='flexible'></div>
133
125
  <div class='nav-btns'>
134
- <button class='btn2' id='report'><div><i class="fa-solid fa-bug"></i></div><div>Report Bug</div></button>
135
- <a class='btn2' href='https://discord.gg/TQdNwadtE4' target="_blank"><div><i class="fa-brands fa-discord"></i></div><div>Discord</div></a>
136
- <a class='btn2' href='https://twitter.com/cocktailpeanut' target="_blank"><div><i class="fa-brands fa-twitter"></i></div><div>Twitter</div></a>
126
+ <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
127
+ <button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
128
+ <a id='downloadlogs' download class='hidden btn2' href="/pinokio/logs.zip"><div><i class="fa-solid fa-download"></i></div><div>Download logs</div></a>
137
129
  <a class='btn2' href="/?mode=settings"><div><i class="fa-solid fa-gear"></i></div><div>Settings</div></a>
138
- <button id='new-window' title='open a new window' class='btn2'><i class="fa-solid fa-plus"></i></button>
130
+ <% if (agent === "electron") { %>
131
+ <a href="/" target="_blank" class='btn2' features="browser"><div><i class="fa-solid fa-square-up-right"></i></div><div>Open</div></a>
132
+ <% } else { %>
133
+ <a href="/" target="_blank" class='btn2'><div><i class="fa-solid fa-square-up-right"></i></div><div>Open</div></a>
134
+ <% } %>
135
+ <button id='new-window' title='open a new window' class='btn2'><div><i class="fa-solid fa-plus"></i></div><div>Window</div></button>
139
136
  </div>
140
137
  </h1>
141
- </h1>
142
138
  </header>
143
139
  <% if (requirements_pending) { %>
144
140
  <div class='requirements'>
@@ -189,7 +185,6 @@ body {
189
185
  <% } %>
190
186
  <script>
191
187
  document.addEventListener("DOMContentLoaded", async () => {
192
- Reporter()
193
188
  <% if (error) { %>
194
189
  document.querySelector(".requirements .content").innerHTML = '<div class="loading"><i class="fa-solid fa-circle-exclamation"></i> <%=error%></div>'
195
190
  <% } %>
@@ -114,6 +114,7 @@ body main iframe {
114
114
  }
115
115
  </style>
116
116
  <script src="/hotkeys.min.js"></script>
117
+ <script src="/sweetalert2.js"></script>
117
118
  <script src="/nav.js"></script>
118
119
  </head>
119
120
  <body class='<%=theme%>'>
@@ -168,6 +168,7 @@ hr {
168
168
  }
169
169
  </style>
170
170
  <script src="/hotkeys.min.js"></script>
171
+ <script src="/sweetalert2.js"></script>
171
172
  <script src="/common.js"></script>
172
173
  <script src="/opener.js"></script>
173
174
  </head>
@@ -236,7 +236,6 @@ body.dark .item .tile .badge {
236
236
  }
237
237
  </style>
238
238
  <script src="/hotkeys.min.js"></script>
239
- <script src="/sweetalert2.js"></script>
240
239
  <script src="/noty.js"></script>
241
240
  <script src="/notyq.js"></script>
242
241
  <script src="/xterm.js"></script>
@@ -169,10 +169,13 @@ body.dark .open-menu, body.dark .browse {
169
169
  background: black !important;
170
170
  color: white !important;
171
171
  }
172
+ .open-menu:hover, .browse:hover, body.dark .open-menu:hover, body.dark .browse:hover {
173
+ color: royalblue !important;
174
+ }
172
175
  .open-menu, .browse {
173
176
  width: 80px;
174
177
  border-radius: 0 !important;
175
- background: rgba(0,0,0,0.06) !important;
178
+ background: rgba(0,0,0,0.04) !important;
176
179
  color: black !important;
177
180
  /*
178
181
  border: 1px solid rgba(0, 0, 0, 0.3);
@@ -371,7 +374,7 @@ body.dark .open-menu, body.dark .browse {
371
374
  <% } %>
372
375
  </div>
373
376
  <div class='col'>
374
- <div class='uri'><i class="fa-regular fa-folder"></i><%=item.url%></div>
377
+ <div class='uri'><i class="fa-regular fa-folder"></i><%=item.filepath%></div>
375
378
  <div class='title'><%=item.name%></div>
376
379
  <div class='description'><%=item.description%></div>
377
380
  <div class='menu-btns'>
@@ -446,7 +449,7 @@ body.dark .open-menu, body.dark .browse {
446
449
  <% } %>
447
450
  </div>
448
451
  <div class='col'>
449
- <div class='uri'><i class="fa-regular fa-folder"></i><%=item.url%></div>
452
+ <div class='uri'><i class="fa-regular fa-folder"></i><%=item.filepath%></div>
450
453
  <div class='title'><%=item.name%></div>
451
454
  <div class='description'><%=item.description%></div>
452
455
  <div class='menu-btns'>
@@ -458,11 +461,14 @@ body.dark .open-menu, body.dark .browse {
458
461
  </button>
459
462
  <div class='context-menu collapsed'>
460
463
  <div class='context-menu-wrapper'>
464
+ <button class='btn' data-filepath="<%=item.filepath%>">
465
+ <i class="fa-solid fa-folder-open"></i> Open</button>
466
+ </button>
461
467
  <button class='btn copy-menu' data-src="<%=item.browser_url%>/browse">
462
468
  <i class='fa-solid fa-copy'></i> Copy
463
469
  </button>
464
470
  <button class='btn move-menu' data-src="<%=item.browser_url%>/browse">
465
- <i class="fa-solid fa-pencil"></i> Move
471
+ <i class="fa-solid fa-right-to-bracket"></i> Move
466
472
  </button>
467
473
  <button class='btn edit-menu' data-src="<%=item.browser_url%>/browse">
468
474
  <i class='fa-solid fa-pen-to-square'></i> Edit
@@ -392,6 +392,7 @@ input:checked + .slider:before {
392
392
  }
393
393
  </style>
394
394
  <script src="/hotkeys.min.js"></script>
395
+ <script src="/sweetalert2.js"></script>
395
396
  <script src="/common.js"></script>
396
397
  <script src="/opener.js"></script>
397
398
  </head>
@@ -26,9 +26,11 @@ main {
26
26
  }
27
27
  .doc {
28
28
  padding: 20px;
29
- margin-top: 20px;
29
+ margin: 20px;
30
+ /*
30
31
  border-radius: 10px;
31
32
  border: 1px solid rgba(0,0,0,0.1);
33
+ */
32
34
  }
33
35
  #readme {
34
36
  border-top: 1px solid rgba(0,0,0,0.1);
@@ -233,7 +233,6 @@ hr {
233
233
  <script src="/xterm-addon-fit.js"></script>
234
234
  <script src="/xterm-addon-web-links.js"></script>
235
235
  <script src="/xterm-theme.js"></script>
236
- <script src="/sweetalert2.js"></script>
237
236
  <script src="/install.js"></script>
238
237
  <script src="/timeago.min.js"></script>
239
238
  <script src="/common.js"></script>