pinokiod 3.2.249 → 3.2.251

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/kernel/index.js CHANGED
@@ -492,9 +492,7 @@ class Kernel {
492
492
  // get env
493
493
  if (!this.launch_complete) {
494
494
  let interval = setInterval(async () => {
495
- console.log(">>>>> 1")
496
495
  if (this.i) {
497
- console.log(">>>>> 2")
498
496
  for(let api of this.i.api) {
499
497
  console.log({ api })
500
498
  let env_path = path.resolve(this.api.userdir, api.path)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.249",
3
+ "version": "3.2.251",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2301,6 +2301,7 @@ class Server {
2301
2301
  folders = {
2302
2302
  bin: path.resolve(this.kernel.homedir, "bin"),
2303
2303
  cache: path.resolve(this.kernel.homedir, "cache"),
2304
+ env: path.resolve(this.kernel.homedir, "ENVIRONMENT"),
2304
2305
  drive: path.resolve(this.kernel.homedir, "drive"),
2305
2306
  }
2306
2307
  }
@@ -2982,6 +2983,12 @@ class Server {
2982
2983
  await fse.remove(folderPath)
2983
2984
  await fs.promises.mkdir(folderPath, { recursive: true }).catch((e) => { })
2984
2985
  res.json({ success: true })
2986
+ } else if (req.body.type === 'env') {
2987
+ let envpath = this.kernel.path("ENVIRONMENT")
2988
+ let str = await Environment.ENV("system", this.kernel.homedir)
2989
+ console.log({ str })
2990
+ await fs.promises.writeFile(path.resolve(this.kernel.homedir, "ENVIRONMENT"), str)
2991
+ res.json({ success: true })
2985
2992
  } else if (req.body.type === 'browser-cache') {
2986
2993
  if (this.browser) {
2987
2994
  await this.browser.clearCache()
@@ -3075,9 +3082,7 @@ class Server {
3075
3082
 
3076
3083
  let folder = this.kernel.path("exported_logs")
3077
3084
  let zipPath = this.kernel.path("logs.zip")
3078
- console.log(">1")
3079
3085
  await compressing.zip.compressDir(folder, zipPath)
3080
- console.log(">2")
3081
3086
  res.json({ success: true })
3082
3087
  }))
3083
3088
  this.app.get("/pinokio/info", ex(async (req, res) => {
@@ -330,6 +330,17 @@ hr {
330
330
  <button class='red btn' id='del-cache'><i class="fa-solid fa-trash-can"></i> Reset</button>
331
331
  </div>
332
332
  </div>
333
+ <div class='item'>
334
+ <label><i class="fa-solid fa-folder-open"></i> environment variables</label>
335
+ <div class='d'>Reset the pinokio environment variables and start fresh from scratch</div>
336
+ <div class='reset-env-loading hidden'>
337
+ <i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
338
+ </div>
339
+ <div>
340
+ <button class='btn' data-filepath="<%=env%>"><i class="fa-solid fa-up-right-from-square"></i> View ENVIRONMENT file</button>
341
+ <button class='red btn' id='del-env'><i class="fa-solid fa-trash-can"></i> Reset</button>
342
+ </div>
343
+ </div>
333
344
  <% if (agent === "electron") { %>
334
345
  <div class='item'>
335
346
  <label><i class="fa-solid fa-folder-open"></i> browser cache</label>
@@ -417,6 +428,30 @@ document.addEventListener("DOMContentLoaded", async () => {
417
428
  }
418
429
  }
419
430
  })
431
+ document.querySelector("#del-env").addEventListener("click", async (e) => {
432
+ console.log("del-env")
433
+ let proceed = confirm("Are you sure you wish to reset the environment variables?")
434
+ if (proceed) {
435
+ document.querySelector(".reset-env-loading").classList.remove("hidden")
436
+ document.querySelector("#del-env").classList.add("hidden")
437
+ let res = await fetch("/pinokio/delete", {
438
+ method: "post",
439
+ headers: {
440
+ "Content-Type": "application/json"
441
+ },
442
+ body: JSON.stringify({ type: "env" })
443
+ }).then((res) => {
444
+ return res.json()
445
+ })
446
+ console.log(res)
447
+ document.querySelector(".reset-env-loading").classList.add("hidden")
448
+ if (res.error) {
449
+ alert(res.error)
450
+ } else {
451
+ location.href = location.href
452
+ }
453
+ }
454
+ })
420
455
  <% } %>
421
456
  <% if (agent === "electron") { %>
422
457
  if (document.querySelector("#del-browser-cache")) {