pinokiod 3.4.20 → 3.4.21

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.
@@ -5,10 +5,12 @@ module.exports = async (req, ondata, kernel) => {
5
5
  params: {
6
6
  raw: <raw string (including ANSI)>,
7
7
  json: <object>, // single line
8
- json2: <object> // multiline
8
+ json2: <object> // multiline,
9
+ img: <image file path>
9
10
  }
10
11
  }
11
12
  */
13
+ console.log("log req.params", req.params)
12
14
  if (req.params) {
13
15
  if (typeof req.params.raw !== "undefined") {
14
16
  ondata({
@@ -26,6 +28,13 @@ module.exports = async (req, ondata, kernel) => {
26
28
  ondata({
27
29
  raw: JSON.stringify(req.params.json2, null, 2).replace(/\n/g, "\r\n")
28
30
  })
31
+ // } else if (typeof req.params.img !== "undefined") {
32
+ // let cwd = (req.cwd ? req.cwd : kernel.api.userdir)
33
+ // let filepath = kernel.api.filePath(req.params.img, cwd)
34
+ // let { img, ...options } = req.params
35
+ // let data = await kernel.bin.img2Txt(filepath, options)
36
+ // console.log("### imgData", { data })
37
+ // ondata({ raw: data })
29
38
  }
30
39
  ondata({
31
40
  raw: "\r\n"
@@ -23,7 +23,8 @@ const { glob } = require('glob')
23
23
  const fakeUa = require('fake-useragent');
24
24
  const fse = require('fs-extra')
25
25
  const semver = require('semver')
26
- const terminalImage = require('terminal-image');
26
+ //const imageToAscii = require("image-to-ascii");
27
+
27
28
 
28
29
 
29
30
  //const Puppet = require("./puppeteer")
@@ -42,15 +43,14 @@ class Bin {
42
43
  let response = await this.kernel.shell.run(params, null, ondata)
43
44
  return response
44
45
  }
45
- async img2Txt(imgPath, options, ondata) {
46
- if (imgPath.endsWith(".gif")) {
47
- let data = await terminalImage.gifFile(imgPath, options)
48
- ondata({ raw: data })
49
- } else {
50
- let data = await terminalImage.file(imgPath, options)
51
- ondata({ raw: data })
52
- }
53
- }
46
+ // img2Txt(imgPath, options) {
47
+ // return new Promise((resolve, reject) => {
48
+ // imageToAscii(imgPath, options, (err, converted) => {
49
+ // console.log("ImgToAscii Error", err)
50
+ // resolve(converted)
51
+ // })
52
+ // })
53
+ // }
54
54
  async download(url, dest, ondata) {
55
55
  const userAgent = fakeUa()
56
56
  console.log("download userAgent", userAgent)
package/kernel/bin/vs.js CHANGED
@@ -23,11 +23,19 @@ class VS {
23
23
  ondata(stream)
24
24
  })
25
25
  ondata({ raw: `Install finished\r\n\r\n` })
26
- let WARNING = "[NOTICE] If this step keeps repeating, try opening the 'Visual Studio Installer' app on Windows, and check if there are failed installations, and uninstall them and retry.\r\n"
26
+ let WARNING = "[NOTICE] If the Visual Studio Install step keeps repeating, open the 'Visual Studio Installer' app on Windows, uninstall it, and retry.\r\n"
27
27
  ondata({
28
28
  raw: `\r\n\x1b[33m${WARNING}\x1b[0m\r\n\r\n`
29
29
  })
30
- await this.kernel.bin.img2Txt(path.resolve(__dirname, "./vsinstaller.gif"), { width: "60%" }, ondata)
30
+
31
+ let html = `<div>
32
+ <img src="/vsinstaller.gif">
33
+ <div>${WARNING}</div>
34
+ </div>`
35
+ ondata({
36
+ html,
37
+ // href: <link location to open>,
38
+ })
31
39
  return this.kernel.bin.rm(installer, ondata)
32
40
  } else {
33
41
  ondata({ raw: `Must be Windows 10 or above\r\n` })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.4.20",
3
+ "version": "3.4.21",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,6 @@
9
9
  "author": "",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "terminal-image": "1.2.1",
13
12
  "@homebridge/node-pty-prebuilt-multiarch": "0.12.0-beta.5",
14
13
  "7zip-min-win-asar-support": "^1.4.4",
15
14
  "async-retry": "^1.3.3",
@@ -203,6 +203,7 @@ document.addEventListener("DOMContentLoaded", async () => {
203
203
  rows: this.term.rows,
204
204
  }
205
205
  }, async (packet) => {
206
+ console.log({ packet })
206
207
  if (packet.type === 'start') {
207
208
  refreshParent(packet)
208
209
  reloadMemory()
@@ -235,6 +236,7 @@ document.addEventListener("DOMContentLoaded", async () => {
235
236
  }
236
237
  } else if (packet.type === "stream") {
237
238
  if (packet.data.raw) {
239
+ console.log("write", packet.data.raw)
238
240
  this.write(packet.data.raw)
239
241
  } else if (packet.data.json) {
240
242
  this.write(JSON.stringify(packet.data.json).replace(/\n/g, "\r\n"))
File without changes