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

@@ -27,6 +27,7 @@
54D3A6F02EA3F49F001EF4F6 /* RoundedIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54D3A6EF2EA3F49F001EF4F6 /* RoundedIcon.swift */; };
54D3A6F72EA46154001EF4F6 /* CoreUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54D3A6F52EA4610B001EF4F6 /* CoreUI.framework */; };
54D3A6FE2EA465B4001EF4F6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54D3A6FA2EA46588001EF4F6 /* CoreGraphics.framework */; };
54E0875A2EB15DD000979D91 /* style.css in Resources */ = {isa = PBXBuildFile; fileRef = 54E087592EB15DD000979D91 /* style.css */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -88,6 +89,7 @@
54E087532EB148DB00979D91 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; };
54E087552EB148DF00979D91 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
54E087572EB148E700979D91 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
54E087592EB15DD000979D91 /* style.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = style.css; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -195,6 +197,7 @@
children = (
54D3A6F22EA4603B001EF4F6 /* defaultIcon.png */,
54D3A6F32EA4603B001EF4F6 /* template.html */,
54E087592EB15DD000979D91 /* style.css */,
);
path = resources;
sourceTree = "<group>";
@@ -302,6 +305,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
54E0875A2EB15DD000979D91 /* style.css in Resources */,
545459C42EA469E4002892E5 /* defaultIcon.png in Resources */,
545459C52EA469EA002892E5 /* template.html in Resources */,
54442C7B2E378BE0008A870E /* PreviewViewController.xib in Resources */,
@@ -506,7 +510,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 641;
CURRENT_PROJECT_VERSION = 648;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = UY657LKNHJ;
ENABLE_HARDENED_RUNTIME = YES;
@@ -537,7 +541,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 641;
CURRENT_PROJECT_VERSION = 648;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = UY657LKNHJ;
ENABLE_HARDENED_RUNTIME = YES;
@@ -564,7 +568,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = QLPreview/QLPreview.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 641;
CURRENT_PROJECT_VERSION = 648;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = UY657LKNHJ;
ENABLE_HARDENED_RUNTIME = YES;
@@ -593,7 +597,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = QLPreview/QLPreview.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 641;
CURRENT_PROJECT_VERSION = 648;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = UY657LKNHJ;
ENABLE_HARDENED_RUNTIME = YES;

131
resources/style.css Normal file
View File

