pinokiod 0.1.54 → 0.1.56

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.
@@ -1,6 +1,7 @@
1
1
  const path = require('path')
2
2
  //const decompress = require('decompress');
3
3
  const fs = require("fs")
4
+ const fse = require('fs-extra')
4
5
  const Pdrive = require('pdrive')
5
6
  const { DownloaderHelper } = require('node-downloader-helper');
6
7
  const symlinkDir = require('symlink-dir')
@@ -39,11 +40,11 @@ class FS {
39
40
  async share(req, ondata, kernel) {
40
41
  /////////////////////////////////////////////////////////////////////////////
41
42
  //
42
- // 1. 1:1 Interface mapping (1 interface, 1 file path)
43
+ // 1. 1:1 Drive mapping (1 file path per 1 drive folder)
43
44
  // {
44
45
  // “method”: “fs.share”,
45
46
  // “params”: {
46
- // "interface": {
47
+ // "drive": {
47
48
  // “models/checkpoints": "app/models/checkpoints",
48
49
  // “models/vae": "app/models/VAE",
49
50
  // },
@@ -52,11 +53,11 @@ class FS {
52
53
  // }
53
54
  //
54
55
  //
55
- // 2. 1:N Interface mapping (1 interface, N file paths)
56
+ // 2. 1:N Drive mapping (N file paths per 1 drive folder)
56
57
  // {
57
58
  // “method”: “fs.share”,
58
59
  // “params”: {
59
- // "interface": {
60
+ // "drive": {
60
61
  // “models/checkpoints": "app/models/checkpoints",
61
62
  // “models/loras": [ "app/models/Lora", "app/models/LyCORIS" ],
62
63
  // },
@@ -67,11 +68,11 @@ class FS {
67
68
  /////////////////////////////////////////////////////////////////////////////
68
69
 
69
70
 
70
- if (req.params.interface) {
71
+ if (req.params.drive) {
71
72
  const drivePath = kernel.path("drive")
72
73
  const drive = new Pdrive(drivePath)
73
- for(const route in req.params.interface) {
74
- const link = req.params.interface[route]
74
+ for(const route in req.params.drive) {
75
+ const link = req.params.drive[route]
75
76
  // Link path validation
76
77
  if (Array.isArray(link)) {
77
78
  let toContinue = false;
@@ -87,7 +88,7 @@ class FS {
87
88
  continue
88
89
  }
89
90
  }
90
- // Interface path validation
91
+ // Drive path validation
91
92
  if (path.isAbsolute(route) || route.startsWith(".")) {
92
93
  toContinue = true
93
94
  break
@@ -102,23 +103,24 @@ class FS {
102
103
  linkPath = path.resolve(req.cwd, link)
103
104
  }
104
105
 
105
- req.params.interface[route] = linkPath
106
+ req.params.drive[route] = linkPath
106
107
  }
107
108
  await drive.create({
108
109
  uri: req.parent.git,
109
- interface: req.params.interface,
110
+ drive: req.params.drive,
110
111
  peers: (req.params.peers ? req.params.peers : [])
111
112
  })
112
113
  ondata({ raw: `\r\nDone!` })
113
114
  } else {
114
- ondata({ raw: `\r\nMust pass an 'interface' mapping` })
115
+ ondata({ raw: `\r\nMust pass an 'drive' mapping` })
115
116
  }
116
117
 
117
118
  }
118
119
  async rm(req, ondata, kernel) {
119
120
  let cwd = (req.cwd ? req.cwd : kernel.api.userdir)
120
121
  let filepath = path.resolve(cwd, req.params.path)
121
- await fs.promises.rm(filepath)
122
+ // await fs.promises.rm(filepath)
123
+ await fse.remove(filepath)
122
124
  }
123
125
  async copy(req, ondata, kernel) {
124
126
  let cwd = (req.cwd ? req.cwd : kernel.api.userdir)
@@ -0,0 +1,15 @@
1
+ /*
2
+ {
3
+ method: "tab.open",
4
+ params: {
5
+ target:
6
+ url
7
+ }
8
+ }
9
+ (*/
10
+ class Tab {
11
+ async open(req, ondata, kernel) {
12
+ ondata(req.params, "tab.open")
13
+ }
14
+ }
15
+ module.exports = Tab
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "0.1.54",
3
+ "version": "0.1.56",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -40,7 +40,7 @@
40
40
  "multer": "^1.4.5-lts.1",
41
41
  "node-downloader-helper": "^2.1.9",
42
42
  "node-pty-prebuilt-multiarch-cp": "^0.10.1-pre.48",
43
- "pdrive": "^0.0.9",
43
+ "pdrive": "^0.0.10",
44
44
  "portfinder": "^1.0.32",
45
45
  "rimraf": "^5.0.0",
46
46
  "sanitize-filename": "^1.6.3",
@@ -703,6 +703,7 @@ window.addEventListener('message', (event) => {
703
703
  addTab(event.data.action.url)
704
704
  }
705
705
  } else {
706
+ console.log("data", event.data)
706
707
  refresh()
707
708
  }
708
709
  });
@@ -333,6 +333,8 @@ document.addEventListener("DOMContentLoaded", async () => {
333
333
  }]
334
334
  }
335
335
  */
336
+ } else if (packet.type === "tab.open") {
337
+ refreshParent(packet)
336
338
  } else if (packet.type === "browser.open") {
337
339
  /*
338
340
  {
@@ -312,6 +312,8 @@ document.addEventListener("DOMContentLoaded", async () => {
312
312
  }]
313
313
  }
314
314
  */
315
+ } else if (packet.type === "tab.open") {
316
+ refreshParent(packet)
315
317
  } else if (packet.type === "browser.open") {
316
318
  /*
317
319
  {