pinokiod 3.10.0 → 3.10.1

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/info.js CHANGED
@@ -6,6 +6,7 @@ info.path(...args)
6
6
  */
7
7
  const path = require('path')
8
8
  const fs = require("fs")
9
+ const Util = require('./util')
9
10
  class Info {
10
11
  constructor(kernel) {
11
12
  this.kernel = kernel
@@ -26,6 +27,11 @@ class Info {
26
27
  Error.prepareStackTrace = _prepareStackTrace;
27
28
  }
28
29
  }
30
+ async venv(_cwd) {
31
+ let cwd = _cwd || this.cwd()
32
+ let venv = await Util.find_venv(cwd)
33
+ return venv
34
+ }
29
35
  cwd() {
30
36
  return path.dirname(this.caller())
31
37
  }
package/kernel/plugin.js CHANGED
@@ -4,7 +4,9 @@ class Plugin {
4
4
  this.kernel = kernel
5
5
  }
6
6
  async init() {
7
+ console.log("Plugin.init")
7
8
  if (this.kernel.bin.installed && this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git")) {
9
+ console.log("INSTALLED")
8
10
  // if ~/pinokio/prototype doesn't exist, clone
9
11
  let exists = await this.kernel.exists("plugin")
10
12
  if (!exists) {
@@ -15,10 +17,13 @@ class Plugin {
15
17
  process.stdout.write(e.raw)
16
18
  })
17
19
  }
20
+ console.log("#################")
18
21
 
19
22
  let plugin_dir = path.resolve(this.kernel.homedir, "plugin")
20
23
  let pinokiojs = path.resolve(plugin_dir, "pinokio.js")
24
+ console.log("pinokiojs", pinokiojs)
21
25
  this.config = await this.kernel.require(pinokiojs)
26
+ console.log("this.config", this.config)
22
27
  }
23
28
  }
24
29
  async update() {
@@ -12,7 +12,7 @@ class Proto {
12
12
  if (this.kernel.bin.installed && this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git")) {
13
13
 
14
14
  // if ~/pinokio/prototype doesn't exist, clone
15
- let exists = await this.kernel.exists("prototype")
15
+ let exists = await this.kernel.exists("prototype/system")
16
16
  if (!exists) {
17
17
  console.log("prototype doesn't exist. cloning...")
18
18
  await fs.promises.mkdir(this.kernel.path("prototype"), { recursive: true }).catch((e) => { })
@@ -27,16 +27,21 @@ class Proto {
27
27
 
28
28
  let pinokiojs_path = this.kernel.path("prototype/system/pinokio.js")
29
29
  let config = await this.kernel.require(pinokiojs_path)
30
+ console.log("--config", config)
30
31
  this.config = config
31
32
 
32
- this.config.menu.push({
33
- icon: "fa-solid fa-rotate",
34
- text: "Update",
35
- shell: {
36
- message: "git pull",
37
- path: this.kernel.path("prototype/system")
38
- }
39
- })
33
+ if (this.config.menu) {
34
+ this.config.menu.push({
35
+ icon: "fa-solid fa-rotate",
36
+ text: "Update",
37
+ shell: {
38
+ message: "git pull",
39
+ path: this.kernel.path("prototype/system")
40
+ }
41
+ })
42
+ }
43
+
44
+
40
45
 
41
46
 
42
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -146,6 +146,7 @@ class Server {
146
146
  } else {
147
147
  newIndexPath = "" + i
148
148
  }
149
+ console.log({ item, i, indexPath, newIndexPath })
149
150
  traverse(item, newIndexPath);
150
151
  }
151
152
  } else if (obj !== null && typeof obj === 'object') {
@@ -174,7 +175,9 @@ class Server {
174
175
  }
175
176
  }
176
177
  } else if (key === "shell") {
178
+ console.log("shell", key, obj[key], indexPath)
177
179
  let shell_id = this.get_shell_id(name, indexPath, obj[key])
180
+ console.log("shell_id", shell_id, this.kernel.api.running[shell_id], this.kernel.api.running)
178
181
  if (this.kernel.api.running[shell_id]) {
179
182
  obj.display = "indent"
180
183
  running_dynamic.push(obj)
@@ -475,6 +478,7 @@ class Server {
475
478
  feed = this.newsfeed(gitRemote)
476
479
  }
477
480
 
481
+ await this.kernel.plugin.init()
478
482
  let plugin = await this.getPlugin(name)
479
483
  let plugin_menu = null
480
484
  if (plugin && plugin.menu && Array.isArray(plugin.menu)) {
@@ -1722,7 +1726,9 @@ class Server {
1722
1726
  } else {
1723
1727
  currentIndexPath = "" + i
1724
1728
  }
1729
+ console.log(">>", { indexPath, currentIndexPath, i })
1725
1730
  let shell_id = this.get_shell_id(name, currentIndexPath, rendered)
1731
+ console.log(">>", { name, shell_id, })
1726
1732
 
1727
1733
 
1728
1734
  // let hash = crypto.createHash('md5').update(JSON.stringify(rendered)).digest('hex')
@@ -4069,6 +4075,7 @@ class Server {
4069
4075
  }
4070
4076
  }))
4071
4077
  this.app.get("/pinokio/dynamic/:name", ex(async (req, res) => {
4078
+ await this.kernel.plugin.init()
4072
4079
  let plugin = await this.getPlugin(req.params.name)
4073
4080
  let html = ""
4074
4081
  if (plugin && plugin.menu && Array.isArray(plugin.menu)) {
@@ -761,7 +761,8 @@ document.addEventListener("DOMContentLoaded", async () => {
761
761
  </head>
762
762
  <body class='<%=theme%>'>
763
763
  <header class='navheader grabbable'>
764
- <div class='navheader3'>
764
+ <h1>
765
+ <a class='home' href="/"><img class='icon' src="/pinokio-black.png"></a>
765
766
  <div class='hidden btn run play-btn'>
766
767
  <span class='play'><i class="fa-solid fa-play"></i> Start</span>
767
768
  </div>
@@ -774,7 +775,7 @@ document.addEventListener("DOMContentLoaded", async () => {
774
775
  <div class='hidden btn stopped-btn'>
775
776
  <span class='stopped'><i class="fa-solid fa-hand"></i> Stopped</span>
776
777
  </div>
777
- </div>
778
+ </h1>
778
779
  </header>
779
780
  <div class='terminal-container'>
780
781
  <div id='terminal'></div>