pinokiod 3.2.197 → 3.2.198

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
@@ -35,7 +35,8 @@ const VARS = {
35
35
  class Kernel {
36
36
  //schema = ">=1.0.0"
37
37
  //schema = "<=2.1.0"
38
- schema = "<=3.2.0"
38
+ //schema = "<=3.2.0"
39
+ schema = "<=3.3.0"
39
40
  constructor(store) {
40
41
  this.fetch = fetch
41
42
  this.store = store
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.197",
3
+ "version": "3.2.198",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2101,6 +2101,22 @@ class Server {
2101
2101
 
2102
2102
  console.log("available port", this.port)
2103
2103
 
2104
+ let version = this.kernel.store.get("version")
2105
+ let home = this.kernel.store.get("home")
2106
+ console.log({ home, version })
2107
+ if (home) {
2108
+ if (version === this.version.pinokiod) {
2109
+ console.log("version up to date")
2110
+ } else {
2111
+ console.log("not up to date. update py.")
2112
+ // remove ~/bin/miniconda/py
2113
+ let p = path.resolve(home, "bin/py")
2114
+ console.log(`[TRY] reset ${p}`)
2115
+ await fse.remove(p)
2116
+ console.log(`[DONE] reset ${p}`)
2117
+ }
2118
+ }
2119
+
2104
2120
  // initialize kernel
2105
2121
  await this.kernel.init({ port: this.port})
2106
2122
 
@@ -2131,64 +2147,64 @@ class Server {
2131
2147
  // }
2132
2148
  await this.startLogging()
2133
2149
 
2134
- // check version from this.store
2135
- let version = this.kernel.store.get("version")
2136
- // if the version is different from package.json version, run update logic
2137
- console.log({_homedir: this.kernel.homedir, version, pinokiod: this.version.pinokiod })
2138
- if (this.kernel.homedir) {
2139
- if (version === this.version.pinokiod) {
2140
- console.log("version up to date")
2141
- } else {
2142
- // update the py module if it's already installed
2143
- console.log("not up to date")
2144
-
2145
- // // give full permission to pinokio folder on windows
2146
- // if (this.kernel.platform === "win32") {
2147
- // console.log("1 Give full permission")
2148
- // await this.kernel.bin.exec({
2149
- // sudo: true,
2150
- // message: `icacls ${this.kernel.homedir} /grant Users:(OI)(CI)F /T`
2151
- // }, (stream) => {
2152
- // console.log({ stream })
2153
- // })
2154
- // console.log("1 Give full permission done")
2155
- // }
2156
-
2157
-
2158
- await new Promise((resolve, reject) => {
2159
- let interval = setInterval(async () => {
2160
- console.log("checking mod.py")
2161
- if (this.kernel.bin.mod && this.kernel.bin.mod.py) {
2162
- console.log("mod.py initialized!")
2163
- let installed = await this.kernel.bin.mod.py.installed()
2164
- console.log("py installed", installed)
2165
- if (installed) {
2166
- // update
2167
- console.log("update py")
2168
- await this.kernel.exec({
2169
- message: "git pull",
2170
- path: this.kernel.path("bin/py")
2171
- }, (e) => {
2172
- console.log(e)
2173
- })
2174
- }
2175
- // after updating, set the version
2176
- console.log("set the version", this.version.pinokiod)
2177
- this.kernel.store.set("version", this.version.pinokiod)
2178
- console.log("RESTART")
2179
- clearInterval(interval)
2180
- resolve()
2181
- } else {
2182
- console.log("mod.py not initialized yet")
2183
- }
2184
- }, 1000)
2185
- })
2186
- this.listening = true // set this.listening = true so all http connections get reset when restarting
2187
- await this.start(options)
2188
- console.log("RESTARTED")
2189
- return
2190
- }
2191
- }
2150
+ // // check version from this.store
2151
+ // //let version = this.kernel.store.get("version")
2152
+ // // if the version is different from package.json version, run update logic
2153
+ // console.log({_homedir: this.kernel.homedir, version, pinokiod: this.version.pinokiod })
2154
+ // if (this.kernel.homedir) {
2155
+ // if (version === this.version.pinokiod) {
2156
+ // console.log("version up to date")
2157
+ // } else {
2158
+ // // update the py module if it's already installed
2159
+ // console.log("not up to date")
2160
+ //
2161
+ //// // give full permission to pinokio folder on windows
2162
+ //// if (this.kernel.platform === "win32") {
2163
+ //// console.log("1 Give full permission")
2164
+ //// await this.kernel.bin.exec({
2165
+ //// sudo: true,
2166
+ //// message: `icacls ${this.kernel.homedir} /grant Users:(OI)(CI)F /T`
2167
+ //// }, (stream) => {
2168
+ //// console.log({ stream })
2169
+ //// })
2170
+ //// console.log("1 Give full permission done")
2171
+ //// }
2172
+ //
2173
+ //
2174
+ // await new Promise((resolve, reject) => {
2175
+ // let interval = setInterval(async () => {
2176
+ // console.log("checking mod.py")
2177
+ // if (this.kernel.bin.mod && this.kernel.bin.mod.py) {
2178
+ // console.log("mod.py initialized!")
2179
+ // let installed = await this.kernel.bin.mod.py.installed()
2180
+ // console.log("py installed", installed)
2181
+ // if (installed) {
2182
+ // // update
2183
+ // console.log("update py")
2184
+ // await this.kernel.exec({
2185
+ // message: "git pull",
2186
+ // path: this.kernel.path("bin/py")
2187
+ // }, (e) => {
2188
+ // console.log(e)
2189
+ // })
2190
+ // }
2191
+ // // after updating, set the version
2192
+ // console.log("set the version", this.version.pinokiod)
2193
+ // this.kernel.store.set("version", this.version.pinokiod)
2194
+ // console.log("RESTART")
2195
+ // clearInterval(interval)
2196
+ // resolve()
2197
+ // } else {
2198
+ // console.log("mod.py not initialized yet")
2199
+ // }
2200
+ // }, 1000)
2201
+ // })
2202
+ // this.listening = true // set this.listening = true so all http connections get reset when restarting
2203
+ // await this.start(options)
2204
+ // console.log("RESTARTED")
2205
+ // return
2206
+ // }
2207
+ // }
2192
2208
 
2193
2209
 
2194
2210
 
@@ -2223,7 +2239,7 @@ class Server {
2223
2239
 
2224
2240
 
2225
2241
  //let home = this.kernel.homedir
2226
- let home = this.kernel.store.get("home")
2242
+ //let home = this.kernel.store.get("home")
2227
2243
  this.app.get("/", ex(async (req, res) => {
2228
2244
  if (req.query.mode !== "settings" && !home) {
2229
2245
  res.redirect("/?mode=settings")
@@ -126,9 +126,9 @@ footer a.btn {
126
126
  <div class='title'><%=item.title%></div>
127
127
  <div class='description'><%=item.description%></div>
128
128
  <% if (item.href.startsWith("http")) { %>
129
- <a target="_blank" features="browser" href='<%=item.href%>' class='btn'><i class="fa-solid fa-square-arrow-up-right"></i> Get</a>
129
+ <a target="_blank" features="browser" href='<%=item.href%>' class='btn'><i class="fa-solid fa-square-arrow-up-right"></i> Install</a>
130
130
  <% } else { %>
131
- <button class='btn' data-filepath="<%=item.href%>"><i class="fa-solid fa-square-arrow-up-right"></i> Get</button>
131
+ <button class='btn' data-filepath="<%=item.href%>"><i class="fa-solid fa-square-arrow-up-right"></i> Install</button>
132
132
  <% } %>
133
133
  </div>
134
134
  <!--