feat: css in separate file

This commit is contained in:
relikd
2025-10-28 21:48:22 +01:00
parent 22a17494c8
commit 4815229815
4 changed files with 214 additions and 215 deletions

View File

@@ -478,13 +478,7 @@ func procFileInfo(_ url: URL) -> HtmlDict {
/// Process meta information about the plugin. Like version and debug flag.
func procFooterInfo() -> HtmlDict {
#if DEBUG
let debugString = "(debug)"
#else
let debugString = ""
#endif
return [
"DEBUG": debugString,
"BundleShortVersionString": Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "",
"BundleVersion": Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "",
]
@@ -550,6 +544,9 @@ func generateHtml(at url: URL) -> String {
// App Icon (last, because the image uses a lot of memory)
let icon = AppIcon(meta)
infoLayer["AppIcon"] = icon.extractImage(from: plistApp).withRoundCorners().asBase64()
// insert CSS styles
let cssURL = Bundle.main.url(forResource: "style", withExtension: "css")!
infoLayer["CSS"] = try! String(contentsOf: cssURL, encoding: .utf8)
// prepare html, replace values
return applyHtmlTemplate(infoLayer)
}