mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 15:44:35 +01:00
fix theme loading
This commit is contained in:
@@ -157,7 +157,7 @@ fn main() -> Result<(), ArgsError> {
|
|||||||
println!("You running as a non-elevated user. Some stuff will almost definitely not work.");
|
println!("You running as a non-elevated user. Some stuff will almost definitely not work.");
|
||||||
println!("===============================================================================");
|
println!("===============================================================================");
|
||||||
|
|
||||||
reopen_as_admin();
|
//reopen_as_admin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup datadir/cultivation just in case something went funky and it wasn't made
|
// Setup datadir/cultivation just in case something went funky and it wasn't made
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
"fs": {
|
"fs": {
|
||||||
"scope": ["$DATA", "$DATA/cultivation", "$DATA/cultivation/*"]
|
"scope": ["$DATA", "$DATA/cultivation", "$DATA/cultivation/**"]
|
||||||
},
|
},
|
||||||
"protocol": {
|
"protocol": {
|
||||||
"all": true,
|
"all": true,
|
||||||
"asset": true,
|
"asset": true,
|
||||||
"assetScope": ["$DATA", "$DATA/cultivation", "$DATA/cultivation/*"]
|
"assetScope": ["$DATA", "$DATA/cultivation", "$DATA/cultivation/**"]
|
||||||
},
|
},
|
||||||
"all": true
|
"all": true
|
||||||
},
|
},
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"security": {
|
"security": {
|
||||||
"csp": "default-src 'self' https://asset.localhost; img-src 'self'; img-src https://* asset: https://asset.localhost"
|
"csp": "default-src 'self'; img-src 'self'; img-src https://* asset: https://asset.localhost; media-src https://* asset: https://asset.localhost"
|
||||||
},
|
},
|
||||||
"updater": {
|
"updater": {
|
||||||
"active": false,
|
"active": false,
|
||||||
|
|||||||
@@ -88,26 +88,32 @@ export async function loadTheme(theme: ThemeList, document: Document) {
|
|||||||
const cssIncludes = theme.includes.css
|
const cssIncludes = theme.includes.css
|
||||||
const jsIncludes = theme.includes.js
|
const jsIncludes = theme.includes.js
|
||||||
|
|
||||||
|
console.log(theme.includes)
|
||||||
|
|
||||||
// Load CSS files
|
// Load CSS files
|
||||||
cssIncludes.forEach((css) => {
|
if (cssIncludes) {
|
||||||
if (!css) return
|
cssIncludes?.forEach((css) => {
|
||||||
|
if (!css) return
|
||||||
|
|
||||||
const link = document.createElement('link')
|
const link = document.createElement('link')
|
||||||
|
|
||||||
link.rel = 'stylesheet'
|
link.rel = 'stylesheet'
|
||||||
link.href = convertFileSrc(theme.path + '/' + css)
|
link.href = convertFileSrc(theme.path + '/' + css)
|
||||||
head.appendChild(link)
|
head.appendChild(link)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Load JS files
|
// Load JS files
|
||||||
jsIncludes.forEach((js) => {
|
if (jsIncludes) {
|
||||||
if (!js) return
|
jsIncludes.forEach((js) => {
|
||||||
|
if (!js) return
|
||||||
|
|
||||||
const script = document.createElement('script')
|
const script = document.createElement('script')
|
||||||
|
|
||||||
script.src = convertFileSrc(theme.path + '/' + js)
|
script.src = convertFileSrc(theme.path + '/' + js)
|
||||||
head.appendChild(script)
|
head.appendChild(script)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Set custom background
|
// Set custom background
|
||||||
if (theme.customBackgroundURL) {
|
if (theme.customBackgroundURL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user