pinokiod 3.17.3 → 3.17.4
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 +27 -2
- 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 || ""),
|
|
@@ -2116,6 +2120,7 @@ class Server {
|
|
|
2116
2120
|
|
|
2117
2121
|
// 1. THEME
|
|
2118
2122
|
this.theme = this.kernel.store.get("theme") || "light"
|
|
2123
|
+
this.mode = this.kernel.store.get("mode") || "app"
|
|
2119
2124
|
if (this.theme === "dark") {
|
|
2120
2125
|
this.colors = {
|
|
2121
2126
|
color: "rgb(27, 28, 29)",
|
|
@@ -2212,6 +2217,7 @@ class Server {
|
|
|
2212
2217
|
async setConfig(config) {
|
|
2213
2218
|
let home = this.kernel.store.get("home")
|
|
2214
2219
|
let theme = this.kernel.store.get("theme")
|
|
2220
|
+
let mode = this.kernel.store.get("mode")
|
|
2215
2221
|
// let drive = this.kernel.store.get("drive")
|
|
2216
2222
|
|
|
2217
2223
|
// 1. Handle THEME
|
|
@@ -2243,6 +2249,14 @@ class Server {
|
|
|
2243
2249
|
}
|
|
2244
2250
|
|
|
2245
2251
|
}
|
|
2252
|
+
|
|
2253
|
+
let mode_changed = false
|
|
2254
|
+
if (config.mode) {
|
|
2255
|
+
if (config.mode !== mode) {
|
|
2256
|
+
mode_changed = true
|
|
2257
|
+
}
|
|
2258
|
+
this.kernel.store.set("mode", config.mode)
|
|
2259
|
+
}
|
|
2246
2260
|
// // 3. Handle Drive
|
|
2247
2261
|
// if (config.drive) {
|
|
2248
2262
|
// // if the home is different from the existing home, go forward
|
|
@@ -2293,6 +2307,13 @@ class Server {
|
|
|
2293
2307
|
this.kernel.store.set("HTTP_PROXY", config.HTTP_PROXY)
|
|
2294
2308
|
this.kernel.store.set("HTTPS_PROXY", config.HTTPS_PROXY)
|
|
2295
2309
|
this.kernel.store.set("NO_PROXY", config.NO_PROXY)
|
|
2310
|
+
|
|
2311
|
+
if (mode_changed) {
|
|
2312
|
+
return {
|
|
2313
|
+
title: "Restart Required",
|
|
2314
|
+
text: "Please restart the app"
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2296
2317
|
}
|
|
2297
2318
|
async startLogging(homedir) {
|
|
2298
2319
|
if (!this.debug) {
|
|
@@ -2671,6 +2692,10 @@ class Server {
|
|
|
2671
2692
|
key: "theme",
|
|
2672
2693
|
val: this.theme,
|
|
2673
2694
|
options: ["light", "dark"]
|
|
2695
|
+
}, {
|
|
2696
|
+
key: "mode",
|
|
2697
|
+
val: this.mode,
|
|
2698
|
+
options: ["full", "minimal"]
|
|
2674
2699
|
}, {
|
|
2675
2700
|
key: "HTTP_PROXY",
|
|
2676
2701
|
val: (system_env.HTTP_PROXY || ""),
|
|
@@ -4899,8 +4924,8 @@ class Server {
|
|
|
4899
4924
|
|
|
4900
4925
|
this.app.post("/config", ex(async (req, res) => {
|
|
4901
4926
|
try {
|
|
4902
|
-
await this.setConfig(req.body)
|
|
4903
|
-
res.json({ success: true })
|
|
4927
|
+
let message = await this.setConfig(req.body)
|
|
4928
|
+
res.json({ success: true, message })
|
|
4904
4929
|
} catch (e) {
|
|
4905
4930
|
res.json({ error: e.stack })
|
|
4906
4931
|
}
|
|
@@ -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
|