pinokiod 3.19.65 → 3.19.67

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.
@@ -214,7 +214,11 @@ class Api {
214
214
 
215
215
 
216
216
  // stop all shell processes connected to the uri
217
- this.kernel.shell.kill({ group: requestPath })
217
+ if (req.params.id) {
218
+ this.kernel.shell.kill({ group: req.params.id })
219
+ } else {
220
+ this.kernel.shell.kill({ group: requestPath })
221
+ }
218
222
 
219
223
  // if any process is in a "wait" state, resume it
220
224
  this.kernel.resumeprocess(requestPath)
@@ -48,7 +48,11 @@ class Shell {
48
48
 
49
49
  let options = {}
50
50
  if (req.cwd) options.cwd = req.cwd
51
- if (req.parent && req.parent.path) options.group = req.parent.path
51
+ if (req.parent && req.parent.id) {
52
+ options.group = req.parent.id
53
+ } else if (req.parent && req.parent.path) {
54
+ options.group = req.parent.path
55
+ }
52
56
  let id = await kernel.shell.start(req.params, options, ondata)
53
57
  return id
54
58
  //let id = await kernel.shell.start(req.params, options)
@@ -123,7 +127,11 @@ class Shell {
123
127
  }
124
128
  let options = {}
125
129
  if (req.cwd) options.cwd = req.cwd
126
- if (req.parent && req.parent.path) options.group = req.parent.path
130
+ if (req.parent && req.parent.id) {
131
+ options.group = req.parent.id
132
+ } else if (req.parent && req.parent.path) {
133
+ options.group = req.parent.path
134
+ }
127
135
  if (req.client) {
128
136
  req.params.rows = req.client.rows
129
137
  req.params.cols = req.client.cols
@@ -41,6 +41,7 @@ class Bin {
41
41
  this.platform = os.platform()
42
42
  }
43
43
  async shell_kill(params, ondata) {
44
+ console.log("shell_kill", params)
44
45
  this.kernel.shell.kill(params.params)
45
46
  }
46
47
  async shell_start(params, ondata) {
package/kernel/shells.js CHANGED
@@ -459,6 +459,7 @@ class Shells {
459
459
  }
460
460
  }
461
461
  } else if (request.group) {
462
+ // console.log("kill group", this.shells)
462
463
  // kill all shells for the scriptpath
463
464
  let shells = []
464
465
  for(let i=0; i<this.shells.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.19.65",
3
+ "version": "3.19.67",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -366,6 +366,8 @@ class Server {
366
366
  }
367
367
 
368
368
  async chrome(req, res, type) {
369
+ let d = Date.now()
370
+ console.time("1 chrome " + d)
369
371
  let { requirements, install_required, requirements_pending, error } = await this.kernel.bin.check({
370
372
  bin: this.kernel.bin.preset("dev"),
371
373
  })
@@ -373,6 +375,7 @@ class Server {
373
375
  res.redirect(`/setup/dev?callback=${req.originalUrl}`)
374
376
  return
375
377
  }
378
+ console.timeEnd("1 chrome " + d)
376
379
 
377
380
  let name = req.params.name
378
381
  let config = await this.kernel.api.meta(name)
@@ -487,17 +490,22 @@ class Server {
487
490
  // }
488
491
  // }
489
492
 
493
+ console.time("2 chrome " + d)
490
494
  await this.init_env("api/" + name)
495
+ console.timeEnd("2 chrome " + d)
491
496
 
497
+ console.time("3 chrome " + d)
492
498
  let mode = "run"
493
499
  if (req.query && req.query.mode) {
494
500
  mode = req.query.mode
495
501
  }
496
502
  const env = await this.kernel.env("api/" + name)
503
+ console.timeEnd("3 chrome " + d)
497
504
 
498
505
  // profile + feed
499
506
  const repositoryPath = path.resolve(this.kernel.api.userdir, name)
500
507
 
508
+ console.time("4 chrome " + d)
501
509
  try {
502
510
  await git.resolveRef({ fs, dir: repositoryPath, ref: 'HEAD' });
503
511
  } catch (err) {
@@ -506,7 +514,9 @@ class Server {
506
514
  await git.init({ fs, dir: repositoryPath });
507
515
  }
508
516
 
517
+ console.timeEnd("4 chrome " + d)
509
518
 
519
+ console.time("5 chrome " + d)
510
520
  let gitRemote = await git.getConfig({ fs, http, dir: repositoryPath, path: 'remote.origin.url' })
511
521
  let profile
512
522
  let feed
@@ -520,11 +530,13 @@ class Server {
520
530
  profile = this.profile(gitRemote)
521
531
  feed = this.newsfeed(gitRemote)
522
532
  }
533
+ console.timeEnd("5 chrome " + d)
523
534
 
524
535
  // git
525
536
 
526
537
  let c = this.kernel.path("api", name)
527
538
 
539
+ console.time("6 chrome " + d)
528
540
  await this.kernel.plugin.init()
529
541
  let plugin = await this.getPlugin(name)
530
542
  let plugin_menu = null
@@ -540,6 +552,7 @@ class Server {
540
552
  // repos,
541
553
  current_urls,
542
554
  path: this.kernel.path("api", name),
555
+ log_path: this.kernel.path("api", name, "logs"),
543
556
  plugin_menu,
544
557
  portal: this.portal,
545
558
  install: this.install,
@@ -568,12 +581,16 @@ class Server {
568
581
  theme: this.theme,
569
582
  agent: this.agent,
570
583
  src: "/_api/" + name,
584
+ logs: "/_api/" + name + "/logs",
571
585
  execUrl: "/api/" + name,
572
586
  // rawpath,
573
587
  }
588
+ console.timeEnd("6 chrome " + d)
589
+ console.time("7 chrome " + d)
574
590
  if (!this.kernel.proto.config) {
575
591
  await this.kernel.proto.init()
576
592
  }
593
+ console.timeEnd("7 chrome " + d)
577
594
  res.render("app", result)
578
595
  }
579
596
  getVariationUrls(req) {
@@ -4367,8 +4384,8 @@ class Server {
4367
4384
  }
4368
4385
  res.json({ config: this.xterm })
4369
4386
  }))
4370
- this.app.get("/du/:name", ex(async (req, res) => {
4371
- let p = this.kernel.path("api", req.params.name)
4387
+ this.app.get("/du/*", ex(async (req, res) => {
4388
+ let p = this.kernel.path("api", req.params[0])
4372
4389
  try {
4373
4390
  let d1 = await Util.du(p)
4374
4391
  res.json({ du: d1 })
package/server/socket.js CHANGED
@@ -4,6 +4,7 @@ const Util = require("../kernel/util")
4
4
  class Socket {
5
5
  constructor(parent) {
6
6
  this.buffer = {}
7
+ this.old_buffer = {}
7
8
  this.sessions = {}
8
9
  this.connected = {}
9
10
  this.active_shell = {}
@@ -836,11 +836,15 @@ body.dark .appcanvas {
836
836
  <div class='m n system' data-type="n">
837
837
  <a target="<%=src%>" href="<%=src%>" class='btn header-item frame-link' data-index="0" data-mode="refresh">
838
838
  <div class='tab'>
839
- <i class="fa-regular fa-folder-open"></i> Files <div class='disk-usage'></div>
839
+ <i class="fa-regular fa-folder-open"></i> Files
840
840
  </div>
841
- <div class='loader'>
842
- <i id='open-folder' data-filepath="<%=path%>" class="fa-solid fa-up-right-from-square"></i>
841
+ <div class='disk-usage' data-path="/"></div>
842
+ </a>
843
+ <a target="<%=logs%>" href="<%=logs%>" class='btn header-item frame-link' data-index="1" data-mode="refresh">
844
+ <div class='tab'>
845
+ <i class="fa-solid fa-clock-rotate-left"></i> Logs
843
846
  </div>
847
+ <div class='disk-usage' data-path="/logs"></div>
844
848
  </a>
845
849
  <% if (profile || feed) { %>
846
850
  <div class='btn header-item frame-link revealer' data-group='.info-group'>
@@ -1879,9 +1883,10 @@ body.dark .appcanvas {
1879
1883
 
1880
1884
 
1881
1885
  })
1882
- const refresh_du = () => {
1886
+ const refresh_du = (path) => {
1883
1887
  console.log("REFRESH DU")
1884
- fetch("/du/<%=name%>").then((res) => {
1888
+ let url = path ? `/du/<%=name%>/${path}` : `/du/<%=name%>`
1889
+ fetch(url).then((res) => {
1885
1890
  return res.json()
1886
1891
  }).then((res) => {
1887
1892
  if (res.du > 0) {
@@ -1899,7 +1904,8 @@ body.dark .appcanvas {
1899
1904
  val = `${Math.floor(res.du/k * 100) / 100} KB`
1900
1905
  }
1901
1906
  console.log("DU VAL", val)
1902
- document.querySelector(".disk-usage").innerHTML = val
1907
+ let selector = `.disk-usage[data-path='/${path || ""}']`
1908
+ document.querySelector(selector).innerHTML = val
1903
1909
  } else {
1904
1910
  }
1905
1911
  })
@@ -2032,6 +2038,7 @@ body.dark .appcanvas {
2032
2038
  }
2033
2039
  if (event.data.type === 'result') {
2034
2040
  refresh_du()
2041
+ refresh_du("logs")
2035
2042
  }
2036
2043
  }
2037
2044
  } else {
@@ -2044,6 +2051,7 @@ body.dark .appcanvas {
2044
2051
 
2045
2052
  });
2046
2053
  refresh_du()
2054
+ refresh_du("logs")
2047
2055
  <% if (type !== 'run') { %>
2048
2056
  debugger
2049
2057
  fetch("<%=repos%>").then((res) => {
@@ -194,7 +194,7 @@ body.dark .browser-options-row {
194
194
  </h1>
195
195
  <% if (!ishome) { %>
196
196
  <div class='runner'>
197
- <button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> View Folder</button>
197
+ <button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-square-arrow-up-right"></i>&nbsp;&nbsp;Open in File Explorer</button>
198
198
  </div>
199
199
  <% } %>
200
200
  <% if (display.includes("dependencies")) { %>
@@ -798,19 +798,19 @@ if (document.querySelector("form input[type=search]")) {
798
798
  // if launch_complete is false => not finished launching. wait until it's complete, and then refresh
799
799
  // autolaunch display update
800
800
  <% if (!launch_complete) { %>
801
- let interval = setInterval(async () => {
802
- let res = await fetch("/pinokio/info").then((res) => {
803
- return res.json()
804
- })
805
- if (res.launch_complete) {
806
- debugger
807
- console.log("launched")
808
- clearInterval(interval)
809
- location.href = location.href
810
- } else {
811
- console.log("not yet launched")
812
- }
813
- }, 1000)
801
+ // let interval = setInterval(async () => {
802
+ // let res = await fetch("/pinokio/info").then((res) => {
803
+ // return res.json()
804
+ // })
805
+ // if (res.launch_complete) {
806
+ // debugger
807
+ // console.log("launched")
808
+ // clearInterval(interval)
809
+ // location.href = location.href
810
+ // } else {
811
+ // console.log("not yet launched")
812
+ // }
813
+ // }, 1000)
814
814
  <% } %>
815
815
  document.addEventListener("keydown", (e) => {
816
816
  e = e || window.event;