pinokiod 3.17.3 → 3.17.5
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/package.json +1 -1
- package/server/index.js +33 -5
- package/server/views/settings.ejs +39 -19
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -719,6 +719,10 @@ class Server {
|
|
|
719
719
|
key: "theme",
|
|
720
720
|
val: this.theme,
|
|
721
721
|
options: ["light", "dark"]
|
|
722
|
+
}, {
|
|
723
|
+
key: "mode",
|
|
724
|
+
val: this.mode,
|
|
725
|
+
options: ["full", "minimal"]
|
|
722
726
|
}, {
|
|
723
727
|
key: "HTTP_PROXY",
|
|
724
728
|
val: (system_env.HTTP_PROXY || ""),
|
|
@@ -1570,7 +1574,7 @@ class Server {
|
|
|
1570
1574
|
if (config.hasOwnProperty("icon")) {
|
|
1571
1575
|
config.html = `<i class="${config.icon}"></i> ${config.text}`
|
|
1572
1576
|
} else if (config.hasOwnProperty("image")) {
|
|
1573
|
-
let imagePath = `${base.
|
|
1577
|
+
let imagePath = `${base.web_path}/${config.image}`
|
|
1574
1578
|
config.html = `<img class='menu-item-image' src='${imagePath}' /> ${config.text}`
|
|
1575
1579
|
} else {
|
|
1576
1580
|
config.html = `${config.text}`
|
|
@@ -1587,7 +1591,8 @@ class Server {
|
|
|
1587
1591
|
*/
|
|
1588
1592
|
if (keypath) {
|
|
1589
1593
|
config.href = base.href + "/" + keypath.join("/") + "?path=" + base.cwd
|
|
1590
|
-
config.script_id = this.kernel.path(keypath) + "?cwd=" + base.cwd
|
|
1594
|
+
//config.script_id = this.kernel.path(keypath) + "?cwd=" + base.cwd
|
|
1595
|
+
config.script_id = path.resolve(base.path, config.href) + "?cwd=" + base.cwd
|
|
1591
1596
|
}
|
|
1592
1597
|
return config
|
|
1593
1598
|
}
|
|
@@ -2116,6 +2121,7 @@ class Server {
|
|
|
2116
2121
|
|
|
2117
2122
|
// 1. THEME
|
|
2118
2123
|
this.theme = this.kernel.store.get("theme") || "light"
|
|
2124
|
+
this.mode = this.kernel.store.get("mode") || "app"
|
|
2119
2125
|
if (this.theme === "dark") {
|
|
2120
2126
|
this.colors = {
|
|
2121
2127
|
color: "rgb(27, 28, 29)",
|
|
@@ -2212,6 +2218,7 @@ class Server {
|
|
|
2212
2218
|
async setConfig(config) {
|
|
2213
2219
|
let home = this.kernel.store.get("home")
|
|
2214
2220
|
let theme = this.kernel.store.get("theme")
|
|
2221
|
+
let mode = this.kernel.store.get("mode")
|
|
2215
2222
|
// let drive = this.kernel.store.get("drive")
|
|
2216
2223
|
|
|
2217
2224
|
// 1. Handle THEME
|
|
@@ -2243,6 +2250,14 @@ class Server {
|
|
|
2243
2250
|
}
|
|
2244
2251
|
|
|
2245
2252
|
}
|
|
2253
|
+
|
|
2254
|
+
let mode_changed = false
|
|
2255
|
+
if (config.mode) {
|
|
2256
|
+
if (config.mode !== mode) {
|
|
2257
|
+
mode_changed = true
|
|
2258
|
+
}
|
|
2259
|
+
this.kernel.store.set("mode", config.mode)
|
|
2260
|
+
}
|
|
2246
2261
|
// // 3. Handle Drive
|
|
2247
2262
|
// if (config.drive) {
|
|
2248
2263
|
// // if the home is different from the existing home, go forward
|
|
@@ -2293,6 +2308,13 @@ class Server {
|
|
|
2293
2308
|
this.kernel.store.set("HTTP_PROXY", config.HTTP_PROXY)
|
|
2294
2309
|
this.kernel.store.set("HTTPS_PROXY", config.HTTPS_PROXY)
|
|
2295
2310
|
this.kernel.store.set("NO_PROXY", config.NO_PROXY)
|
|
2311
|
+
|
|
2312
|
+
if (mode_changed) {
|
|
2313
|
+
return {
|
|
2314
|
+
title: "Restart Required",
|
|
2315
|
+
text: "Please restart the app"
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2296
2318
|
}
|
|
2297
2319
|
async startLogging(homedir) {
|
|
2298
2320
|
if (!this.debug) {
|
|
@@ -2671,6 +2693,10 @@ class Server {
|
|
|
2671
2693
|
key: "theme",
|
|
2672
2694
|
val: this.theme,
|
|
2673
2695
|
options: ["light", "dark"]
|
|
2696
|
+
}, {
|
|
2697
|
+
key: "mode",
|
|
2698
|
+
val: this.mode,
|
|
2699
|
+
options: ["full", "minimal"]
|
|
2674
2700
|
}, {
|
|
2675
2701
|
key: "HTTP_PROXY",
|
|
2676
2702
|
val: (system_env.HTTP_PROXY || ""),
|
|
@@ -3788,10 +3814,12 @@ class Server {
|
|
|
3788
3814
|
}
|
|
3789
3815
|
|
|
3790
3816
|
let config = structuredClone(this.kernel.proto.config)
|
|
3817
|
+
console.log(">>>>>>>> config", config)
|
|
3791
3818
|
config = this.renderMenu2(config, {
|
|
3792
3819
|
cwd: req.query.path,
|
|
3793
3820
|
href: "/prototype/show",
|
|
3794
|
-
path: "
|
|
3821
|
+
path: this.kernel.path("prototype/system"),
|
|
3822
|
+
web_path: "/asset/prototype/system"
|
|
3795
3823
|
})
|
|
3796
3824
|
|
|
3797
3825
|
// {
|
|
@@ -4899,8 +4927,8 @@ class Server {
|
|
|
4899
4927
|
|
|
4900
4928
|
this.app.post("/config", ex(async (req, res) => {
|
|
4901
4929
|
try {
|
|
4902
|
-
await this.setConfig(req.body)
|
|
4903
|
-
res.json({ success: true })
|
|
4930
|
+
let message = await this.setConfig(req.body)
|
|
4931
|
+
res.json({ success: true, message })
|
|
4904
4932
|
} catch (e) {
|
|
4905
4933
|
res.json({ error: e.stack })
|
|
4906
4934
|
}
|
|
@@ -244,6 +244,12 @@ body.dark .keys pre {
|
|
|
244
244
|
margin: 20px 0;
|
|
245
245
|
background: rgba(0,0,100,0.04) !important;
|
|
246
246
|
}
|
|
247
|
+
.swal2-actions {
|
|
248
|
+
justify-content: center !important;
|
|
249
|
+
}
|
|
250
|
+
.swal2-title {
|
|
251
|
+
text-align: center !important;
|
|
252
|
+
}
|
|
247
253
|
</style>
|
|
248
254
|
<script src="/hotkeys.min.js"></script>
|
|
249
255
|
<script src="/sweetalert2.js"></script>
|
|
@@ -631,26 +637,40 @@ console.log("body", body)
|
|
|
631
637
|
return res.json()
|
|
632
638
|
})
|
|
633
639
|
if (r.success) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
if (res.success) {
|
|
645
|
-
document.querySelector(".loading").classList.add("hidden")
|
|
646
|
-
setTimeout(() => {
|
|
647
|
-
location.href = "/"
|
|
648
|
-
}, 1000)
|
|
640
|
+
if (r.message) {
|
|
641
|
+
Swal.fire({
|
|
642
|
+
title: r.message.title,
|
|
643
|
+
text: r.message.text,
|
|
644
|
+
allowOutsideClick: false,
|
|
645
|
+
allowEscapeKey: false,
|
|
646
|
+
allowEnterKey: false,
|
|
647
|
+
showConfirmButton: false,
|
|
648
|
+
didOpen: () => {
|
|
649
|
+
Swal.showLoading();
|
|
649
650
|
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
651
|
+
});
|
|
652
|
+
} else {
|
|
653
|
+
//alert("Successfully updated the pinokio home to " + val)
|
|
654
|
+
fetch("/restart", {
|
|
655
|
+
method: "post"
|
|
656
|
+
}, () => {
|
|
657
|
+
})
|
|
658
|
+
setInterval(async () => {
|
|
659
|
+
try {
|
|
660
|
+
let res = await fetch("/check").then((res) => {
|
|
661
|
+
return res.json()
|
|
662
|
+
})
|
|
663
|
+
if (res.success) {
|
|
664
|
+
document.querySelector(".loading").classList.add("hidden")
|
|
665
|
+
setTimeout(() => {
|
|
666
|
+
location.href = "/"
|
|
667
|
+
}, 1000)
|
|
668
|
+
}
|
|
669
|
+
} catch (e) {
|
|
670
|
+
console.log(e)
|
|
671
|
+
}
|
|
672
|
+
}, 1000)
|
|
673
|
+
}
|
|
654
674
|
} else if (r.error) {
|
|
655
675
|
alert(r.error)
|
|
656
676
|
location.href = location.href
|