pinokiod 1.1.36 → 1.1.38
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 +9 -4
- package/package.json +1 -1
- package/server/index.js +44 -8
- package/server/public/style.css +3 -0
- package/server/views/settings.ejs +59 -38
package/kernel/index.js
CHANGED
|
@@ -262,10 +262,15 @@ class Kernel {
|
|
|
262
262
|
clearInterval(this.sysinfo_interval)
|
|
263
263
|
}
|
|
264
264
|
this.sysinfo_interval = setInterval(async () => {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
try {
|
|
266
|
+
await sysinfo.refresh()
|
|
267
|
+
let info = sysinfo.info
|
|
268
|
+
console.log("sysinfo", info)
|
|
269
|
+
this.template.update(info)
|
|
270
|
+
this.sysinfo = info
|
|
271
|
+
} catch (e) {
|
|
272
|
+
console.log("sysinfo error", e)
|
|
273
|
+
}
|
|
269
274
|
}, 10000) // update every 10 seconds
|
|
270
275
|
|
|
271
276
|
// await this.template.init()
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -83,6 +83,12 @@ class Server {
|
|
|
83
83
|
console.log("Windows buildNumber", buildNumber)
|
|
84
84
|
throw new Error(`Pinokio supports Windows release 18309 and up (current system: ${buildNumber}`)
|
|
85
85
|
}
|
|
86
|
+
|
|
87
|
+
if (buildNumber > 25000) {
|
|
88
|
+
console.log("Windows buildNumber", buildNumber)
|
|
89
|
+
throw new Error(`Pinokio does not currently support Windows Canary (versions 25000 and up). The current system is ${buildNumber}`)
|
|
90
|
+
|
|
91
|
+
}
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
getMemory(filepath) {
|
|
@@ -358,6 +364,14 @@ class Server {
|
|
|
358
364
|
}]
|
|
359
365
|
console.log("agent", this.agent)
|
|
360
366
|
console.log({ configArray })
|
|
367
|
+
let folders = {}
|
|
368
|
+
if (this.kernel.homedir) {
|
|
369
|
+
folders = {
|
|
370
|
+
bin: path.resolve(this.kernel.homedir, "bin"),
|
|
371
|
+
cache: path.resolve(this.kernel.homedir, "cache"),
|
|
372
|
+
drive: path.resolve(this.kernel.homedir, "drive"),
|
|
373
|
+
}
|
|
374
|
+
}
|
|
361
375
|
res.render("settings", {
|
|
362
376
|
version: this.version,
|
|
363
377
|
logo: this.logo,
|
|
@@ -365,7 +379,8 @@ class Server {
|
|
|
365
379
|
agent: this.agent,
|
|
366
380
|
paths,
|
|
367
381
|
config: configArray,
|
|
368
|
-
query: req.query
|
|
382
|
+
query: req.query,
|
|
383
|
+
...folders
|
|
369
384
|
})
|
|
370
385
|
} else if (stat.isFile()) {
|
|
371
386
|
console.log("isfile")
|
|
@@ -1581,12 +1596,16 @@ class Server {
|
|
|
1581
1596
|
console.error((err && err.stack) ? err.stack : err);
|
|
1582
1597
|
});
|
|
1583
1598
|
this.logInterval = setInterval(async () => {
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1599
|
+
try {
|
|
1600
|
+
let file = path.resolve(this.kernel.homedir, "logs/stdout.txt")
|
|
1601
|
+
let data = await fs.promises.readFile(file, 'utf8')
|
|
1602
|
+
let lines = data.split('\n')
|
|
1603
|
+
if (lines.length > 100000) {
|
|
1604
|
+
let str = lines.slice(-100000).join("\n")
|
|
1605
|
+
await fs.promises.writeFile(file, str)
|
|
1606
|
+
}
|
|
1607
|
+
} catch (e) {
|
|
1608
|
+
console.log("Log Error", e)
|
|
1590
1609
|
}
|
|
1591
1610
|
}, 1000 * 60 * 10) // 10 minutes
|
|
1592
1611
|
}
|
|
@@ -1602,6 +1621,13 @@ class Server {
|
|
|
1602
1621
|
console.log("start called", this.listening, debug)
|
|
1603
1622
|
|
|
1604
1623
|
if (this.listening) {
|
|
1624
|
+
// stop proxies
|
|
1625
|
+
for(let scriptPath in this.kernel.api.proxies) {
|
|
1626
|
+
console.log("# Stop proxy", scriptPath)
|
|
1627
|
+
await this.kernel.api.stopProxy({
|
|
1628
|
+
script: scriptPath
|
|
1629
|
+
})
|
|
1630
|
+
}
|
|
1605
1631
|
console.log("close server")
|
|
1606
1632
|
console.log("terminate start")
|
|
1607
1633
|
await this.httpTerminator.terminate();
|
|
@@ -1681,6 +1707,15 @@ class Server {
|
|
|
1681
1707
|
options: ["light", "dark"]
|
|
1682
1708
|
}]
|
|
1683
1709
|
console.log("agent", this.agent)
|
|
1710
|
+
|
|
1711
|
+
let folders = {}
|
|
1712
|
+
if (this.kernel.homedir) {
|
|
1713
|
+
folders = {
|
|
1714
|
+
bin: path.resolve(this.kernel.homedir, "bin"),
|
|
1715
|
+
cache: path.resolve(this.kernel.homedir, "cache"),
|
|
1716
|
+
drive: path.resolve(this.kernel.homedir, "drive"),
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1684
1719
|
res.render("settings", {
|
|
1685
1720
|
version: this.version,
|
|
1686
1721
|
logo: this.logo,
|
|
@@ -1688,7 +1723,8 @@ class Server {
|
|
|
1688
1723
|
agent: this.agent,
|
|
1689
1724
|
paths: [],
|
|
1690
1725
|
config: configArray,
|
|
1691
|
-
query: req.query
|
|
1726
|
+
query: req.query,
|
|
1727
|
+
...folders
|
|
1692
1728
|
})
|
|
1693
1729
|
|
|
1694
1730
|
return
|
package/server/public/style.css
CHANGED
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
padding: 20px 0;
|
|
67
67
|
}
|
|
68
68
|
.titleview h1 {
|
|
69
|
+
font-family: verdana;
|
|
69
70
|
font-size: 40px;
|
|
70
71
|
text-transform: uppercase;
|
|
71
72
|
letter-spacing: 0;
|
|
@@ -77,6 +78,7 @@
|
|
|
77
78
|
padding: 10px 20px;
|
|
78
79
|
}
|
|
79
80
|
.item label {
|
|
81
|
+
font-family: verdana;
|
|
80
82
|
display: block;
|
|
81
83
|
text-transform: capitalize;
|
|
82
84
|
font-size: 20px;
|
|
@@ -276,20 +278,33 @@ hr {
|
|
|
276
278
|
<br>
|
|
277
279
|
<br>
|
|
278
280
|
<div class='item'>
|
|
279
|
-
<label>
|
|
281
|
+
<label><i class="fa-solid fa-folder-open"></i> bin</label>
|
|
280
282
|
<div class='d'>Reset the bin folder and start fresh from scratch</div>
|
|
281
283
|
<div class='reset-bin-loading hidden'>
|
|
282
284
|
<i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
|
|
283
285
|
</div>
|
|
284
|
-
<div
|
|
286
|
+
<div>
|
|
287
|
+
<button class='btn' data-filepath="<%=bin%>"><i class="fa-solid fa-up-right-from-square"></i> View Folder</button>
|
|
288
|
+
<button class='red btn' id='del-bin'><i class="fa-solid fa-trash-can"></i> Reset</button>
|
|
289
|
+
</div>
|
|
285
290
|
</div>
|
|
286
291
|
<div class='item'>
|
|
287
|
-
<label>
|
|
292
|
+
<label><i class="fa-solid fa-folder-open"></i> cache</label>
|
|
288
293
|
<div class='d'>Reset the cache folder and start fresh from scratch</div>
|
|
289
294
|
<div class='reset-cache-loading hidden'>
|
|
290
295
|
<i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
|
|
291
296
|
</div>
|
|
292
|
-
<div
|
|
297
|
+
<div>
|
|
298
|
+
<button class='btn' data-filepath="<%=cache%>"><i class="fa-solid fa-up-right-from-square"></i> View Folder</button>
|
|
299
|
+
<button class='red btn' id='del-cache'><i class="fa-solid fa-trash-can"></i> Reset</button>
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
<div class='item'>
|
|
303
|
+
<label><i class="fa-solid fa-folder-open"></i> drive</label>
|
|
304
|
+
<div class='d'>Shared virtual drives</div>
|
|
305
|
+
<div>
|
|
306
|
+
<button class='btn' data-filepath="<%=drive%>"><i class="fa-solid fa-up-right-from-square"></i> View Folder</button>
|
|
307
|
+
</div>
|
|
293
308
|
</div>
|
|
294
309
|
</div>
|
|
295
310
|
<hr/>
|
|
@@ -302,44 +317,50 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
302
317
|
const n = new N()
|
|
303
318
|
document.querySelector("#del-bin").addEventListener("click", async (e) => {
|
|
304
319
|
console.log("del-bin")
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
let proceeed = confirm("Are you sure you wish to delete the bin folder?")
|
|
321
|
+
if (proceed) {
|
|
322
|
+
document.querySelector(".reset-bin-loading").classList.remove("hidden")
|
|
323
|
+
document.querySelector("#del-bin").classList.add("hidden")
|
|
324
|
+
let res = await fetch("/pinokio/delete", {
|
|
325
|
+
method: "post",
|
|
326
|
+
headers: {
|
|
327
|
+
"Content-Type": "application/json"
|
|
328
|
+
},
|
|
329
|
+
body: JSON.stringify({ type: "bin" })
|
|
330
|
+
}).then((res) => {
|
|
331
|
+
return res.json()
|
|
332
|
+
})
|
|
333
|
+
console.log(res)
|
|
334
|
+
document.querySelector(".reset-bin-loading").classList.add("hidden")
|
|
335
|
+
if (res.error) {
|
|
336
|
+
alert(res.error)
|
|
337
|
+
} else {
|
|
338
|
+
location.href = location.href
|
|
339
|
+
}
|
|
322
340
|
}
|
|
323
341
|
})
|
|
324
342
|
document.querySelector("#del-cache").addEventListener("click", async (e) => {
|
|
325
343
|
console.log("del-cache")
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
344
|
+
let proceeed = confirm("Are you sure you wish to delete the cache folder?")
|
|
345
|
+
if (proceed) {
|
|
346
|
+
document.querySelector(".reset-cache-loading").classList.remove("hidden")
|
|
347
|
+
document.querySelector("#del-cache").classList.add("hidden")
|
|
348
|
+
let res = await fetch("/pinokio/delete", {
|
|
349
|
+
method: "post",
|
|
350
|
+
headers: {
|
|
351
|
+
"Content-Type": "application/json"
|
|
352
|
+
},
|
|
353
|
+
body: JSON.stringify({ type: "cache" })
|
|
354
|
+
}).then((res) => {
|
|
355
|
+
return res.json()
|
|
356
|
+
})
|
|
357
|
+
console.log(res)
|
|
358
|
+
document.querySelector(".reset-cache-loading").classList.add("hidden")
|
|
359
|
+
if (res.error) {
|
|
360
|
+
alert(res.error)
|
|
361
|
+
} else {
|
|
362
|
+
location.href = location.href
|
|
363
|
+
}
|
|
343
364
|
}
|
|
344
365
|
})
|
|
345
366
|
document.querySelector("form").addEventListener("submit", async (e) => {
|