pinokiod 0.1.47 → 0.1.48

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.
@@ -39,38 +39,81 @@ class FS {
39
39
  async share(req, ondata, kernel) {
40
40
  /////////////////////////////////////////////////////////////////////////////
41
41
  //
42
+ // 1. 1:1 Interface mapping (1 interface, 1 file path)
42
43
  // {
43
44
  // “method”: “fs.share”,
44
45
  // “params”: {
45
- // "fs": "app/models/checkpoints",
46
- // “drive": “models/checkpoints",
46
+ // "interface": {
47
+ // “models/checkpoints": "app/models/checkpoints",
48
+ // “models/vae": "app/models/VAE",
49
+ // },
50
+ // “peers”: [ “https://github.com/cocktailpeanut/comfyui.git" ]
51
+ // }
52
+ // }
53
+ //
54
+ //
55
+ // 2. 1:N Interface mapping (1 interface, N file paths)
56
+ // {
57
+ // “method”: “fs.share”,
58
+ // “params”: {
59
+ // "interface": {
60
+ // “models/checkpoints": "app/models/checkpoints",
61
+ // “models/loras": [ "app/models/Lora", "app/models/LyCORIS" ],
62
+ // },
47
63
  // “peers”: [ “https://github.com/cocktailpeanut/comfyui.git" ]
48
64
  // }
49
65
  // }
50
66
  //
51
67
  /////////////////////////////////////////////////////////////////////////////
52
68
 
53
- console.log("fs.share", req)
54
-
55
69
 
56
- if (path.isAbsolute(req.params.fs) || req.params.fs.startsWith(".")) {
57
- return
58
- }
59
- if (path.isAbsolute(req.params.drive) || req.params.drive.startsWith(".")) {
60
- return
61
- }
70
+ if (req.params.interface) {
71
+ const drivePath = kernel.path("drive")
72
+ const drive = new Pdrive(drivePath)
73
+ for(const route in req.params.interface) {
74
+ const link = req.params.interface[route]
75
+ // Link path validation
76
+ if (Array.isArray(link)) {
77
+ let toContinue = false;
78
+ for(let ln of link) {
79
+ if (path.isAbsolute(ln) || ln.startsWith(".")) {
80
+ toContinue = true
81
+ break
82
+ }
83
+ }
84
+ if (toContinue) continue
85
+ } else {
86
+ if (path.isAbsolute(link) || link.startsWith(".")) {
87
+ continue
88
+ }
89
+ }
90
+ // Interface path validation
91
+ if (path.isAbsolute(route) || route.startsWith(".")) {
92
+ toContinue = true
93
+ break
94
+ }
62
95
 
63
- const drivePath = kernel.path("drive")
64
- const drive = new Pdrive(drivePath)
65
- const fsPath = path.resolve(req.cwd, req.params.fs)
96
+ let linkPath
97
+ if (Array.isArray(link)) {
98
+ linkPath = link.map((ln) => {
99
+ return path.resolve(req.cwd, ln)
100
+ })
101
+ } else {
102
+ linkPath = path.resolve(req.cwd, link)
103
+ }
104
+
105
+ req.params.interface[route] = linkPath
106
+ }
107
+ await drive.create({
108
+ uri: req.parent.git,
109
+ interface: req.params.interface,
110
+ peers: (req.params.peers ? req.params.peers : [])
111
+ })
112
+ ondata({ raw: `\r\nDone!` })
113
+ } else {
114
+ ondata({ raw: `\r\nMust pass an 'interface' mapping` })
115
+ }
66
116
 
67
- ondata({ raw: `\r\nLinking ${fsPath} to ${drivePath}...\r\n` })
68
- await drive.create(fsPath, {
69
- uri: req.parent.git,
70
- path: req.params.drive,
71
- peers: (req.params.peers ? req.params.peers : [])
72
- })
73
- ondata({ raw: `\r\nDone!` })
74
117
  }
75
118
  async rm(req, ondata, kernel) {
76
119
  let cwd = (req.cwd ? req.cwd : kernel.api.userdir)
@@ -239,7 +282,7 @@ class FS {
239
282
  })
240
283
  dl.on('error', (err) => {
241
284
  console.log('Download Failed', err)
242
- ondata({ raw: `\r\nDownload Failed: ${err.message}!\r\n` })
285
+ ondata({ raw: `\r\n[Download Failed] ${err.message}!\r\n` })
243
286
  reject(err)
244
287
  })
245
288
  dl.on('progress', (stats) => {
@@ -254,18 +297,18 @@ class FS {
254
297
  ondata({ raw: `\r${str}` })
255
298
  })
256
299
  dl.on('download', (downloadInfo) => {
257
- const msg = `\r\nDownload Begins: ${JSON.stringify({ name: downloadInfo.fileName, total: downloadInfo.totalSize })}\r\n`
300
+ const msg = `\r\n[Download Started] ${JSON.stringify({ name: downloadInfo.fileName, total: downloadInfo.totalSize })}\r\n`
258
301
  console.log(msg)
259
302
  ondata({ raw: msg })
260
303
  })
261
304
  dl.on('skip', (skipInfo) => {
262
- const msg = `\r\nDownload skipped, file already exists: ${JSON.stringify(skipInfo)}\r\n`
305
+ const msg = `\r\n[Download Skipped] File already exists: ${JSON.stringify(skipInfo)}\r\n`
263
306
  console.log(msg)
264
307
  ondata({ raw: msg })
265
308
  resolve()
266
309
  })
267
310
  dl.on('retry', (attempt, opts, err) => {
268
- const msg = "\r\nRetrying... " + JSON.stringify({
311
+ const msg = "\r\n[Retrying] " + JSON.stringify({
269
312
  RetryAttempt: `${attempt}/${opts.maxRetries}`,
270
313
  StartsOn: `${opts.delay / 1000} secs`,
271
314
  Reason: err ? err.message : 'unknown'
@@ -274,19 +317,19 @@ class FS {
274
317
  ondata({ raw: msg })
275
318
  })
276
319
  dl.on('stateChanged', (state) => {
277
- const msg = "\r\nstate changed: " + state + "\r\n"
320
+ const msg = "\r\n[State changed] " + state + "\r\n"
278
321
  console.log(msg)
279
322
  ondata({ raw: msg })
280
323
  })
281
324
  dl.on('redirected', (newUrl, oldUrl) => {
282
- const msg = `\r\nRedirect from '${newUrl}' => '${oldUrl}'\r\n`
325
+ const msg = `\r\n[Redirected] '${oldUrl}' => '${newUrl}'\r\n`
283
326
  console.log(msg)
284
327
  ondata({ raw: msg })
285
328
  })
286
329
 
287
330
  dl.start().catch((err) => {
288
331
  console.log('Download Failed', err)
289
- ondata({ raw: `\r\nDownload Failed: ${err.message}!\r\n` })
332
+ ondata({ raw: `\r\n[Download Failed] ${err.message}!\r\n` })
290
333
  reject(err)
291
334
  })
292
335
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
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.1",
43
+ "pdrive": "^0.0.8",
44
44
  "portfinder": "^1.0.32",
45
45
  "rimraf": "^5.0.0",
46
46
  "sanitize-filename": "^1.6.3",
@@ -48,7 +48,9 @@ body.dark aside {
48
48
  aside {
49
49
  display: flex;
50
50
  flex-direction: column;
51
+ /*
51
52
  width: 200px;
53
+ */
52
54
  overflow: auto;
53
55
  box-sizing: border-box;
54
56
  }
@@ -149,7 +151,7 @@ body.dark #new-window {
149
151
  text-align: center;;
150
152
  font-weight: bold;
151
153
  align-items: center;
152
- padding: 10px 5px;
154
+ padding: 20px 0px;
153
155
  }
154
156
  .app-info > * {
155
157
  padding: 5px;
@@ -210,7 +212,10 @@ body.dark .frame-link.selected {
210
212
  }
211
213
  .frame-link .tab {
212
214
  flex-grow: 1;
215
+ /*
213
216
  width: 100%;
217
+ */
218
+ margin-right: 5px;
214
219
  }
215
220
  .frame-link .tab .flexible {
216
221
  min-width: 5px;
@@ -13,7 +13,9 @@
13
13
  <a data-index="<%=index%>" target="<%=item.src%>" href="<%=item.href%>" class='btn header-item frame-link'>
14
14
  <div class='tab'><%-item.btn%></div>
15
15
  <% if (item.running) { %>
16
+ <div class='loader'>
16
17
  <i class='fa-solid fa-spin fa-circle-notch'></i>
18
+ </div>
17
19
  <% } %>
18
20
  </a>
19
21
  <% } %>