forked from 1b-agent/opencadstudio-upstream
Merge pull request #1294: Fix thumbnail scaling and nested signing
This commit is contained in:
commit
318dee2db8
3 files changed
+28
-8
No files matched your search
@@ -424,8 +424,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Ad-hoc code-sign the bundle
|
- name: Ad-hoc code-sign the bundle
|
||||||
run: |
|
run: |
|
||||||
codesign --force --deep --sign - --timestamp=none OpenCADStudio.app
|
codesign --force --sign - --timestamp=none OpenCADStudio.app/Contents/MacOS/OpenCADStudio-App
|
||||||
codesign --verify --strict --verbose=2 OpenCADStudio.app
|
codesign --force --sign - --timestamp=none \
|
||||||
|
--entitlements crates/dwg-thumbnailer/macos/entitlements.plist \
|
||||||
|
OpenCADStudio.app/Contents/PlugIns/DWGThumbnail.appex
|
||||||
|
codesign --force --sign - --timestamp=none OpenCADStudio.app
|
||||||
|
codesign --verify --deep --strict --verbose=2 OpenCADStudio.app
|
||||||
|
codesign -d --entitlements - OpenCADStudio.app/Contents/PlugIns/DWGThumbnail.appex \
|
||||||
|
| python3 -c 'import plistlib, sys; assert plistlib.load(sys.stdin.buffer).get("com.apple.security.app-sandbox") is True'
|
||||||
|
|
||||||
- name: Create .dmg
|
- name: Create .dmg
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -39,9 +39,15 @@ final class ThumbnailProvider: QLThumbnailProvider {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let size = CGSize(width: cg.width, height: cg.height)
|
// Fit and center the embedded bitmap in the requested thumbnail.
|
||||||
let reply = QLThumbnailReply(contextSize: size) { (ctx: CGContext) -> Bool in
|
let maxSize = request.maximumSize
|
||||||
ctx.draw(cg, in: CGRect(origin: .zero, size: size))
|
let nativeSize = CGSize(width: cg.width, height: cg.height)
|
||||||
|
let scale = min(maxSize.width / nativeSize.width, maxSize.height / nativeSize.height)
|
||||||
|
let drawSize = CGSize(width: nativeSize.width * scale, height: nativeSize.height * scale)
|
||||||
|
let origin = CGPoint(x: (maxSize.width - drawSize.width) / 2, y: (maxSize.height - drawSize.height) / 2)
|
||||||
|
|
||||||
|
let reply = QLThumbnailReply(contextSize: maxSize) { (ctx: CGContext) -> Bool in
|
||||||
|
ctx.draw(cg, in: CGRect(origin: origin, size: drawSize))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
handler(reply, nil)
|
handler(reply, nil)
|
||||||
|
|||||||
@@ -93,8 +93,14 @@ sed "s/__VERSION__/$VERSION/g" packaging/Info.plist > "$APP/Contents/Info.plist"
|
|||||||
|
|
||||||
echo "==> codesign"
|
echo "==> codesign"
|
||||||
if [ "$DEVELOPER_ID" = "-" ]; then
|
if [ "$DEVELOPER_ID" = "-" ]; then
|
||||||
# CI-parity ad-hoc signature; cannot be notarized.
|
# Sign inside out so the extension retains its sandbox entitlement.
|
||||||
codesign --force --deep --sign - --timestamp=none "$APP"
|
# Ad-hoc signing cannot be notarized.
|
||||||
|
codesign --force --sign - --timestamp=none \
|
||||||
|
"$APP/Contents/MacOS/OpenCADStudio-App"
|
||||||
|
codesign --force --sign - --timestamp=none \
|
||||||
|
--entitlements crates/dwg-thumbnailer/macos/entitlements.plist \
|
||||||
|
"$APP/Contents/PlugIns/DWGThumbnail.appex"
|
||||||
|
codesign --force --sign - --timestamp=none "$APP"
|
||||||
else
|
else
|
||||||
# Sign nested code before the outer bundle. The sandbox entitlement is
|
# Sign nested code before the outer bundle. The sandbox entitlement is
|
||||||
# required for the QuickLook extension. Use hardened runtime
|
# required for the QuickLook extension. Use hardened runtime
|
||||||
@@ -107,7 +113,9 @@ else
|
|||||||
codesign --force --timestamp --options runtime \
|
codesign --force --timestamp --options runtime \
|
||||||
-s "$DEVELOPER_ID" "$APP"
|
-s "$DEVELOPER_ID" "$APP"
|
||||||
fi
|
fi
|
||||||
codesign --verify --strict --verbose=2 "$APP"
|
codesign --verify --deep --strict --verbose=2 "$APP"
|
||||||
|
codesign -d --entitlements - "$APP/Contents/PlugIns/DWGThumbnail.appex" \
|
||||||
|
| python3 -c 'import plistlib, sys; assert plistlib.load(sys.stdin.buffer).get("com.apple.security.app-sandbox") is True'
|
||||||
|
|
||||||
echo "==> dmg"
|
echo "==> dmg"
|
||||||
DMG="$DIST/OpenCADStudio-v$VERSION-macos-arm64.dmg"
|
DMG="$DIST/OpenCADStudio-v$VERSION-macos-arm64.dmg"
|
||||||
|
|||||||
Reference in new issue
Block a user