pinokiod 2.1.10 → 2.1.12

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.
@@ -328,6 +328,16 @@ class Bin {
328
328
  }
329
329
  }
330
330
  this.installed.brew = new Set(brew)
331
+
332
+
333
+ // check brew_installed
334
+ console.log("checking brew installed")
335
+ let e = await this.kernel.bin.exists("homebrew")
336
+ let { stdout }= await this.kernel.bin.exec({ message: "xcode-select -p" }, (stream) => { })
337
+ let e2 = /(.*Library.*Developer.*CommandLineTools.*|.*Xcode.*Developer.*)/gi.test(stdout)
338
+ console.log({ e, e2, stdout })
339
+ this.brew_installed = e && e2
340
+
331
341
  }
332
342
 
333
343
  // /// B. base path initialization
@@ -350,13 +360,6 @@ class Bin {
350
360
 
351
361
  console.log("this.installed", this.installed)
352
362
 
353
- // check brew_installed
354
- console.log("checking brew installed")
355
- let e = await this.kernel.bin.exists("homebrew")
356
- let { stdout }= await this.kernel.bin.exec({ message: "xcode-select -p" }, (stream) => { })
357
- let e2 = /(.*Library.*Developer.*CommandLineTools.*|.*Xcode.*Developer.*)/gi.test(stdout)
358
- console.log({ e, e2, stdout })
359
- this.brew_installed = e && e2
360
363
 
361
364
 
362
365
  this.installed_initialized = true
@@ -78,7 +78,7 @@ const ENVS = async () => {
78
78
  type: ["system"],
79
79
  key: "PS1",
80
80
  hidden: true,
81
- val: "<<PINOKIO SHELL>> "
81
+ val: "<<PINOKIO_SHELL>> "
82
82
  }, {
83
83
  type: ["system"],
84
84
  key: "GRADIO_ANALYTICS_ENABLED",
@@ -283,11 +283,23 @@ const ENVS = async () => {
283
283
  // type := system|app
284
284
  const ENV = async (type, homedir) => {
285
285
  const envs = await ENVS()
286
- let filtered_envs = envs.filter((e) => {
287
- return e.type.includes(type)
288
- })
286
+ let filtered_envs = []
287
+ let irrelevant_keys = []
288
+ for(let e of envs) {
289
+ if (e.type.includes(type)) {
290
+ filtered_envs.push(e)
291
+ } else {
292
+ irrelevant_keys.push(e.key)
293
+ }
294
+ }
295
+
296
+ // let filtered_envs = envs.filter((e) => {
297
+ // return e.type.includes(type)
298
+ // })
289
299
 
290
300
  let lines = []
301
+ let system_env
302
+ let keys = new Set()
291
303
  for(let e of filtered_envs) {
292
304
  let comment = ""
293
305
  if (e.comment && Array.isArray(e.comment)) {
@@ -305,17 +317,40 @@ const ENV = async (type, homedir) => {
305
317
  // if e.key exists on system env, use that
306
318
  // if e.key does NOT exist on system env,
307
319
  if (type === 'app') {
308
- let system_env = await get(homedir)
320
+ system_env = await get(homedir)
309
321
  if (e.key in system_env) {
310
322
  console.log(`original ${e.key}=${val}`)
311
323
  val = system_env[e.key]
312
324
  console.log(`inherited from system_env: ${e.key}=${val}`)
325
+ keys.add(e.key)
313
326
  }
314
327
  }
315
328
 
316
329
  let kv = `${e.key}=${val}`
330
+ console.log("kv", kv)
317
331
  lines.push(comment+kv)
318
332
  }
333
+
334
+ // In case of type: app, inherit any other custom ENVIRONMENT variable not yet included
335
+ console.log({ irrelevant_keys })
336
+ if (type === "app" && system_env) {
337
+ for(let key in system_env) {
338
+ if (!keys.has(key)) {
339
+ // the key has not been processed, need to add to the lines
340
+ if (irrelevant_keys.includes(key)) {
341
+ // if the key was explicitly stated to be not included, skip
342
+ console.log("irrelevant key", key)
343
+ } else {
344
+ console.log("relevant key", key)
345
+ let val = system_env[key]
346
+ let kv = `${key}=${val}`
347
+ lines.push(kv)
348
+ console.log(`inherited custom environment key from system_env: ${kv}`)
349
+ }
350
+ }
351
+ }
352
+ }
353
+
319
354
  return lines.join("\n")
320
355
  }
321
356
  const init_folders = async (homedir) => {
package/kernel/sysinfo.js CHANGED
@@ -16,7 +16,7 @@ class Sysinfo {
16
16
  // await this.disk()
17
17
  }
18
18
  async refresh() {
19
- await this.time()
19
+ // await this.time()
20
20
  await this.memory()
21
21
  await this.battery()
22
22
  await this.proc()
@@ -54,9 +54,9 @@ class Sysinfo {
54
54
  this.info.gpu = gpu
55
55
 
56
56
  }
57
- async time() {
58
- this.info.time = await system.time()
59
- }
57
+ // async time() {
58
+ // this.info.time = await system.time()
59
+ // }
60
60
  async system() {
61
61
  this.info.system = await system.system()
62
62
  }
package/kernel/util.js CHANGED
@@ -95,10 +95,12 @@ const update_env = async (filepath, changes) => {
95
95
  .replace(returnPattern, returnReplacement)
96
96
  .trim();
97
97
  const safeName = escapeStringRegexp(varname);
98
- const varPattern = new RegExp(`^(${h}*${safeName}${h}*=${h}*)\\S*(${h}*)$`, "gm");
98
+ //const varPattern = new RegExp(`^(${h}*${safeName}${h}*=${h}*)\\S*(${h}*)$`, "gm");
99
+ const varPattern = new RegExp(`^(${h}*${safeName}${h}*=${h}*)(\\S(?:.*\\S)?)?(${h}*)$`, "gm");
99
100
  if (varPattern.test(result)) {
100
101
  const safeValue = value.replace(groupPattern, groupReplacement);
101
- return result.replace(varPattern, `$1${safeValue}$2`);
102
+ //return result.replace(varPattern, `$1${safeValue}$2`);
103
+ return result.replace(varPattern, `$1${safeValue}$3`);
102
104
  } else if (result === "") {
103
105
  append = true;
104
106
  return `${varname}=${value}${EOL}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "2.1.10",
3
+ "version": "2.1.12",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -459,9 +459,10 @@ class Server {
459
459
  install_required = false
460
460
  for(let i=0; i<requirements.length; i++) {
461
461
  let r = requirements[i]
462
- console.log("r", r)
462
+ console.time(r.name)
463
463
  let installed = await this.installed(r)
464
- console.log("installed", installed)
464
+ console.log({ r, installed })
465
+ console.timeEnd(r.name)
465
466
  requirements[i].installed = installed
466
467
  if (!installed) {
467
468
  install_required = true
@@ -3,7 +3,6 @@
3
3
  <style>
4
4
  body {
5
5
  width: 100%;
6
- height: 100%;
7
6
  margin: 0;
8
7
  background: royalblue;
9
8
  color: white;
@@ -41,9 +40,9 @@ footer a {
41
40
  <footer>
42
41
  <div>You may want to try:</div>
43
42
  <ol>
44
- <li>Update to the latest version of Pinokio: <a href="https://program.pinokio.computer/#/?id=install" target="_blank">https://program.pinokio.computer/#/?id=install</a></li>
43
+ <li>Update Pinokio: Simply install the latest version, it should only update the app binary while keeping all the data in tact. <a href="https://program.pinokio.computer/#/?id=install" target="_blank">Go to Download Page</a></li>
45
44
  <li>Try troubleshooting: <a href="/?mode=settings#troubleshoot">Troubleshoot</a></li>
46
- <li>Ask in community Discord: <a href="https://discord.gg/TQdNwadtE4" target="_blank">Discord</a></li>
45
+ <li>Ask in community Discord: <a href="http://localhost/?mode=help" target="_blank">Community</a></li>
47
46
  </ol>
48
47
  </footer>
49
48
  </body>