Updates to scanner with CVE saving and auto update
This commit is contained in:
@@ -36,6 +36,13 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Section("Navigation") {
|
Section("Navigation") {
|
||||||
|
Button {
|
||||||
|
selection = nil
|
||||||
|
} label: {
|
||||||
|
Label("Security Overview", systemImage: "house.fill")
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
|
||||||
Label("CVE research", systemImage: "shield.lefthalf.filled").tag(UUID(uuidString: "00000000-0000-0000-0000-000000000002")!)
|
Label("CVE research", systemImage: "shield.lefthalf.filled").tag(UUID(uuidString: "00000000-0000-0000-0000-000000000002")!)
|
||||||
Label("Scan history", systemImage: "clock.arrow.circlepath").tag(UUID(uuidString: "00000000-0000-0000-0000-000000000001")!)
|
Label("Scan history", systemImage: "clock.arrow.circlepath").tag(UUID(uuidString: "00000000-0000-0000-0000-000000000001")!)
|
||||||
}
|
}
|
||||||
|
|||||||
+49
-8
@@ -70,7 +70,7 @@ fi
|
|||||||
# Generate a proper macOS installer icon.
|
# Generate a proper macOS installer icon.
|
||||||
INSTALLER_PNG="$ROOT/PHPGuard/Assets.xcassets/InstallerIcon.imageset/icon.png"
|
INSTALLER_PNG="$ROOT/PHPGuard/Assets.xcassets/InstallerIcon.imageset/icon.png"
|
||||||
ICONSET="$ROOT/dist/PHPGuardInstaller.iconset"
|
ICONSET="$ROOT/dist/PHPGuardInstaller.iconset"
|
||||||
INSTALLER_ICNS="$ROOT/dist/PHPGuardInstaller.icns"
|
INSTALLER_ICNS="${TMPDIR:-/tmp}/PHPGuardInstaller-$$.icns"
|
||||||
|
|
||||||
if [[ -f "$INSTALLER_PNG" ]]; then
|
if [[ -f "$INSTALLER_PNG" ]]; then
|
||||||
rm -rf "$ICONSET"
|
rm -rf "$ICONSET"
|
||||||
@@ -94,14 +94,55 @@ fi
|
|||||||
hdiutil create -volname "PHPGuard $VERSION" -srcfolder "$STAGING" -ov -format UDZO "$DMG"
|
hdiutil create -volname "PHPGuard $VERSION" -srcfolder "$STAGING" -ov -format UDZO "$DMG"
|
||||||
|
|
||||||
# Apply custom Finder icon to the DMG.
|
# Apply custom Finder icon to the DMG.
|
||||||
if command -v fileicon >/dev/null 2>&1; then
|
# Apply the DMG Finder icon using native macOS tools.
|
||||||
fileicon set "$DMG" "$INSTALLER_ICNS"
|
echo "=== APPLY DMG ICON ==="
|
||||||
else
|
|
||||||
echo "WARNING: fileicon is not installed."
|
# Native macOS tools. No Homebrew dependencies.
|
||||||
echo "Install with: brew install fileicon"
|
REZ="$(xcrun --find Rez)"
|
||||||
echo "DMG created without a custom Finder icon."
|
SETFILE="$(xcrun --find SetFile)"
|
||||||
fi
|
|
||||||
|
[[ -f "$INSTALLER_ICNS" ]] || {
|
||||||
|
echo "ERROR: Installer .icns missing" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create an icon resource containing the .icns data.
|
||||||
|
ICON_RESOURCE="${TMPDIR:-/tmp}/PHPGuardInstaller-$$.r"
|
||||||
|
|
||||||
|
python3 - "$INSTALLER_ICNS" "$ICON_RESOURCE" <<'ICONPY'
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
icon = Path(sys.argv[1]).read_bytes()
|
||||||
|
|
||||||
|
if not icon.startswith(b"icns"):
|
||||||
|
raise SystemExit("ERROR: Invalid .icns file")
|
||||||
|
|
||||||
|
hexdata = icon.hex().upper()
|
||||||
|
|
||||||
|
with open(sys.argv[2], "w") as f:
|
||||||
|
f.write("data 'icns' (-16455) {\n")
|
||||||
|
for i in range(0, len(hexdata), 64):
|
||||||
|
f.write(' $"' + hexdata[i:i+64] + '"\n')
|
||||||
|
f.write("};\n")
|
||||||
|
ICONPY
|
||||||
|
|
||||||
|
# Attach icon resource to the DMG.
|
||||||
|
"$REZ" -append "$ICON_RESOURCE" -o "$DMG"
|
||||||
|
|
||||||
|
# Set the Finder custom-icon flag.
|
||||||
|
"$SETFILE" -a C "$DMG"
|
||||||
|
|
||||||
|
rm -f "$ICON_RESOURCE"
|
||||||
|
|
||||||
|
echo "Custom DMG icon applied."
|
||||||
|
|
||||||
xcrun notarytool submit "$DMG" --keychain-profile "$PROFILE" --wait
|
xcrun notarytool submit "$DMG" --keychain-profile "$PROFILE" --wait
|
||||||
xcrun stapler staple "$DMG"
|
xcrun stapler staple "$DMG"
|
||||||
xcrun stapler validate "$DMG"
|
xcrun stapler validate "$DMG"
|
||||||
|
# Keep only the final release DMG in dist.
|
||||||
|
echo "=== CLEAN RELEASE DIRECTORY ==="
|
||||||
|
|
||||||
|
find "$ROOT/dist" -maxdepth 1 -type f ! -name "$(basename "$DMG")" -delete
|
||||||
|
|
||||||
echo "Release ready: $DMG"
|
echo "Release ready: $DMG"
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
set -euo pipefail
|
|
||||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
||||||
cd "$ROOT"
|
|
||||||
command -v xcodebuild >/dev/null || { echo "Xcode is required" >&2; exit 1; }
|
|
||||||
command -v hdiutil >/dev/null || { echo "hdiutil missing" >&2; exit 1; }
|
|
||||||
IDENTITY="${SIGNING_IDENTITY:-$(security find-identity -v -p codesigning | sed -nE 's/.*"(Developer ID Application: [^"]+)".*/\1/p' | head -1)}"
|
|
||||||
[[ -n "$IDENTITY" ]] || { echo "Developer ID Application signing identity required. Set SIGNING_IDENTITY." >&2; exit 1; }
|
|
||||||
PROFILE="${NOTARY_PROFILE:-}"
|
|
||||||
[[ -n "$PROFILE" ]] || { echo "Set NOTARY_PROFILE to an existing notarytool keychain profile." >&2; exit 1; }
|
|
||||||
DERIVED="$ROOT/.build"
|
|
||||||
xcodebuild -project "$ROOT/PHPGuard.xcodeproj" -scheme PHPGuard -configuration Release -derivedDataPath "$DERIVED" CODE_SIGNING_ALLOWED=NO build
|
|
||||||
APP="$DERIVED/Build/Products/Release/PHPGuard.app"
|
|
||||||
[[ -d "$APP" ]] || { echo "Missing Release app" >&2; exit 1; }
|
|
||||||
VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Contents/Info.plist")"
|
|
||||||
mkdir -p "$ROOT/dist"
|
|
||||||
STAGING="$(mktemp -d)"
|
|
||||||
trap 'rm -rf "$STAGING"' EXIT
|
|
||||||
cp -R "$APP" "$STAGING/PHPGuard.app"
|
|
||||||
# No --deep signing: sign embedded executables individually if added in future.
|
|
||||||
codesign --force --options runtime --timestamp --sign "$IDENTITY" "$STAGING/PHPGuard.app"
|
|
||||||
codesign --verify --strict --verbose=2 "$STAGING/PHPGuard.app"
|
|
||||||
DMG="$ROOT/dist/PHPGuard-$VERSION.dmg"
|
|
||||||
rm -f "$DMG"
|
|
||||||
ln -s /Applications "$STAGING/Applications"
|
|
||||||
# Include a branded installer graphic in the disk image.
|
|
||||||
INSTALLER_ICON="$ROOT/PHPGuard/Assets.xcassets/InstallerIcon.imageset/icon.png"
|
|
||||||
if [[ -f "$INSTALLER_ICON" ]]; then
|
|
||||||
mkdir -p "$STAGING/.background"
|
|
||||||
cp "$INSTALLER_ICON" "$STAGING/.background/PHPGuard-Installer.png"
|
|
||||||
fi
|
|
||||||
hdiutil create -volname "PHPGuard $VERSION" -srcfolder "$STAGING" -ov -format UDZO "$DMG"
|
|
||||||
xcrun notarytool submit "$DMG" --keychain-profile "$PROFILE" --wait
|
|
||||||
xcrun stapler staple "$DMG"
|
|
||||||
xcrun stapler validate "$DMG"
|
|
||||||
echo "Release ready: $DMG"
|
|
||||||
Reference in New Issue
Block a user