pinokiod 3.240.0 → 3.242.0
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 +8 -0
- package/server/views/settings.ejs +33 -2
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -3650,6 +3650,7 @@ class Server {
|
|
|
3650
3650
|
this.browser = options.browser
|
|
3651
3651
|
this.onrestart = options.onrestart
|
|
3652
3652
|
this.onquit = options.onquit
|
|
3653
|
+
this.onrefresh = options.onrefresh
|
|
3653
3654
|
}
|
|
3654
3655
|
|
|
3655
3656
|
if (this.listening) {
|
|
@@ -3680,6 +3681,13 @@ class Server {
|
|
|
3680
3681
|
|
|
3681
3682
|
// configure from kernel.store
|
|
3682
3683
|
await this.syncConfig()
|
|
3684
|
+
if (this.onrefresh) {
|
|
3685
|
+
try {
|
|
3686
|
+
this.onrefresh({ theme: this.theme, colors: this.colors })
|
|
3687
|
+
} catch (err) {
|
|
3688
|
+
console.error('[Pinokiod] onrefresh error', err)
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3683
3691
|
|
|
3684
3692
|
try {
|
|
3685
3693
|
let _home = this.kernel.store.get("home") || process.env.PINOKIO_HOME
|
|
@@ -586,6 +586,36 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
586
586
|
document.addEventListener("DOMContentLoaded", async () => {
|
|
587
587
|
//Reporter()
|
|
588
588
|
const n = new N()
|
|
589
|
+
const updateThemeClassAcrossShells = (nextTheme) => {
|
|
590
|
+
if (!nextTheme) {
|
|
591
|
+
return
|
|
592
|
+
}
|
|
593
|
+
const applyTheme = (doc) => {
|
|
594
|
+
if (!doc || !doc.body) {
|
|
595
|
+
return
|
|
596
|
+
}
|
|
597
|
+
doc.body.classList.remove('dark', 'light')
|
|
598
|
+
doc.body.classList.add(nextTheme)
|
|
599
|
+
}
|
|
600
|
+
let ctx = window
|
|
601
|
+
const visited = new Set()
|
|
602
|
+
while (ctx && !visited.has(ctx)) {
|
|
603
|
+
visited.add(ctx)
|
|
604
|
+
try {
|
|
605
|
+
applyTheme(ctx.document)
|
|
606
|
+
} catch (err) {
|
|
607
|
+
break
|
|
608
|
+
}
|
|
609
|
+
try {
|
|
610
|
+
if (!ctx.parent || ctx.parent === ctx) {
|
|
611
|
+
break
|
|
612
|
+
}
|
|
613
|
+
ctx = ctx.parent
|
|
614
|
+
} catch (err) {
|
|
615
|
+
break
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
589
619
|
<% if (locals.bin) { %>
|
|
590
620
|
document.querySelector("#del-bin").addEventListener("click", async (e) => {
|
|
591
621
|
console.log("del-bin")
|
|
@@ -770,6 +800,7 @@ console.log("body", body)
|
|
|
770
800
|
return res.json()
|
|
771
801
|
})
|
|
772
802
|
if (r.success) {
|
|
803
|
+
updateThemeClassAcrossShells(body.theme)
|
|
773
804
|
if (r.message) {
|
|
774
805
|
Swal.fire({
|
|
775
806
|
title: r.message.title,
|
|
@@ -799,7 +830,7 @@ console.log("body", body)
|
|
|
799
830
|
if (res.success) {
|
|
800
831
|
document.querySelector(".loading").classList.add("hidden")
|
|
801
832
|
setTimeout(() => {
|
|
802
|
-
location.href = "/"
|
|
833
|
+
location.href = "/home"
|
|
803
834
|
}, 1000)
|
|
804
835
|
}
|
|
805
836
|
} catch (e) {
|
|
@@ -823,7 +854,7 @@ console.log("body", body)
|
|
|
823
854
|
if (res.success) {
|
|
824
855
|
document.querySelector(".loading").classList.add("hidden")
|
|
825
856
|
setTimeout(() => {
|
|
826
|
-
location.href = "/"
|
|
857
|
+
location.href = "/home"
|
|
827
858
|
}, 1000)
|
|
828
859
|
}
|
|
829
860
|
} catch (e) {
|