@@ -0,0 +1,131 @@
body {
background: #f7f7f7;
color: #000;
margin: 20px;
font: 13px monospace;
line-height: 1.3;
}
.hiddenDiv {
display: none;
}
.app {
margin-bottom: 20px;
}
.app img {
-webkit-filter: drop-shadow(0px 0px 3px rgba(0,0,0,0.5));
filter: drop-shadow(0px 0px 3px rgba(0,0,0,0.5));
width: 100px;
}
.info .subsection {
display: inline-block;
vertical-align: top;
}
.info .list {
padding-left: 20px;
}
.icon {
padding-right: 20px;
}
.info > .list {
display: inline-block;
padding-left: 0px;
}
.floatLeft {
float: left;
}
a { color: #aaa; }
a:hover { color: #000; }
a:visited { color: #aaa; }
h1 {
font-size: 18px;
}
h2 {
font-size: 14px;
margin-top: 4ex;
text-transform: uppercase;
}
.expired, .warning {
color: darkred;
}
.expiring {
color: #996600;
}
.valid {
color: darkgreen;
}
.deviceType {
color: #aaa;
font-size: 11px;
}
.clear {
clear: left;
}
table {
width: 600px;
}
tr {
line-height: 1.75;
}
td {
padding-left: 8px;
padding-right: 8px;
}
tr:nth-child(odd) {
background-color: #eee;
}
tr:nth-child(even) {
background-color: #fafafa;
}
.footer {
margin-top: 20px;
color: #aaa;
font-size: 11px;
}
@media (prefers-color-scheme: dark) {
body {
background: #323232;
color: #fff;
}
a { color: #aaa; }
a:hover { color: #fff; }
a:visited { color: #aaa; }
.expired, .warning {
color: red;
}
.expiring {
color: orange;
}
.valid {
color: lightgreen;
}
tr:nth-child(odd) {
background-color: #1e1e1e;
}
tr:nth-child(even) {
background-color: #292929;
}
}

View File

@@ -1,215 +1,82 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
body {
background: #f7f7f7;
color: #000;
margin: 20px;
font: 13px monospace;
line-height: 1.3;
}
<head>
<meta charset="UTF-8">
<style>__CSS__</style>
</head>
<body>
<div class="app __AppInfoHidden__">
<h1>__AppInfoTitle__</h1>
<div class="floatLeft icon"><img alt="App icon" src="data:image/png;base64,__AppIcon__"/></div>
<div class="floatLeft info">
Name: <strong>__CFBundleName__</strong><br />
Version: __CFBundleShortVersionString__ (__CFBundleVersion__)<br />
BundleId: __CFBundleIdentifier__<br />
<div class="__ExtensionTypeHidden__">
Extension type: __ExtensionType__<br />
</div>
DeviceFamily: __UIDeviceFamily__<br />
SDK: __DTSDKName__<br />
Minimum OS Version: __MinimumOSVersion__<br />
</div>
<br class="clear" />
<h2>App Transport Security</h2>
__AppTransportSecurityFormatted__
</div>
.hiddenDiv {
display: none;
}
<div class="__ProvisionHidden__">
<div class="__AppInfoHidden__">
<h2>Provisioning</h2>
Profile name: <strong>__ProfileName__</strong><br />
</div>
<div class="__ProvisionTitleHidden__">
<h1><span class="__ExpStatus__">__ProfileName__</span></h1>
</div>
.app {
margin-bottom: 20px;
}
Profile UUID: __ProfileUUID__<br />
Profile Type: __ProfilePlatform__ __ProfileType__<br />
Team: __TeamName__ (__TeamIds__)<br />
Creation date: __CreationDateFormatted__<br />
Expiration Date: <strong><span class="__ExpStatus__">__ExpirationDateFormatted__</span></strong><br />
</div>
.app img {
-webkit-filter: drop-shadow(0px 0px 3px rgba(0,0,0,0.5));
filter: drop-shadow(0px 0px 3px rgba(0,0,0,0.5));
width: 100px;
}
<div>
<h2>Entitlements</h2>
<div class="__EntitlementsWarningHidden__ warning">
<strong>Entitlements extraction failed.</strong>
</div>
__EntitlementsFormatted__
</div>
.info .subsection {
display: inline-block;
vertical-align: top;
}
<div class="__ProvisionHidden__">
<h2>Developer Certificates</h2>
__DeveloperCertificatesFormatted__
</div>
.info .list {
padding-left: 20px;
}
<div class="__ProvisionHidden__">
<h2>Devices (__ProvisionedDevicesCount__)</h2>
__ProvisionedDevicesFormatted__
</div>
.icon {
padding-right: 20px;
}
<div class="__iTunesHidden__">
<h2>iTunes Metadata</h2>
iTunesId: __iTunesId__<br />
Title: __iTunesName__<br />
Genres: __iTunesGenres__<br />
Released: __iTunesReleaseDate__<br />
<br />
AppleId: __iTunesAppleId__<br />
Purchased: __iTunesPurchaseDate__<br />
Price: __iTunesPrice__<br />
</div>
.info > .list {
display: inline-block;
padding-left: 0px;
}
.floatLeft {
float: left;
}
a { color: #aaa; }
a:hover { color: #000; }
a:visited { color: #aaa; }
h1 {
font-size: 18px;
}
h2 {
font-size: 14px;
margin-top: 4ex;
text-transform: uppercase;
}
.expired, .warning {
color: darkred;
}
.expiring {
color: #996600;
}
.valid {
color: darkgreen;
}
.deviceType {
color: #aaa;
font-size: 11px;
}
.clear {
clear: left;
}
table {
width: 600px;
}
tr {
line-height: 1.75;
}
td {
padding-left: 8px;
padding-right: 8px;
}
tr:nth-child(odd) {
background-color: #eee;
}
tr:nth-child(even) {
background-color: #fafafa;
}
.footer {
margin-top: 20px;
color: #aaa;
font-size: 11px;
}
@media (prefers-color-scheme: dark) {
body {
background: #323232;
color: #fff;
}
a { color: #aaa; }
a:hover { color: #fff; }
a:visited { color: #aaa; }
.expired, .warning {
color: red;
}
.expiring {
color: orange;
}
.valid {
color: lightgreen;
}
tr:nth-child(odd) {
background-color: #1e1e1e;
}
tr:nth-child(even) {
background-color: #292929;
}
}
</style>
</head>
<body>
<div class="app __AppInfoHidden__">
<h1>__AppInfoTitle__</h1>
<div class="floatLeft icon"><img alt="App icon" src="data:image/png;base64,__AppIcon__"/></div>
<div class="floatLeft info">
Name: <strong>__CFBundleName__</strong><br />
Version: __CFBundleShortVersionString__ (__CFBundleVersion__)<br />
BundleId: __CFBundleIdentifier__<br />
<div class="__ExtensionTypeHidden__">
Extension type: __ExtensionType__<br />
</div>
DeviceFamily: __UIDeviceFamily__<br />
SDK: __DTSDKName__<br />
Minimum OS Version: __MinimumOSVersion__<br />
</div>
<br class="clear" />
<h2>App Transport Security</h2>
__AppTransportSecurityFormatted__
</div>
<div class="__ProvisionHidden__">
<div class="__AppInfoHidden__">
<h2>Provisioning</h2>
Profile name: <strong>__ProfileName__</strong><br />
</div>
<div class="__ProvisionTitleHidden__">
<h1><span class="__ExpStatus__">__ProfileName__</span></h1>
</div>
Profile UUID: __ProfileUUID__<br />
Profile Type: __ProfilePlatform__ __ProfileType__<br />
Team: __TeamName__ (__TeamIds__)<br />
Creation date: __CreationDateFormatted__<br />
Expiration Date: <strong><span class="__ExpStatus__">__ExpirationDateFormatted__</span></strong><br />
</div>
<div>
<h2>Entitlements</h2>
<div class="__EntitlementsWarningHidden__ warning">
<strong>Entitlements extraction failed.</strong>
</div>
__EntitlementsFormatted__
</div>
<div class="__ProvisionHidden__">
<h2>Developer Certificates</h2>
__DeveloperCertificatesFormatted__
</div>
<div class="__ProvisionHidden__">
<h2>Devices (__ProvisionedDevicesCount__)</h2>
__ProvisionedDevicesFormatted__
</div>
<div class="__iTunesHidden__">
<h2>iTunes Metadata</h2>
iTunesId: __iTunesId__<br />
Title: __iTunesName__<br />
Genres: __iTunesGenres__<br />
Released: __iTunesReleaseDate__<br />
<br />
AppleId: __iTunesAppleId__<br />
Purchased: __iTunesPurchaseDate__<br />
Price: __iTunesPrice__<br />
</div>
<div>
<h2>File info</h2>
__FileName__<br />
__FileInfo__<br />
</div>
<div class="footer">
<p>ProvisionQL v__BundleShortVersionString__ (__BundleVersion__) __DEBUG__ (<a href="https://github.com/ealeksandrov/ProvisionQL">Fork on GitHub</a>)</p>
</div>
</body>
<div>
<h2>File info</h2>
__FileName__<br />
__FileInfo__<br />
</div>
<div class="footer">
<p>QLApps v__BundleShortVersionString__ (__BundleVersion__) (<a href="https://github.com/relikd/QLApps">Fork on GitHub</a>)</p>
</div>
</body>
</html>

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)
}