pinokiod 1.1.35 → 1.1.37
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 +29 -6
- package/server/public/simplemodal.js +6 -4
- 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) {
|
|
@@ -359,6 +365,9 @@ class Server {
|
|
|
359
365
|
console.log("agent", this.agent)
|
|
360
366
|
console.log({ configArray })
|
|
361
367
|
res.render("settings", {
|
|
368
|
+
bin: path.resolve(this.kernel.homedir, "bin"),
|
|
369
|
+
cache: path.resolve(this.kernel.homedir, "cache"),
|
|
370
|
+
drive: path.resolve(this.kernel.homedir, "drive"),
|
|
362
371
|
version: this.version,
|
|
363
372
|
logo: this.logo,
|
|
364
373
|
theme: this.theme,
|
|
@@ -1581,12 +1590,16 @@ class Server {
|
|
|
1581
1590
|
console.error((err && err.stack) ? err.stack : err);
|
|
1582
1591
|
});
|
|
1583
1592
|
this.logInterval = setInterval(async () => {
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1593
|
+
try {
|
|
1594
|
+
let file = path.resolve(this.kernel.homedir, "logs/stdout.txt")
|
|
1595
|
+
let data = await fs.promises.readFile(file, 'utf8')
|
|
1596
|
+
let lines = data.split('\n')
|
|
1597
|
+
if (lines.length > 100000) {
|
|
1598
|
+
let str = lines.slice(-100000).join("\n")
|
|
1599
|
+
await fs.promises.writeFile(file, str)
|
|
1600
|
+
}
|
|
1601
|
+
} catch (e) {
|
|
1602
|
+
console.log("Log Error", e)
|
|
1590
1603
|
}
|
|
1591
1604
|
}, 1000 * 60 * 10) // 10 minutes
|
|
1592
1605
|
}
|
|
@@ -1602,6 +1615,13 @@ class Server {
|
|
|
1602
1615
|
console.log("start called", this.listening, debug)
|
|
1603
1616
|
|
|
1604
1617
|
if (this.listening) {
|
|
1618
|
+
// stop proxies
|
|
1619
|
+
for(let scriptPath in this.kernel.api.proxies) {
|
|
1620
|
+
console.log("# Stop proxy", scriptPath)
|
|
1621
|
+
await this.kernel.api.stopProxy({
|
|
1622
|
+
script: scriptPath
|
|
1623
|
+
})
|
|
1624
|
+
}
|
|
1605
1625
|
console.log("close server")
|
|
1606
1626
|
console.log("terminate start")
|
|
1607
1627
|
await this.httpTerminator.terminate();
|
|
@@ -1682,6 +1702,9 @@ class Server {
|
|
|
1682
1702
|
}]
|
|
1683
1703
|
console.log("agent", this.agent)
|
|
1684
1704
|
res.render("settings", {
|
|
1705
|
+
bin: path.resolve(this.kernel.homedir, "bin"),
|
|
1706
|
+
cache: path.resolve(this.kernel.homedir, "cache"),
|
|
1707
|
+
drive: path.resolve(this.kernel.homedir, "drive"),
|
|
1685
1708
|
version: this.version,
|
|
1686
1709
|
logo: this.logo,
|
|
1687
1710
|
theme: this.theme,
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
const SimpleModal = async (params) => {
|
|
2
|
-
let
|
|
2
|
+
let menu = (params.menu ? params.menu : [])
|
|
3
|
+
let btns = menu.map((item) => {
|
|
3
4
|
if (item.href) {
|
|
4
|
-
|
|
5
|
+
let icon = (item.icon ? `<i class="${item.icon}"></i> ` : "")
|
|
6
|
+
return `<a class='btn' href='${item.href}' target='_blank'>${icon}${item.text}</a>`
|
|
5
7
|
} else if (item.action) {
|
|
6
8
|
return `<a class='btn' target='_blank'>${item.text}</a>`
|
|
7
9
|
}
|
|
8
10
|
}).join("")
|
|
9
11
|
await Swal.fire({
|
|
10
|
-
title: params.title,
|
|
12
|
+
title: params.title || " ",
|
|
11
13
|
confirmButtonText: 'Next',
|
|
12
14
|
html: `<div class='simple-modal-desc'>
|
|
13
|
-
${params.description}
|
|
15
|
+
${params.description || ""}
|
|
14
16
|
</div>
|
|
15
17
|
<div class='simple-modal-content'>${btns}</div>`,
|
|
16
18
|
// showConfirmButton: false,
|
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) => {
|