Compare commits

..
Author SHA1 Message Date
Zorg 0fe3db7c25 Test unused analyzer warning 2021-11-06 18:53:14 -07:00
Zorg 5b312aa63e Fix null deference analyzer warnings (#2011) 2021-11-06 18:49:45 -07:00
Zorg 7cec9dbbe0 Ensure analyze step is only ran during pull requests 2021-11-06 18:07:37 -07:00
Zorg dde2b48af7 Post analyzer warnings in CI (#2010) 2021-11-06 17:59:30 -07:00
Zorg 9b6f962b31 Clarify documentation for canCheckForUpdates / sessionInProgress (#2009) 2021-11-06 15:38:25 -07:00
Zorg 1cba9f466d Whitelist about:srcdoc as a safe web URL (#2006)
The document I tested (after enabling javascript) was:

<description>
          <![CDATA[
              <p>Hello</p>
              <script>
              var iframe = document.createElement("iframe");
              iframe.srcdoc = `<!DOCTYPE html><p>Hello World!</p>`;
              document.body.appendChild(iframe);
              </script>
          ]]>
</description>
2021-11-06 14:52:09 -07:00
Zorg dbe1ae94f9 Update documentation, readme, changelog (#2004) 2021-11-06 02:17:49 -07:00
Zorg 45956ae5b0 Support relative links for fullReleaseNotesLink and enforce http(s) (#2003) 2021-11-06 01:56:50 -07:00
aONe 4c1bebedf9 fullReleaseNotesLink implemented (#2001) 2021-11-04 22:35:23 -07:00
Zorg 873a026627 Add project version inputs to create-draft-release workflow (#1998) 2021-10-30 22:55:27 -07:00
Zorg 9e54c5ca4d Sync 1.27.1 changelog (#1997) 2021-10-30 16:24:25 -07:00
Zorg 083790afa7 Don't use current date unless necessary when scheduling next update (2.x) (#1992) 2021-10-30 11:03:52 -07:00
Zorg c3030a6621 Revert "Set CODE_SIGN_INJECT_BASE_ENTITLEMENTS=NO for release (#1973)" (#1994)
For development we should include task-get-allow entitlements. For distribution if people use custom workflows, they need to properly re-sign the app without preserving this entitlement
2021-10-30 11:02:04 -07:00
Billy Gray e48edc6856 Adds standard user driver delegate method for responding to Version History button (#1989) 2021-10-29 16:59:48 -07:00
Zorg a81f8f3d2d Add safer handling for applying binary delta files (#1988) 2021-10-29 12:14:23 -07:00
Zorg 88c325a66f Bump default Xcode version to 13.1 (#1987) 2021-10-28 23:46:34 -07:00
Sparkle-Bot 0d43f88a83 Update Package.swift and Sparkle.podspec for version 2.0.0-beta.4 2021-10-24 04:04:45 +00:00
Zorg 2268b96c78 Bump project version to 2.0.0 beta 4 2021-10-23 20:56:35 -07:00
Zorg 3de3591d13 Fix order of inserting new appcast items in generate_appcast (#1982)
When we don't have any information for existing items, we have been appending new items below the existing ones. We should insert new items such that new items are inserted in order of version descending.
2021-10-23 20:21:54 -07:00
Zorg 7a9c1d76e6 Update Xcode 13 to 13.1 in CI (#1983) 2021-10-22 23:28:51 -07:00
Eitot fad6f1efe8 Update Dutch localisation (#1976) 2021-10-21 23:55:57 -07:00
Eitot 8045bf7af8 Update German localisation (#1977) 2021-10-21 23:54:39 -07:00
Zorg a436711133 Update CI to Xcode 12.5.1 2021-10-21 22:45:37 -07:00
Eitot ae7e7f12bc Update English localisation (#1978) 2021-10-21 22:40:34 -07:00
Zorg 80abad4477 Move XPC Services inside Sparkle framework (#1965)
Also bump FRAMEWORK_VERSION from A to B to work around system cache issues.
2021-10-17 23:35:09 -07:00
Zorg c9097ba42c Set CODE_SIGN_INJECT_BASE_ENTITLEMENTS=NO for release (#1973)
This removes the com.apple.security.get-task-allow entitlement on helper executable tools and XPC Services. While this is not a big deal, I don't think we should distribute executables with this entitlement which allows debugging them (with SIP / hardened runtime on). Note notarization ought to reject this entitlement with library validation enabled, so people must be getting around this anyway (either by using Xcode's Archive / Export which automatically strips this entitlement, or re-signing Sparkle tools without preserving entitlements).
2021-10-17 23:30:47 -07:00
Micah Moore 08f473fe82 Updates Version History French string translation. (#1975) 2021-10-11 20:11:45 -07:00
Zorg 6f8e8e4789 Make canCheckForUpdates property KVO compliant/observable (#1968)
* Make canCheckForUpdates property KVO compliant/observable

Also set updater session in progress when probing for update check interval to use.

* Add assert that driver must be nil in checkForUpdatesWithDriver:..
2021-10-03 12:58:00 -07:00
Daniel Jalkut a9d5a42768 When applying the system font size to the baseline CSS for the web view, use px instead of pt to specify the font size. This is consistent with best practices for web content, and alleviates a problem wherein the text in the web view, if not based on a full-fledged release notes HTML document, appears too large. (#1962) 2021-09-22 22:23:04 -07:00
Daniel Jalkut 9364c96336 Don't manipulate the default WebView preferences, which at least on Monterey beta returns a preferences instance with nil identifier and with autosaves set to YES. This has the unfortunate effect of causing Sparkle, when it uses SULegacyWebView, to pollute the host app's user defaults with high level WebKit defaults for user style sheet, font sizes, etc. Specifying a unique identifier as well as turning autosaves off should both ensure Sparkle doesn't impose app-wide defaults on the host app, and also avoid littering the host app's preference file with identifier-prefixed defaults. (#1961) 2021-09-22 19:14:13 -07:00
Sparkle-Bot ed9fa9bfed Update Package.swift and Sparkle.podspec for version 2.0.0-beta.3 2021-09-19 23:54:50 +00:00
Zorg 21b264543d Update version to 2.0.0-beta.3 (2003) (#1959) 2021-09-19 16:48:03 -07:00
Zorg eba1734f09 Fix issues with standard updater controller initialization (#1958)
* Fix init'ing updater delegates in standard updater controller in nibs

* Convert updaterDelegate/userDriverDelegate properties to ivars

This should allow connecting outlets in IB while disallowing setting them programmatically.
2021-09-19 16:32:43 -07:00
Zorg 1dea970512 Update changelog and documentation (#1956)
* Update author to Sparkle Project when generating documentation

* Sync change log from 1.27.0

* Add recommendation to not call checkForUpdatesInBackground directly

* Add testing documentation for latsUpdateCheckDate

* Fix formatting with user driver header documentation
2021-09-19 08:44:01 -07:00
Zorg 0f53f65241 Fix not being able to show resumed update in utmost focus (#1948)
This fixes a minor bug where canCheckForUpdates returned NO on a user initiated update check that shows an update that was already downloaded / begun installing. Now that it returns YES, the update can be shown in utmost focus by the user again.
2021-09-12 14:57:29 -07:00
Konstantin Zamyakin c60f12ab47 update some russian translates (#1947) 2021-09-11 13:14:38 -07:00
Mayur Pawashe 364e797676 Update cocoa pods badge to use shorter maxAge/cacheSeconds (#1945)
cacheSeconds has superseded maxAge.
2021-09-06 15:22:04 -07:00
Mayur Pawashe bf8216240c Add space 2021-09-06 12:05:37 -07:00
Mayur Pawashe f599a7a1a9 Update readme (#1944) 2021-09-06 12:04:50 -07:00
Vojtěch Koňařík 7096317766 Another localization update. (#1943) 2021-09-06 09:23:05 -07:00
Mayur Pawashe a8840953fe Fix podspec not using .xz (#1942) 2021-09-03 22:58:13 -07:00
Sparkle-Bot 76acd9cb5f Update Package.swift and Sparkle.podspec for version 2.0.0-beta.2 2021-09-04 05:11:08 +00:00
Mayur Pawashe e4b2d96faf Update Sparkle 2 build to beta 2 (#1941) 2021-09-03 22:04:43 -07:00
Mayur Pawashe 9229fc57b1 Add API reference homepage, fix formatting, and improve information (#1940) 2021-09-03 17:24:41 -07:00
Mayur Pawashe c396a53c6f Fix check to only validate XPC display versions in Debug (#1939) 2021-09-03 13:27:25 -07:00
Mayur Pawashe 2a67e2d732 Update podspec to include XPC Services and use https (#1935) 2021-09-03 10:16:37 -07:00
J-rg a135f1a1ee Fix German localization (#1931) 2021-09-03 08:39:28 -07:00
Mayur Pawashe 30361b0128 Use a custom bot personal access token (#1930)
This bot has owner access to the repo and should be able to push changes to protected branches, as long as the workflows are being ran from trusted branches / remotes.

Also extract changelog and use it for the draft.
2021-09-02 23:13:37 -07:00
Mayur Pawashe cce5edd78d Remove installer interaction delegate API / refactor finishing update cycle (#1925) 2021-09-02 23:12:26 -07:00
86 changed files with 1928 additions and 1141 deletions

No files matched your search

+43 -6
View File
@@ -10,14 +10,16 @@ jobs:
build:
strategy:
matrix:
xcode: ['xcode12.5', 'xcode13']
xcode: ['xcode12.5.1', 'xcode13.1']
include:
- xcode: 'xcode12.5'
xcode-path: '/Applications/Xcode_12.5.app/Contents/Developer'
- xcode: 'xcode12.5.1'
xcode-path: '/Applications/Xcode_12.5.1.app/Contents/Developer'
upload-dist: false
run-analyzer: false
- xcode: 'xcode13.1'
xcode-path: '/Applications/Xcode_13.1.app/Contents/Developer'
upload-dist: true
- xcode: 'xcode13'
xcode-path: '/Applications/Xcode_13.0.app/Contents/Developer'
upload-dist: false # In Beta, so no upload
run-analyzer: true
name: Build and Test Sparkle
runs-on: macos-11
@@ -48,6 +50,41 @@ jobs:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
- name: Analyze Sparkle
if: ${{ matrix.run-analyzer && github.event_name == 'pull_request' }}
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild analyze -project Sparkle.xcodeproj -quiet -scheme Sparkle -configuration Release -derivedDataPath analyze > anaylze_output.txt
- name: Find Analyzed Warnings
if: ${{ success() && matrix.run-analyzer && github.event_name == 'pull_request' }}
id: findwarnings
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
if grep -q "warning:" anaylze_output.txt; then
echo '::set-output name=analyzestatus::0'
else
echo '::set-output name=analyzestatus::1'
fi
- name: Extract Analyzed Warnings
if: ${{ success() && matrix.run-analyzer && github.event_name == 'pull_request' && steps.findwarnings.outputs.analyzestatus == '0' }}
id: warnings
run: |
echo ::set-output name=content::$(cat anaylze_output.txt)
- name: Post Analyzed Warnings
if: ${{ success() && matrix.run-analyzer && github.event_name == 'pull_request' && steps.findwarnings.outputs.analyzestatus == '0' }}
uses: mshick/add-pr-comment@v1
with:
allow-repeats: false
repo-token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
repo-token-user-login: 'Sparkle-Bot'
message: "``` ${{ steps.warnings.outputs.content }} ```"
- name: Build Release Distribution
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
+50 -15
View File
@@ -2,10 +2,25 @@ name: "Create Draft Release"
env:
BUILDDIR: "build"
DEVELOPER_DIR: "/Applications/Xcode_12.5.1.app/Contents/Developer"
DEVELOPER_DIR: "/Applications/Xcode_13.1.app/Contents/Developer"
on:
workflow_dispatch
workflow_dispatch:
inputs:
marketingVersion:
description: "Marketing Version"
required: true
default: ""
prereleaseSuffix:
description: "Pre-release Suffix"
required: false
default: ""
buildVersion:
description: "Product Build"
required: true
default: ""
concurrency:
group: publish-release-${{ github.ref }}
@@ -20,36 +35,54 @@ jobs:
- name: "Checkout sources"
uses: actions/checkout@v2
with:
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
submodules: true
fetch-depth: 0
- name: "Extract version information from project"
- name: "Extract latest changes from CHANGELOG"
run: |
MARKETING_VERSION=$(xcrun xcodebuild -showBuildSettings -project Sparkle.xcodeproj | grep -m 1 '^[[:space:]]*MARKETING_VERSION' | sed -E 's/.+=[[:space:]]+(.*)$/\1/')
echo "MARKETING_VERSION=${MARKETING_VERSION}" >> $GITHUB_ENV
./Configurations/generate_latest_changes.py > latest-changes.txt
- name: "Overwrite project versions in project"
run: |
IFS='.' read major minor patch <<< "${{ github.event.inputs.marketingVersion }}"
sed -E -i '' "s/SPARKLE_VERSION_MAJOR =.+/SPARKLE_VERSION_MAJOR = $major/g" ./Configurations/ConfigCommon.xcconfig
sed -E -i '' "s/SPARKLE_VERSION_MINOR =.+/SPARKLE_VERSION_MINOR = $minor/g" ./Configurations/ConfigCommon.xcconfig
sed -E -i '' "s/SPARKLE_VERSION_PATCH =.+/SPARKLE_VERSION_PATCH = $patch/g" ./Configurations/ConfigCommon.xcconfig
if [[ ! -z "${{ github.event.inputs.prereleaseSuffix }}" ]]; then
sed -E -i '' "s/SPARKLE_VERSION_SUFFIX =.*/SPARKLE_VERSION_SUFFIX = ${{ github.event.inputs.prereleaseSuffix }}/g" ./Configurations/ConfigCommon.xcconfig
else
sed -E -i '' "s/SPARKLE_VERSION_SUFFIX =.*/SPARKLE_VERSION_SUFFIX =/g" ./Configurations/ConfigCommon.xcconfig
fi
sed -E -i '' "s/CURRENT_PROJECT_VERSION =.+/CURRENT_PROJECT_VERSION = ${{ github.event.inputs.buildVersion }}/g" ./Configurations/ConfigCommon.xcconfig
git add ./Configurations/ConfigCommon.xcconfig
- name: "Determine if this is a pre-release version"
run: |
SPARKLE_VERSION_SUFFIX=$(xcrun xcodebuild -showBuildSettings -project Sparkle.xcodeproj | grep -m 1 '^[[:space:]]*SPARKLE_VERSION_SUFFIX' | sed -E 's/.+=[[:space:]]+(.*)$/\1/')
if [[ ! -z "$SPARKLE_VERSION_SUFFIX" ]]; then
if [[ ! -z "${{ github.event.inputs.prereleaseSuffix }}" ]]; then
echo "PRERELEASE_VERSION=true" >> $GITHUB_ENV
else
echo "PRERELEASE_VERSION=false" >> $GITHUB_ENV
fi
- name: "Create a temporary Git tag"
run: git tag "${{ env.MARKETING_VERSION }}"
- name: "Set up git and create tag"
run: |
git config user.name Sparkle-Bot
git config user.email sparkle.project.bot@gmail.com
git tag "${{ github.event.inputs.marketingVersion }}"
- name: "Build release distribution"
run: make release
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MARKETING_VERSION: ${{ env.MARKETING_VERSION }}
SPARKLE_VERSION_SUFFIX: ${{ env.SPARKLE_VERSION_SUFFIX }}
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
- name: "Push the updated Swift package description"
env:
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
run: git push
- name: "Draft a release"
@@ -57,9 +90,11 @@ jobs:
with:
draft: true
prerelease: ${{ env.PRERELEASE_VERSION }}
name: "Sparkle ${{ env.MARKETING_VERSION }}"
tag_name: ${{ env.MARKETING_VERSION }}
name: "Sparkle ${{ github.event.inputs.marketingVersion }}"
tag_name: ${{ github.event.inputs.marketingVersion }}
fail_on_unmatched_files: true
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
body_path: latest-changes.txt
files: |
build/Build/Products/Release/Sparkle-*.tar.xz
build/Build/Products/Release/Sparkle-for-Swift-Package-Manager.zip
+96 -3
View File
@@ -14,10 +14,23 @@
#include <stdio.h>
#include <stdlib.h>
#include <xar/xar.h>
#include <Availability.h>
#include "AppKitPrevention.h"
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
#define HAS_XAR_GET_SAFE_PATH 1
#else
#define HAS_XAR_GET_SAFE_PATH 0
#endif
#if HAS_XAR_GET_SAFE_PATH
// This is preferred over xar_get_path (which is deprecated) when it's available
// Don't use OS availability for this API
extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
#endif
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
{
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
@@ -87,6 +100,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
if (majorDiffVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
xar_close(x);
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to identify diff-version %u in delta. Giving up.", majorDiffVersion] }];
}
@@ -94,18 +109,36 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
xar_close(x);
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A later version is needed to apply this patch (on major version %u, but patch requests version %u).", LATEST_DELTA_DIFF_MAJOR_VERSION, majorDiffVersion] }];
}
return NO;
}
#if HAS_XAR_GET_SAFE_PATH
// Reject patches that did not generate valid hierarchical xar container paths
// These will not succeed to patch using recent versions of BinaryDelta
if ((majorDiffVersion == SUBinaryDeltaMajorVersion2 && minorDiffVersion < 3) || (majorDiffVersion == SUBinaryDeltaMajorVersion1 && minorDiffVersion < 2)) {
xar_close(x);
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"This patch version (%u.%u) is too old and potentially unsafe to apply. Please re-generate the patch using the latest version of BinaryDelta or generate_appcast. New version %u.%u patches will still be compatible with older versions of Sparkle.", majorDiffVersion, minorDiffVersion, majorDiffVersion, latestMinorVersionForMajorVersion(majorDiffVersion)] }];
}
return NO;
}
#endif
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1;
NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1;
if (!expectedBeforeHash || !expectedAfterHash) {
xar_close(x);
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: @"Unable to find before-sha1 or after-sha1 metadata in delta. Giving up." }];
}
@@ -121,6 +154,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion);
if (!beforeHash) {
xar_close(x);
if (verbose) {
fprintf(stderr, "\n");
}
@@ -131,6 +166,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
if (![beforeHash isEqualToString:expectedBeforeHash]) {
xar_close(x);
if (verbose) {
fprintf(stderr, "\n");
}
@@ -147,6 +184,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
progressCallback(2/6.0);
if (!removeTree(destination)) {
xar_close(x);
if (verbose) {
fprintf(stderr, "\n");
}
@@ -159,6 +198,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
progressCallback(3/6.0);
if (!copyTree(source, destination)) {
xar_close(x);
if (verbose) {
fprintf(stderr, "\n");
}
@@ -170,7 +211,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
progressCallback(4/6.0);
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
if (verbose) {
fprintf(stderr, "\nPatching...");
@@ -179,9 +220,52 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
xar_file_t file;
xar_iter_t iter = xar_iter_new();
for (file = xar_file_first(x, iter); file; file = xar_file_next(iter)) {
NSString *path = @(xar_get_path(file));
char *pathCString;
#if HAS_XAR_GET_SAFE_PATH
if (xar_get_safe_path != NULL) {
pathCString = xar_get_safe_path(file);
}
else
#endif
{
pathCString = xar_get_path(file);
}
if (pathCString == NULL) {
continue;
}
NSString *path = @(pathCString);
if ([path.pathComponents containsObject:@".."]) {
xar_close(x);
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path '%@' contains '..' path component", path] }];
}
return NO;
}
NSString *sourceFilePath = [source stringByAppendingPathComponent:path];
NSString *destinationFilePath = [destination stringByAppendingPathComponent:path];
{
NSString *destinationParentDirectory = destinationFilePath.stringByDeletingLastPathComponent;
NSDictionary<NSFileAttributeKey, id> *destinationParentDirectoryAttributes = [fileManager attributesOfItemAtPath:destinationParentDirectory error:NULL];
// It is OK for the directory parent to not exist if it has already been removed
if (destinationParentDirectoryAttributes != nil) {
// But if it does exist, make sure the entry in the parent directory we're looking at is good
// If it's inside a symlink, this is not good in any circumstance
NSString *fileType = destinationParentDirectoryAttributes[NSFileType];
if ([fileType isEqualToString:NSFileTypeSymbolicLink]) {
xar_close(x);
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch because '%@' cannot be a symbolic link.", destinationParentDirectory] }];
}
return NO;
}
}
}
// Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links
BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil];
@@ -193,6 +277,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
const char *value;
if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
if (!removeTree(destinationFilePath)) {
xar_close(x);
if (verbose) {
fprintf(stderr, "\n");
}
@@ -213,6 +299,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
if (!xar_prop_get(file, BINARY_DELTA_KEY, &value)) {
if (!applyBinaryDeltaToFile(x, file, sourceFilePath, destinationFilePath)) {
xar_close(x);
if (verbose) {
fprintf(stderr, "\n");
}
@@ -228,6 +316,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
} else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) || (!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist
if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) {
xar_close(x);
if (verbose) {
fprintf(stderr, "\n");
}
@@ -251,6 +341,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
if (!xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value)) {
mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue];
if (!modifyPermissions(destinationFilePath, mode)) {
xar_close(x);
if (verbose) {
fprintf(stderr, "\n");
}
@@ -265,6 +357,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
}
}
xar_close(x);
progressCallback(5/6.0);
+4 -4
View File
@@ -53,12 +53,12 @@
typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
{
SUAzureMajorVersion = 1,
SUBeigeMajorVersion = 2
SUBinaryDeltaMajorVersion1 = 1,
SUBinaryDeltaMajorVersion2 = 2
};
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUAzureMajorVersion
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBeigeMajorVersion
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion1
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion2
extern int compareFiles(const FTSENT **a, const FTSENT **b);
extern NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion);
+5 -5
View File
@@ -42,9 +42,9 @@ NSString *stringWithFileSystemRepresentation(const char *input)
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
{
switch (majorVersion) {
case SUAzureMajorVersion:
return 1;
case SUBeigeMajorVersion:
case SUBinaryDeltaMajorVersion1:
return 2;
case SUBinaryDeltaMajorVersion2:
return 3;
}
return 0;
@@ -162,7 +162,7 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
continue;
if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
continue;
}
@@ -179,7 +179,7 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
const char *relativePathBytes = [relativePath fileSystemRepresentation];
CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes));
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
uint16_t mode = ent->fts_statp->st_mode;
// permission of symlinks is irrelevant and can't be changed.
// hardcoding a value helps avoid differences between filesystems.
+6 -6
View File
@@ -531,8 +531,8 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
xar_subdoc_prop_set(attributes, MINOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", minorVersion] UTF8String]);
// Version 1 patches don't have a major or minor version field, so we need to differentiate between the hash keys
const char *beforeHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
const char *afterHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY;
const char *beforeHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
const char *afterHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY;
xar_subdoc_prop_set(attributes, beforeHashKey, [beforeHash UTF8String]);
xar_subdoc_prop_set(attributes, afterHashKey, [afterHash UTF8String]);
@@ -570,7 +570,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
NSDictionary *originalInfo = originalTreeState[key];
NSDictionary *newInfo = newTreeState[key];
if (shouldSkipDeltaCompression(originalInfo, newInfo)) {
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) && shouldSkipExtracting(originalInfo, newInfo)) {
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldSkipExtracting(originalInfo, newInfo)) {
if (shouldChangePermissions(originalInfo, newInfo)) {
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
assert(newFile);
@@ -586,14 +586,14 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
assert(newFile);
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
xar_prop_set(newFile, DELETE_KEY, "true");
} else {
xar_prop_set(newFile, DELETE_THEN_EXTRACT_OLD_KEY, "true");
}
}
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
xar_prop_set(newFile, EXTRACT_KEY, "true");
}
@@ -607,7 +607,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
} else {
NSNumber *permissions =
(MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) && shouldChangePermissions(originalInfo, newInfo)) ?
(MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldChangePermissions(originalInfo, newInfo)) ?
newInfo[INFO_PERMISSIONS_KEY] :
nil;
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:source newTree:destination oldPermissions:originalInfo[INFO_PERMISSIONS_KEY] newPermissions:permissions];
+26 -5
View File
@@ -24,16 +24,17 @@
* Sparkle uses the icon of the bundle to update for its authorization dialog. A 32x32 image representation of the icon is needed. (Zorg)
* Sudden termination for silent automatic updates isn't disabled anymore (Zorg)
* Policy Changes
* Distributing updates without EdDSA signing the archives is now deprecated (Zorg)
* Package based updates that are zipped or archived must add sparkle:installationType="package" to the appcast item enclosure (Zorg)
* Package based updates that are zipped or archived must add sparkle:installationType="package" to the appcast item enclosure (this doesn't apply to bare packages that aren't archived) (Zorg)
* We now recommend using sparkle:version and sparkle:shortVersionString top level elements instead of enclosure attributes (#1878) (Zorg)
* The link element in an appcast item is now used for directing users to the product's website if they don't meet minimum system requirements (#1877) (Zorg)
* Major/Paid Upgrades Enhancements
* Latest minor updates are preferred over major updates (specified by sparkle:minimumAutoupdateVersion) (#1850) Zorg
* Major updates can be skipped with a user confirmation (#1853) Zorg
* Latest minor updates are preferred over major updates (specified by sparkle:minimumAutoupdateVersion) (#1850) (Zorg)
* Major updates can be skipped with a user confirmation (#1853) (Zorg)
* Informational only and critical updates can be specified selectively by app version (#1862)
* Expose why a new update is unavailable and direct user to prior release notes or website info (#1877, #1886) (Zorg)
* Add support for posting updates only on specific channels (#1879) (Zorg)
* Add <sparkle:fullReleaseNotesLink> element allowing Sparkle to show a better stylized and full changelog to the user (#2001) (aONe)
* Add delegate API allowing applications to show full in-app or offline version history to the user (#1989) (Billy Gray)
* Add support for posting updates only on specific channels (eg for supporting beta updates) (#1879) (Zorg)
* System profiler privacy and transparency (#1690) (Martin Pilkington)
* Support getting app icon from asset catalog (#1694) (Charles Srstka)
* Don't hide update alert window now on deactivation (#1804) (Zorg)
@@ -45,6 +46,26 @@ Please visit [Sparkle's website](http://sparkle-project.org) for more informatio
If you are migrating from earlier alpha versions of Sparkle 2, please re-familiarize yourself with the [Sandboxing guide](https://sparkle-project.org/documentation/sandboxing/). Some of the XPC Services are now optional and integration with code signing has been simplified. The SPUUserDriver protocol for custom user interfaces has been greatly simplified too.
# 1.27.1
* Use px instead of pt when specifying font size to fix default font size in WebView from #1962 (regressed in 1.25.0 with WKWebView adoption) (Daniel Jalkut)
* Fix to prevent Sparkle manipulating the host app's high level WebView defaults from #1961 (affecting only macOS versions before 10.11 in 1.x branch) (Daniel Jalkut)
* Add safer handling of applying binary delta files from #1990 (Zorg)
* Don't use current date unless necessary when scheduling next update to be more resilient against rapid polling from #1991 (Zorg)
# 1.27.0
* Deprecate not using EdDSA and skip DSA verification when possible in #1892 (Zorg)
* Pass http headers and user agent when downloading release notes from #1873 (Zorg)
* Fix project warnings from #1893 (Zorg)
* Update sample appcast from #1895 (Zorg)
* Fix appcast pubDate tag generation in different locales from #1898 (Sungbin Jo)
* Create valid xar archives for generating binary delta files from #1906 (Zorg)
* Fix a few issues with German localization from #1931 (J-rg)
* Fix issues with Russian localizations from #1947 (Konstantin Zamyakin)
* Fix issues with Czech localizations from #1943 (Vojtěch Koňařík)
* Add an automated workflow that builds and publishes official Sparkle releases (Tony Arnold, Zorg)
# 1.26.0
* Flat package support from #1745 (Zorg)
+18 -8
View File
@@ -4,6 +4,20 @@ SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle
SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate
SPARKLE_INSTALLER_PROGRESS_TOOL_NAME = Updater
// Set to 1 or 0 to bundle or not bundle provided XPC Services in Sparkle framework
SPARKLE_EMBED_INSTALLER_LAUNCHER_XPC_SERVICE = 1
SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE = 1
SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE = 0
SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE = 0
// Set this to your own prefix if you want to use XPC Service names with different prefix
XPC_SERVICE_BUNDLE_ID_PREFIX = org.sparkle-project
INSTALLER_CONNECTION_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerConnection
INSTALLER_STATUS_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerStatus
INSTALLER_LAUNCHER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerLauncher
DOWNLOADER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.Downloader
// Set to 0 to only build all non-UI bits
SPARKLE_BUILD_UI_BITS = 1
@@ -18,13 +32,15 @@ SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
SPARKLE_ICON_NAME = AppIcon
// If you change any of these version details, you must increase CURRENT_PROJECT_VERSION
// These variables must have a space after the '=' too
SPARKLE_VERSION_MAJOR = 2
SPARKLE_VERSION_MINOR = 0
SPARKLE_VERSION_PATCH = 0
// This should be in SemVer format or empty, ie. "-beta.1"
SPARKLE_VERSION_SUFFIX = -beta.1
CURRENT_PROJECT_VERSION = 2001
// These variables must have a space after the '=' too
SPARKLE_VERSION_SUFFIX = -beta.4
CURRENT_PROJECT_VERSION = 2004
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
ALWAYS_SEARCH_USER_PATHS = NO
@@ -36,12 +52,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.11
PRODUCT_NAME = ${TARGET_NAME}
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
XPC_SERVICE_BUNDLE_ID_PREFIX = org.sparkle-project
INSTALLER_CONNECTION_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerConnection
INSTALLER_STATUS_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerStatus
INSTALLER_LAUNCHER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerLauncher
DOWNLOADER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.Downloader
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_BUILD_UI_BITS=$(SPARKLE_BUILD_UI_BITS) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" MARKETING_VERSION=\"$(MARKETING_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" DOWNLOADER_BUNDLE_ID=\"${DOWNLOADER_BUNDLE_ID}\"
CODE_SIGN_IDENTITY = -
+9 -1
View File
@@ -4,7 +4,15 @@ DYLIB_INSTALL_NAME_BASE = @rpath
DYLIB_COMPATIBILITY_VERSION = 1.6
DYLIB_CURRENT_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
WRAPPER_EXTENSION = framework
FRAMEWORK_VERSION = A
// Sparkle 2 used to support developers embedding XPC Services in their own app bundle
// However the Sparkle framework now bundles these XPC Services. Unfortunately this causes
// a cache conflict in the system from upgrading from previous to newer versions of Sparkle, and
// XPC Services inside Sparkle may not launch (a system reboot would fix this though).
// The system cache seems to depend on the Sparkle file path,
// so as a better workaround we have changed the FRAMEWORK_VERSION from A to B
FRAMEWORK_VERSION = B
INFOPLIST_FILE = Sparkle/Sparkle-Info.plist
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) BUILDING_SPARKLE=1
SKIP_INSTALL = YES
-93
View File
@@ -1,93 +0,0 @@
#!/usr/bin/env python3
import os, sys, subprocess, tempfile, pathlib
PRODUCT_BUNDLE_ID_MACRO = "$(PRODUCT_BUNDLE_IDENTIFIER)"
def log_message(message):
sys.stderr.write(message + "\n")
#Surround a token with double quotes if it has a space in it
def sanitize(argument):
return ('"' + argument + '"' if ' ' in argument else argument)
def _codesign_service(identity, path, entitlements_path=None):
command = ["codesign", "-o", "runtime", "-fs", identity, path] + ([] if entitlements_path is None else ["--entitlements", entitlements_path])
log_message(" ".join(map(sanitize, command)))
process = subprocess.Popen(command, stdout=subprocess.PIPE)
process.communicate()
if process.returncode != 0:
log_message("Error: Failed to codesign %s" % (path))
sys.exit(1)
def codesign_service(service_name, identity, path, entitlements_path=None):
#Sign the auxiliary executables (if any)
executables_path = os.path.join(path, "Contents/MacOS/")
if os.path.exists(executables_path):
for executable in os.listdir(executables_path):
if executable != service_name:
_codesign_service(identity, os.path.join(executables_path, executable), entitlements_path)
#Sign the service bundle
_codesign_service(identity, path, entitlements_path)
# Returns entitlements back with a bundle id applied if needed
def applied_entitlements_path(entitlements_path, bundle_id, temp_dir):
entitlements_str = pathlib.Path(entitlements_path).read_text()
if PRODUCT_BUNDLE_ID_MACRO in entitlements_str:
if bundle_id is None:
return None
else:
new_entitlements_str = entitlements_str.replace(PRODUCT_BUNDLE_ID_MACRO, bundle_id)
new_entitlements_path = os.path.join(temp_dir, os.path.basename(entitlements_path))
pathlib.Path(new_entitlements_path).write_text(new_entitlements_str)
return new_entitlements_path
else:
return entitlements_path
def print_usage():
log_message("Usage:\n\t%s code-signing-identity [-b app-bundle-id] service1 service2 ..." % (sys.argv[0]))
log_message("Example:\n\t%s \"Developer ID Application\" ./XPCServices/org.sparkle-project.InstallerLauncher.xpc" % (sys.argv[0]))
log_message("")
log_message("Use this script to sign XPC Services to include in your Sandboxed application.")
log_message("")
log_message("bundle-id is optional and only needs to be provided when signing InstallerConnection and InstallerStatus services. Most applications do not need to use these services and can provide additional entitlements to their application instead.")
log_message("")
log_message("This script may not be needed for common development workflows. Please visit https://sparkle-project.org/documentation/sandboxing/ for more details and instructions.")
if __name__ == "__main__":
if len(sys.argv) < 3:
print_usage()
sys.exit(1)
signing_identity = sys.argv[1]
remaining_args = sys.argv[2:]
bundle_id = None
if remaining_args[0] == '-b':
if len(remaining_args) < 3:
# We need the bundle-id and at least one XPC Service to sign
print_usage()
sys.exit(1)
else:
bundle_id = remaining_args[1]
services = remaining_args[2:]
else:
services = remaining_args
with tempfile.TemporaryDirectory() as temp_dir:
for service in services:
parent, child = os.path.split(service)
service_name = os.path.splitext(child)[0]
entitlements_path = os.path.join(parent, service_name + ".entitlements")
if os.path.exists(entitlements_path):
service_entitlements_path = applied_entitlements_path(entitlements_path, bundle_id, temp_dir)
if service_entitlements_path is None:
print_usage()
log_message("")
log_message("Error: Bundle ID must be specified for signing %s. As noted in the usage above, you probably don't need to embed this service." % (service_name))
sys.exit(1)
else:
service_entitlements_path = None
codesign_service(service_name, signing_identity, service, service_entitlements_path)
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
import os, sys
# Ignore the first version line starting with # x.y.z..
# and print everything until the second version line starting with # x.y.z..
hit_first_changelog_note = False
with open("CHANGELOG", "r") as changelog_file:
for line in changelog_file:
if line.startswith("#"):
if hit_first_changelog_note:
# We are done with printing changes
break
else:
# We haven't hit an important changelog line yet, so continue
continue
if not hit_first_changelog_note and len(line.strip()) == 0:
continue
hit_first_changelog_note = True
sys.stdout.write(line)
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/sh
# Create symlinks to our helper tools in Sparkle and SparkleCore framework bundles
# Create symlinks to our helper tools in Sparkle framework bundle
# so URLForAuxiliaryExecutable: will pick up the tools. Doing this is supported in the Code Signing in Depth guide.
FRAMEWORK_PATH="${TARGET_BUILD_DIR}"/"${FULL_PRODUCT_NAME}"
+21 -31
View File
@@ -13,10 +13,6 @@ function verify_code_signatures() {
# Search the current directory for all instances of the framework to verify them (XCFrameworks can have multiple copies of a framework for different platforms).
find "${verification_directory}" -name "Sparkle.framework" -type d -exec codesign --verify -vvv --deep {} \;
codesign --verify -vvv --deep "${verification_directory}/XPCServices/org.sparkle-project.Downloader.xpc"
codesign --verify -vvv --deep "${verification_directory}/XPCServices/org.sparkle-project.InstallerConnection.xpc"
codesign --verify -vvv --deep "${verification_directory}/XPCServices/org.sparkle-project.InstallerLauncher.xpc"
codesign --verify -vvv --deep "${verification_directory}/XPCServices/org.sparkle-project.InstallerStatus.xpc"
codesign --verify -vvv --deep "${verification_directory}/sparkle.app"
codesign --verify -vvv --deep "${verification_directory}/Sparkle Test App.app"
codesign --verify -vvv --deep "${verification_directory}/bin/BinaryDelta"
@@ -41,46 +37,40 @@ if [ "$ACTION" = "" ] ; then
cp "$CONFIGURATION_BUILD_DIR/generate_appcast" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$CONFIGURATION_BUILD_DIR/generate_keys" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$CONFIGURATION_BUILD_DIR/sign_update" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$SRCROOT/Configurations/codesign_xpc_service.py" "$CONFIGURATION_BUILD_DIR/staging/bin/codesign_xpc_service"
chmod 0755 "$CONFIGURATION_BUILD_DIR/staging/bin/codesign_xpc_service"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.xcframework" "$CONFIGURATION_BUILD_DIR/staging-spm"
if [[ "$SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE" -eq 1 ]]; then
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/Entitlements"
mkdir -p "$CONFIGURATION_BUILD_DIR/staging-spm/Entitlements"
cp -R "$SRCROOT/Downloader/org.sparkle-project.Downloader.entitlements" "$CONFIGURATION_BUILD_DIR/staging/Entitlements"
cp -R "$SRCROOT/Downloader/org.sparkle-project.Downloader.entitlements" "$CONFIGURATION_BUILD_DIR/staging-spm/Entitlements"
fi
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_LAUNCHER_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$DOWNLOADER_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_CONNECTION_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_STATUS_BUNDLE_ID.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp "$SRCROOT/Downloader/$DOWNLOADER_BUNDLE_ID.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp "$SRCROOT/InstallerConnection/$INSTALLER_CONNECTION_BUNDLE_ID.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp "$SRCROOT/InstallerStatus/$INSTALLER_STATUS_BUNDLE_ID.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/Symbols"
# Only copy dSYMs for Release builds, but don't check for the presence of the actual files
# because missing dSYMs in a release build SHOULD trigger a build failure
if [ "$CONFIGURATION" = "Release" ] ; then
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/generate_appcast.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/generate_keys.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/sign_update.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_LAUNCHER_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$DOWNLOADER_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_CONNECTION_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/$INSTALLER_STATUS_BUNDLE_ID.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices"
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/generate_appcast.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/generate_keys.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/sign_update.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Autoupdate.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Updater.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/org.sparkle-project.InstallerLauncher.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/org.sparkle-project.Downloader.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
fi
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/staging/XPCServices" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/staging/Symbols" "$CONFIGURATION_BUILD_DIR/staging-spm"
cd "$CONFIGURATION_BUILD_DIR/staging"
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
FRAMEWORK_PATH="${TARGET_BUILD_DIR}"/"${FULL_PRODUCT_NAME}"
removedservices=0
if [[ "$SPARKLE_EMBED_INSTALLER_LAUNCHER_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_LAUNCHER_BUNDLE_ID}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${DOWNLOADER_BUNDLE_ID}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_STATUS_BUNDLE_ID}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_CONNECTION_BUNDLE_ID}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$removedservices" -eq 4 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"
rm -rf "${FRAMEWORK_PATH}"/"XPCServices"
fi
+12
View File
@@ -0,0 +1,12 @@
# Sparkle 2 API Reference
These are the primary classes and protocols in Sparkle 2 you may be interested in:
- `SPUStandardUpdaterController` for creating a standard updater (encapsulates a `SPUUpdater` and `SPUStandardUserDriver`)
- `SPUUpdater` for invoking update checks and retrieving updater properties.
- `SPUUpdaterDelegate` for delegation methods to control the behavior of `SPUUpdater`.
- `SPUUserDriver` for making custom user interfaces.
If you are migrating from Sparkle 1, please refer to `SPUStandardUpdaterController` and `SPUUpdater`.
Please also visit the [Basic Setup](https://sparkle-project.org/documentation/) guide which shows how to instantiate an updater in a nib or how to create one programmatically.
+2 -2
View File
@@ -2,7 +2,7 @@
## XPC Services
XPC services in Sparkle are all optional, so the code involved in the services needs to be usable directly from the framework as well. For this to work well, if the class used in the XPC service takes a delegate, it must not be weakly referenced, so the retain cycle will have to be broken explicitly (via an explicit added invalidate method). dealloc also must not be implemented (do cleanup in custom invalidate method). As one may tell, a couple of the services are simply proxies (InstallerConnection, InstallerStatus), and I wish that didn't have to be the case -- it would be a burden to require a developer to set up a temporary exception with a specific bundle ID, and unsure how long that approach would work for in the future.
XPC services in Sparkle are all optional, so the code involved in the services needs to be usable directly from the framework as well. For this to work well, if the class used in the XPC service takes a delegate, it must not be weakly referenced, so the retain cycle will have to be broken explicitly (via an explicit added invalidate method). dealloc also must not be implemented (do cleanup in custom invalidate method). As one may tell, two of the services are simply proxies (InstallerConnection, InstallerStatus) -- we now recommend most developers to set up a temporary exception with their bundle ID rather than use these two services.
The protocols used in XPC services must also not adopt other protocols (i.e, one protocol inheriting from another protocol). This is because the XPC protocol decoder on older supported systems doesn't properly handle this case, and won't be able to find that methods exist on a class.
@@ -18,7 +18,7 @@ The original `SUUpdater` may have also been created to assist plug-ins and other
## Extensibility
This fork does not support subclassing classes internal (not exported) to Sparkle anymore. Doing so would be almost impossible to maintain into the future. Subclassing in general has been banned in this fork. Composition is prefered everywhere, even amongst the internal update drivers which were rewritten to follow a protocol oriented approach. The reason why composition is preferred is because it's easier to follow the flow of logic.
Sparkle 2.0 does not support subclassing classes internal (not exported) to Sparkle anymore. Doing so would be almost impossible to maintain into the future. Subclassing in general has been banned. Composition is prefered everywhere, even amongst the internal update drivers which were rewritten to follow a protocol oriented approach. The reason why composition is preferred is because it's easier to follow the flow of logic.
I hope the user driver API gives enough extensibility without someone wanting to create another fork.
-20
View File
@@ -1,20 +0,0 @@
PROJECT_NAME = Sparkle
PROJECT_NUMBER = 1.14.0
PROJECT_BRIEF = "A software update framework for macOS"
PROJECT_LOGO = Resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png
RECURSIVE = YES
INPUT = Sparkle
OUTPUT_DIRECTORY = Documentation
GENERATE_HTML = YES
GENERATE_LATEX = NO
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST = YES
GENERATE_TODOLIST = YES
ALPHABETICAL_INDEX = YES
QT_AUTOBRIEF = YES
WARN_IF_UNDOCUMENTED = NO
+3 -3
View File
@@ -13,9 +13,9 @@
### Launching the Installer
SPUCoreBasedUpdateDriver invokes SPUInstallerDriver's extraction method which invokes SUInstallerLauncher's launch installer method. The launcher can be inside a XPC service or running inside the updater/sparkle framework itself. The launcher XPC bundle includes a copy of the installer and agent application in its bundle so it can compute the path to them itself (instead of relying on the updater to pass the paths), which is for security trust reasons.
First, the launcher makes sure that if the updater delegate doesn't allow interaction, that installation can be done without interaction. If it can't, then the launcher fails. If the updater driver that invoked the launcher doesn't allow for interaction (in particular, the automatic/silent update driver does not allow interaction), then the launcher fails with a hint to try again with interaction enabled (in particular, with a UI based update driver). If this happens, the updater keeps a reference to the downloaded update and appcast item that is used for resuming with a UI based update driver later. The launcher in this case is telling that authorization can only be done if interaction is allowed from the driver, so the user can enter their password to start up the installer as root to install over a location that requires such privileges.
First, if the updater driver that invoked the launcher doesn't allow for interaction (in particular, the automatic/silent update driver does not allow interaction), then the launcher fails with a hint to try again with interaction enabled (in particular, with a UI based update driver). If this happens, the updater keeps a reference to the downloaded update and appcast item that is used for resuming with a UI based update driver later. The launcher in this case is telling that authorization can only be done if interaction is allowed from the driver, so the user can enter their password to start up the installer as root to install over a location that requires such privileges.
The launcher then looks for the installer and agent application first in its bundle's auxiliary directory path, and then its resources path. If the launcher is running inside a XPC service, the tools will be in the auxiliary path location, which allows the developer using the service to also code sign the tools. Once those paths are found, the launcher copies the progress agent application to a temporary cache location. The installer is not copied because it is a plain single executable that does not rely on external relative depedencies, whereas the agent application relies on bundle resources. This is important to consider because the old application may be moved around and removed when the installation process occurs. Leaving the installer inside its bundle also could leave it in a place the user doesn't necessarily have write privileges to.
The launcher then looks for the installer and agent application first in its bundle's auxiliary directory path. Once those paths are found, the launcher copies the progress agent application to a temporary cache location. The installer is not copied because it is a plain single executable that does not rely on external relative dependencies, whereas the agent application relies on bundle resources. This is important to consider because the old application may be moved around and removed when the installation process occurs. Leaving the installer inside its bundle also could leave it in a place the user doesn't necessarily have write privileges to.
The installer is first submitted. If it requires root privileges, it will ask for an admin user name and password. How it determines if root privileges are necessary is based on:
@@ -27,7 +27,7 @@ The installer makes sure, after extraction, that the expected installation type
If the user cancels submitting the installer on authorization (if it's required), the launcher aborts the installation process silently. If everything does alright, the progress agent application is submitted next. If either of the submissions fail, the installation fails and aborts, otherwise the launcher succeeds and its job is done. Note before the submissions are done, the jobs are removed from launchd, and the jobs are submitted in a way that act as "one-time" jobs. If they fail or succeed, the jobs aren't restarted, and the jobs aren't installed in a system location for launchd to attempt launching again.
The only argument passed to the installer is the host bundle identifier of the bundle to update. This bundle identifier is used so that the installer and updater know what Mach service to connect to for IPC. Everything else to the installer is sent via a XPC connection. The host bundle path is passed to the progress agent, which is just used for obtaining the bundle identifier, and for UI purposes (eg: displaying app icon and name when the app needs to show progress). The type of domain the installer is running in (user vs system) is also passed to the progress agent application so it can know which domain to use to connect to the installer.
The most important argument passed to the installer is the host bundle identifier of the bundle to update. This bundle identifier is used so that the installer and updater know what Mach service to connect to for IPC. Mostly everything else to the installer is sent via a XPC connection. The host bundle path is passed to the progress agent, which is just used for obtaining the bundle identifier, and for UI purposes (eg: displaying app icon and name when the app needs to show progress). The type of domain the installer is running in (user vs system) is also passed to the progress agent application so it can know which domain to use to connect to the installer.
### Timeouts
+4 -4
View File
@@ -6,7 +6,7 @@ First, some references I've found to be quite useful:
* [EvenBetterAuthorizationExample](https://developer.apple.com/library/mac/samplecode/EvenBetterAuthorizationSample/Introduction/Intro.html) sample code by Apple for showing off privileged authorization as well as in sandboxed applications.
* Apple's [Daemons and Agents Technote](https://developer.apple.com/library/mac/technotes/tn2083/_index.html). Outdated and before XPC existed, but insightful.
This fork puts a huge emphasis on splitting Sparkle into several components to achieve privilege separation.
Sparkle 2.0 puts a huge emphasis on splitting Sparkle into several components to achieve privilege separation.
* User Driver (Application; AppKit permitted)
* Updater Scheduler (Framework)
@@ -18,18 +18,18 @@ These achieve privilege separation, because at least theoretically, they can all
For XPC Services, it's significant to understand they can be used independent of sandboxing (although I wouldn't recommend this personally). Besides privilege separation, they also have an impact on fault tolerance and termination.
XPC Services also act inside an application bundle namespace, which is one of many reasons why they aren't bundled inside the framework. We have code that detects whether or not services are available inside the main bundle. This is simpler and more efficient than attempting to create a connection and wait for a timeout. We don't have *any* checks for seeing if the "current process" is sandboxed; doing so is a rather broken behavior. The XPC Services are important, not the sandboxing.
We have code that detects whether or not XPC services are available and enabled by the main application bundle. This is simpler and more efficient than attempting to create a connection and wait for a timeout. We don't have *any* checks for seeing if the "current process" is sandboxed; doing so is a rather broken behavior. The XPC Services are important, not the sandboxing.
I said above that XPC services are looked up in the main bundle. One may think this assumption doesn't hold for helpers or plug-ins inside applications. My response to that is they probably don't need the services, and they probably shoudn't be injecting Sparkle inside the host application anyway due to unintended conflicts and other consequences. A more appropriate approach may be to bundle a separate tool such as the sparkle command line utility.
The `InstallerLauncher` XPC service needs a `JoinExistingSession` key set to `YES` otherwise authorization will not work properly, and even less so on older systems. It took me forever to debug this, so it's worth mentioning.
When developing this fork, I still had a huge hole in the privilege separation even after supporting XPC Services and sandboxing. I fixed that by removing references to `AuthorizationExecuteWithPrivileges` and submitting a launchd agent/daemon for the installer. This is overlooked, but absolutely essential for our model to be secure.
When developing Sparkle 2.0, I still had a huge hole in the privilege separation even after supporting XPC Services and sandboxing. I fixed that by removing references to `AuthorizationExecuteWithPrivileges` and submitting a launchd agent/daemon for the installer. This is overlooked, but absolutely essential for our model to be secure.
When communicating to a launchd job, we've several options to use for IPC such as BSD Sockets, Mach ports, XPC (note: XPC is an IPC API and is != "XPC Services"), and file IO. The technote I linked above describes why Mach ports have user namespace issues and why BSD sockets may be preferred over them. However, now, XPC which allows you to choose which domain to look up is the simplest, best, and most modern choice. It's crucial in any event we don't have a daemon (running in system domain) try to *connect* to something in the user domain. Our launchd tasks should also be connected to rather than the other way around. As for communication via file IO, I just wouldn't go anywhere close to trusting such a model mixing in system and user running processes.
For sending Obj-C objects across the wire, we use `SPUSecureCoding` because Cocoa doesn't support sending objects securely out of the box unless working with XPC Services. It's very important the objects implement `NSSecureCoding` and whitelist types that are expected to be decoded, as well as whitelist types inside collections before decoding them.
The installer handles extraction, validation, and installation of the update. This was the main reason why other forks were rejected from being secure. The point to be stressed anyway is that these all need to be done in the same process; they can't be handed off by some other process. This is also why removing references to `AuthorizationExecuteWithPrivileges` is crucial as well.
The installer handles extraction, validation, and installation of the update. This was the main reason why other sandboxed-capable forks were rejected from being secure. The point to be stressed anyway is that these all need to be done in the same process; they can't be handed off by some other process. This is also why removing references to `AuthorizationExecuteWithPrivileges` is crucial as well.
Note that the installer does *not* handle downloading. That is handled by the updater framework. This is ideal because downloading can be done without disrupting the user, allowing it to be done silently without presenting an authorization dialog. The downloading portion of code can also be stuck into a XPC service with just an entitlement for allowing incoming connections. This also means for secure installations the installer cannot know (or trust) what protocol the update was downloaded from (i.e: http vs https). A good installer will not care, which is why applying updates without a DSA signature/key is now deprecated (reminder that Apple's code signature checks are not intended for complete integrity).
@@ -0,0 +1,29 @@
//
// SUInstallerLauncher+Private.h
// SUInstallerLauncher+Private
//
// Created by Mayur Pawashe on 8/21/21.
// Copyright © 2021 Sparkle Project. All rights reserved.
//
#ifndef SUInstallerLauncher_Private_h
#define SUInstallerLauncher_Private_h
#import <Sparkle/SUExport.h>
// Chances are clients will need this too
#import <Sparkle/SPUInstallationType.h>
@class NSString;
/**
Private API for determining if the system needs authorization access to update a bundle path
This API is not supported when used directly from a Sandboxed applications and will always return @c YES in that case.
@param bundlePath The bundle path to test if authorization is needed when performing an update that replaces this bundle.
@return @c YES if Sparkle thinks authorization is needed to update the @c bundlePath, otherwise @c NO.
*/
SU_EXPORT BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath);
#endif /* SUInstallerLauncher_Private_h */
+54 -54
View File
@@ -7,6 +7,7 @@
//
#import "SUInstallerLauncher.h"
#import "SUInstallerLauncher+Private.h"
#import "SUFileManager.h"
#import "SULog.h"
#import "SPUMessageTypes.h"
@@ -300,13 +301,21 @@
return status;
}
- (NSString *)pathForBundledTool:(NSString *)toolName extension:(NSString *)extension inBundle:(NSBundle *)bundle
- (NSString *)pathForBundledTool:(NSString *)toolName extension:(NSString *)extension fromBundle:(NSBundle *)bundle
{
// If the path extension is empty, we don't want to add a "." at the end
NSString *nameWithExtension = (extension.length > 0) ? [toolName stringByAppendingPathExtension:extension] : toolName;
assert(nameWithExtension != nil);
NSURL *auxiliaryToolURL = [bundle URLForAuxiliaryExecutable:nameWithExtension];
NSURL *auxiliaryToolURL;
if ([bundle.bundleURL.pathExtension isEqualToString:@"xpc"]) {
// Paranoid check to get full bundle URL
NSURL *fullURL = bundle.bundleURL.URLByResolvingSymlinksInPath;
auxiliaryToolURL = [fullURL.URLByDeletingLastPathComponent.URLByDeletingLastPathComponent URLByAppendingPathComponent:nameWithExtension];
} else {
auxiliaryToolURL = [bundle URLForAuxiliaryExecutable:nameWithExtension];
}
assert(auxiliaryToolURL != nil);
NSURL *resolvedAuxiliaryToolURL = [auxiliaryToolURL URLByResolvingSymlinksInPath];
@@ -315,7 +324,44 @@
return resolvedAuxiliaryToolURL.path;
}
static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installationType)
BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath)
{
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL hasWritability = [fileManager isWritableFileAtPath:bundlePath] && [fileManager isWritableFileAtPath:[bundlePath stringByDeletingLastPathComponent]];
BOOL needsAuthorization;
if (!hasWritability) {
needsAuthorization = YES;
} else {
// Just because we have writability access does not mean we can set the correct owner/group
// Test if we can set the owner/group on a temporarily created file
// If we can, then we can probably perform an update without authorization
NSString *tempFilename = @"permission_test" ;
SUFileManager *suFileManager = [[SUFileManager alloc] init];
NSURL *tempDirectoryURL = [suFileManager makeTemporaryDirectoryWithPreferredName:tempFilename appropriateForDirectoryURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] error:NULL];
if (tempDirectoryURL == nil) {
// I don't imagine this ever happening but in case it does, requesting authorization may be the better option
needsAuthorization = YES;
} else {
NSURL *tempFileURL = [tempDirectoryURL URLByAppendingPathComponent:tempFilename];
if (![[NSData data] writeToURL:tempFileURL atomically:NO]) {
// Obvious indicator we may need authorization
needsAuthorization = YES;
} else {
needsAuthorization = ![suFileManager changeOwnerAndGroupOfItemAtRootURL:tempFileURL toMatchURL:[NSURL fileURLWithPath:bundlePath] error:NULL];
}
[suFileManager removeItemAtURL:tempDirectoryURL error:NULL];
}
}
return needsAuthorization;
}
static BOOL SPUSystemNeedsAuthorizationAccess(NSString *path, NSString *installationType)
{
BOOL needsAuthorization;
if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
@@ -323,45 +369,17 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa
} else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
needsAuthorization = NO;
} else {
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL hasWritability = [fileManager isWritableFileAtPath:path] && [fileManager isWritableFileAtPath:[path stringByDeletingLastPathComponent]];
if (!hasWritability) {
needsAuthorization = YES;
} else {
// Just because we have writability access does not mean we can set the correct owner/group
// Test if we can set the owner/group on a temporarily created file
// If we can, then we can probably perform an update without authorization
NSString *tempFilename = @"permission_test" ;
SUFileManager *suFileManager = [[SUFileManager alloc] init];
NSURL *tempDirectoryURL = [suFileManager makeTemporaryDirectoryWithPreferredName:tempFilename appropriateForDirectoryURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] error:NULL];
if (tempDirectoryURL == nil) {
// I don't imagine this ever happening but in case it does, requesting authorization may be the better option
needsAuthorization = YES;
} else {
NSURL *tempFileURL = [tempDirectoryURL URLByAppendingPathComponent:tempFilename];
if (![[NSData data] writeToURL:tempFileURL atomically:NO]) {
// Obvious indicator we may need authorization
needsAuthorization = YES;
} else {
needsAuthorization = ![suFileManager changeOwnerAndGroupOfItemAtRootURL:tempFileURL toMatchURL:[NSURL fileURLWithPath:path] error:NULL];
}
[suFileManager removeItemAtURL:tempDirectoryURL error:NULL];
}
}
needsAuthorization = SPUSystemNeedsAuthorizationAccessForBundlePath(path);
}
return needsAuthorization;
}
// Note: do not pass untrusted information such as paths to the installer and progress agent tools, when we can find them ourselves here
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler
{
dispatch_async(dispatch_get_main_queue(), ^{
BOOL needsSystemAuthorization = SPUNeedsSystemAuthorizationAccess(hostBundlePath, installationType);
BOOL needsSystemAuthorization = SPUSystemNeedsAuthorizationAccess(hostBundlePath, installationType);
NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath];
if (hostBundle == nil) {
@@ -372,18 +390,6 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa
return;
}
if (needsSystemAuthorization && !allowingUpdaterInteraction) {
SULog(SULogLevelError, @"Updater is not allowing interaction to the launcher.");
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
return;
}
if (!allowingUpdaterInteraction && [installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
SULog(SULogLevelError, @"Updater is not allowing interaction to the launcher for performing an interactive type package installation.");
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
return;
}
// if we need to use the system domain and we aren't allowed interaction, then try sometime later when interaction is allowed
if (needsSystemAuthorization && !allowingDriverInteraction) {
completionHandler(SUInstallerLauncherAuthorizeLater, needsSystemAuthorization);
@@ -398,7 +404,7 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa
// Note we do not have to copy this tool out of the bundle it's in because it's a utility with no dependencies.
// Furthermore, we can keep the tool at a place that may not necessarily be writable.
NSString *installerPath = [self pathForBundledTool:@""SPARKLE_RELAUNCH_TOOL_NAME extension:@"" inBundle:ourBundle];
NSString *installerPath = [self pathForBundledTool:@""SPARKLE_RELAUNCH_TOOL_NAME extension:@"" fromBundle:ourBundle];
if (installerPath == nil) {
SULog(SULogLevelError, @"Error: Cannot submit installer because the installer could not be located");
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
@@ -406,7 +412,7 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa
}
// We do however have to copy the progress tool app somewhere safe due to its external depedencies
NSString *progressToolResourcePath = [self pathForBundledTool:@""SPARKLE_INSTALLER_PROGRESS_TOOL_NAME extension:@"app" inBundle:ourBundle];
NSString *progressToolResourcePath = [self pathForBundledTool:@""SPARKLE_INSTALLER_PROGRESS_TOOL_NAME extension:@"app" fromBundle:ourBundle];
if (progressToolResourcePath == nil) {
SULog(SULogLevelError, @"Error: Cannot submit progress tool because the progress tool could not be located");
@@ -462,10 +468,4 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa
});
}
- (void)checkIfApplicationInstallationRequiresAuthorizationWithHostBundlePath:(NSString *)hostBundlePath reply:(void(^)(BOOL))reply
{
// No need to execute on main queue
reply(SPUNeedsSystemAuthorizationAccess(hostBundlePath, SPUInstallationTypeApplication));
}
@end
@@ -11,8 +11,6 @@
@protocol SUInstallerLauncherProtocol
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterBundleIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler;
- (void)checkIfApplicationInstallationRequiresAuthorizationWithHostBundlePath:(NSString *)hostBundlePath reply:(void(^)(BOOL requiresAuthorization))reply;
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterBundleIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler;
@end
+1 -1
View File
@@ -25,7 +25,7 @@ build:
# Need to first gem install jazzy to run this rule
docs:
jazzy --objc --umbrella-header Sparkle/Sparkle.h --framework-root . --output Documentation/html
jazzy --author "Sparkle Project" --objc --umbrella-header Sparkle/Sparkle.h --framework-root . --readme Documentation/API_README.markdown --theme jony --output Documentation/html
uitest:
xcodebuild -scheme UITests -configuration Debug test
+3 -3
View File
@@ -2,10 +2,10 @@
import PackageDescription
// Version is technically not required here, SPM doesn't check
let version = "2.0.0-beta.1"
let version = "2.0.0-beta.4"
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
let tag = "2.0.0-beta.1"
let checksum = "389a58bc0b333d9d18c8fa2d72aacbf4905d5d59a9858ecd9a5b16ff769bb5c5"
let tag = "2.0.0-beta.4"
let checksum = "4f863dc048e8c4170e0c3fdbdb9a9b03af605adbd778aa11799db3f34068202d"
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
let package = Package(
+14 -20
View File
@@ -1,40 +1,41 @@
# Sparkle 2 (Beta) ![Build Status](https://github.com/sparkle-project/Sparkle/workflows/Build%20%26%20Tests/badge.svg?branch=2.x) <a href="https://www.stackpath.com/?utm_source=sparkle-github&amp;utm_medium=badge&amp;utm_campaign=readme"><img src="https://img.shields.io/badge/sponsored%20by-StackPath-orange.svg" alt="sponsored by: StackPath"></a>
# Sparkle 2 (Beta) ![Build Status](https://github.com/sparkle-project/Sparkle/workflows/Build%20%26%20Tests/badge.svg?branch=2.x) [![CocoaPods](https://img.shields.io/cocoapods/v/Sparkle.svg?cacheSeconds=86400)]()
Secure and reliable software update framework for Cocoa developers.
Secure and reliable software update framework for macOS.
<img src="Resources/Screenshot.png" width="732" alt="Sparkle shows familiar update window with release notes">
This is the upcoming new version of Sparkle.
Major new features are support for sandboxing, custom user interfaces, updating external bundles, and a more modern secure architecture which includes faster and more reliable installs.
Major new features are support for sandboxing, custom user interfaces, updating external bundles, and a more modern architecture which includes faster and more reliable installs.
For the production ready version of Sparkle, please see the [Sparkle 1.x (master) branch](https://github.com/sparkle-project/Sparkle/tree/master). Note development has shifted to Sparkle 2 and the 1.x branch is now only accepting bug fixes, localization updates, and adoption of critical upcoming OS features.
Sparkle 2 is currently in beta. Applications, typically sandboxed, have already been using it in production, but some work including testing is still required before an official version can be released. In the meantime, a nightly build can be downloaded by selecting a recent [workflow run](https://github.com/sparkle-project/Sparkle/actions?query=event%3Apush+is%3Asuccess+branch%3A2.x) and downloading the corresponding Sparkle-distribution artifact. The current status of Sparkle 2 is tracked in issue [#1523](https://github.com/sparkle-project/Sparkle/issues/1523).
Sparkle 2 is currently in beta. Applications, typically sandboxed, have already been using it in production, but some work including testing is still required before an official version can be released. Pre-releases can be found on the [Sparkle's Releases](https://github.com/sparkle-project/Sparkle/releases). More nightly builds can be downloaded by selecting a recent [workflow run](https://github.com/sparkle-project/Sparkle/actions?query=event%3Apush+is%3Asuccess+branch%3A2.x) and downloading the corresponding Sparkle-distribution artifact.
The current status of Sparkle 2 is tracked by [its roadmap](https://github.com/sparkle-project/Sparkle/milestone/2).
If you can help with testing or reviewing over the new changes, please report issues or submit pull requests!
New issues should be [reported here](https://github.com/sparkle-project/Sparkle/issues). Internal design documents can be found in [Documentation](Documentation/).
Please visit [Sparkle's website](http://sparkle-project.org) for up to date documentation on using and migrating over to Sparkle 2. Refer to [Changelog](CHANGELOG) for a more detailed list of changes.
Please visit [Sparkle's website](http://sparkle-project.org) for up to date documentation on using and migrating over to Sparkle 2. Refer to [Changelog](CHANGELOG) for a more detailed list of changes. More internal design documents can be found in [Documentation](Documentation/).
## Features
* Seamless. There's no mention of Sparkle; your icons and app name are used.
* Secure. Updates are verified using EdDSA signatures and Apple Code Signing.
* Fast. Supports delta updates which only patch files that have changed.
* Secure. Updates are verified using EdDSA signatures and Apple Code Signing. Supports Sandboxed applications in Sparkle 2.
* Fast. Supports delta updates which only patch files that have changed and atomic-safe installs.
* Easy to install. Sparkle requires no code in your app, and only needs static files on a web server.
* Supports bundles, preference panes, plugins, and other non-.app software. Can install .pkg files for more complicated products.
* Handles permissions, quarantine and automatically asks for authentication if needed.
* Customizable. Sparkle 2 supports plugging in a custom UI for updates.
* Supports applications, package installers, preference panes, and other plug-ins.
* Handles permissions, quarantine, and automatically asks for authentication if needed.
* Uses RSS-based appcasts for release information. Appcasts are a de-facto standard supported by 3rd party update-tracking programs and websites.
* Stays hidden until second launch for better first impressions.
* Truly self-updating — the user can choose to automatically download and install all updates in the background.
* Ability to mark updates as critical.
* Ability to use channels for beta updates (in Sparkle 2), add phased rollouts to users, and mark updates as critical or major.
* Progress and status notifications for the host app.
## Requirements
* Runtime: macOS 10.11 or greater
* Build: Latest major Xcode (stable or beta, whichever is latest) and one major version less; at least Xcode 12 if using Swift Package Manager.
* Build: Latest major Xcode (stable or beta, whichever is latest) and one major version less.
* HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/))
## Usage
@@ -46,7 +47,6 @@ See [getting started guide](https://sparkle-project.org/documentation/). No code
This repository uses git submodules, and will not build unless you clone recursively. Also, GitHub-provided ZIP/tar archives are broken due to GitHub not supporting git submodules properly.
git clone https://github.com/sparkle-project/Sparkle
git checkout 2.x
git submodule update --init --recursive
### Troubleshooting
@@ -57,8 +57,6 @@ This repository uses git submodules, and will not build unless you clone recursi
* Make sure the URL specified in [`SUFeedURL`](https://sparkle-project.org/documentation/customization/) is valid (typos/404s are a common error!), and that it uses modern TLS ([test it](https://www.ssllabs.com/ssltest/)).
* Delete your app's preferences (in `~/Library/Preferences/<your bundle id>`) if you've set another feed URL programmatically via Sparkle's Objective-C interface.
### API symbols
Sparkle is built with `-fvisibility=hidden -fvisibility-inlines-hidden` which means no symbols are exported by default.
@@ -73,7 +71,3 @@ Alternatively, build the Distribution scheme in the Xcode UI.
### Code of Conduct
We pledge to have an open and welcoming environment. See our [Code of Conduct](CODE_OF_CONDUCT.md).
## Project Sponsor
[StackPath](https://www.stackpath.com/?utm_source=sparkle-github&utm_medium=link&utm_campaign=readme-footer)
+9
View File
@@ -11,6 +11,9 @@
<sparkle:releaseNotesLink>
https://you.com/app/2.0.html
</sparkle:releaseNotesLink>
<sparkle:fullReleaseNotesLink>
https://you.com/app/changelog.php
</sparkle:fullReleaseNotesLink>
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
<enclosure url="https://you.com/app/Your%20Great%20App%202.0.zip" length="1623481" type="application/octet-stream" sparkle:edSignature="WVyVJpOx+a5+vNWJVY79TRjFKveNk+VhGJf2iti4CZtJsJewIUGvh/1AKKEAFbH1qUwx+vro1ECuzOsMmumoBA==" />
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
@@ -23,6 +26,9 @@
<sparkle:releaseNotesLink>
https://you.com/app/1.5.html
</sparkle:releaseNotesLink>
<sparkle:fullReleaseNotesLink>
https://you.com/app/changelog.php?up-to=1.5
</sparkle:fullReleaseNotesLink>
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
<enclosure url="https://you.com/app/Your%20Great%20App%201.5.zip" length="1472893" type="application/octet-stream" sparkle:edSignature="pNFd7KbcQSu+Mq7UYrbQXTPq82luht2ACXm/r2utp1u/Uv/5hWqctdT2jwQgMejW7DRoeV/hVr6J4VdZYdwWDw==" />
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
@@ -35,6 +41,9 @@
<sparkle:releaseNotesLink>
https://you.com/app/1.4.html
</sparkle:releaseNotesLink>
<sparkle:fullReleaseNotesLink>
https://you.com/app/changelog.php?up-to=1.4
</sparkle:fullReleaseNotesLink>
<sparkle:version>241</sparkle:version>
<sparkle:shortVersionString>1.4</sparkle:shortVersionString>
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
+10 -10
View File
@@ -1,17 +1,17 @@
Pod::Spec.new do |s|
s.name = "Sparkle"
s.version = "2.0.0-beta.1"
s.version = "2.0.0-beta.4"
s.summary = "A software update framework for macOS"
s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers."
s.homepage = "http://sparkle-project.org"
s.documentation_url = "http://sparkle-project.org/documentation/"
s.screenshot = "http://sparkle-project.org/images/screenshot-noshadow@2x.png"
s.description = "Sparkle is an easy-to-use software update framework for macOS."
s.homepage = "https://sparkle-project.org"
s.documentation_url = "https://sparkle-project.org/documentation/"
s.screenshot = "https://sparkle-project.org/images/screenshot-noshadow@2x.png"
s.license = {
:type => 'MIT',
:file => 'LICENSE'
}
s.authors = {
'Mayur Pawashe' => 'zorgiepoo@gmail.com',
'Zorg' => 'zorgiepoo@gmail.com',
'Kornel Lesiński' => 'pornel@pornel.net',
'Jake Petroules' => 'jake.petroules@petroules.com',
'C.W. Betts' => 'computers57@hotmail.com',
@@ -19,11 +19,11 @@ Pod::Spec.new do |s|
}
s.platform = :osx, '10.11'
s.source = { :http => "https://github.com/sparkle-project/Sparkle/releases/download/#{s.version}/Sparkle-#{s.version}.tar.bz2" }
s.source_files = 'Sparkle.framework/Versions/A/Headers/*.h'
s.source = { :http => "https://github.com/sparkle-project/Sparkle/releases/download/#{s.version}/Sparkle-#{s.version}.tar.xz" }
s.source_files = 'Sparkle.framework/Versions/B/Headers/*.h'
s.preserve_paths = 'bin/*'
s.public_header_files = 'Sparkle.framework/Versions/A/Headers/*.h'
s.preserve_paths = ['bin/*', 'Symbols']
s.public_header_files = 'Sparkle.framework/Versions/B/Headers/*.h'
s.vendored_frameworks = 'Sparkle.framework'
s.xcconfig = {
'FRAMEWORK_SEARCH_PATHS' => '"${PODS_ROOT}/Sparkle"',
+110 -139
View File
@@ -107,6 +107,10 @@
61EF67560E25B58D00F754E0 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; };
61EF67590E25C5B400F754E0 /* SUHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 61EF67580E25C5B400F754E0 /* SUHost.h */; };
7202DC9A269ABD3500737EC4 /* testappcast_phasedRollout.xml in Resources */ = {isa = PBXBuildFile; fileRef = 7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */; };
72045CE026FEE535004F96E5 /* org.sparkle-project.Downloader.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07EF1CAF37BD001A286B /* org.sparkle-project.Downloader.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
72045CE126FEE535004F96E5 /* org.sparkle-project.InstallerConnection.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB36C1D31D0B7005D534A /* org.sparkle-project.InstallerConnection.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
72045CE226FEE535004F96E5 /* org.sparkle-project.InstallerLauncher.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07AD1CAF08D6001A286B /* org.sparkle-project.InstallerLauncher.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
72045CE326FEE535004F96E5 /* org.sparkle-project.InstallerStatus.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB3931D333832005D534A /* org.sparkle-project.InstallerStatus.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
720595EF1D700568000572E8 /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
7205C4411E13049400E370AE /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4401E13049400E370AE /* main.swift */; };
7205C44C1E1304CE00E370AE /* Appcast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4471E1304CE00E370AE /* Appcast.swift */; };
@@ -157,9 +161,7 @@
721D5ABC25C680A300D23BEA /* SUFlatPackageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 721D5A8425C65D3F00D23BEA /* SUFlatPackageUnarchiver.m */; };
721D5B1B25C692BB00D23BEA /* SUFlatPackageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 721D5A8425C65D3F00D23BEA /* SUFlatPackageUnarchiver.m */; };
721D8A611D48413B0032E472 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
721D8A721D4950B80032E472 /* Autoupdate in Copy Tools */ = {isa = PBXBuildFile; fileRef = 72B398D21D3D879300EE297F /* Autoupdate */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
721D8A7B1D4963190032E472 /* SPULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SPULocalCacheDirectory.m */; };
721D8A811D498B9B0032E472 /* Updater.app in Copy Tools */ = {isa = PBXBuildFile; fileRef = 721C24451CB753E6005440CB /* Updater.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
721D8A861D4ADFEB0032E472 /* SPULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SPULocalCacheDirectory.m */; };
721D8A871D4C5BF10032E472 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
722545B626805FF80036465C /* testappcast_info_updates.xml in Resources */ = {isa = PBXBuildFile; fileRef = 722545B526805FF80036465C /* testappcast_info_updates.xml */; };
@@ -323,6 +325,7 @@
7293A1AF1CEE933800B957A7 /* SPUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */; };
7293A1B11CEE9B9F00B957A7 /* SPUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */; };
729924941DF4A45000DBCDF5 /* SUUpdateValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 729924931DF4A45000DBCDF5 /* SUUpdateValidator.m */; };
729F7EAC27366353004592DC /* test-links.xml in Resources */ = {isa = PBXBuildFile; fileRef = 729F7EAB27366353004592DC /* test-links.xml */; };
72A1C2631CD6849C004CD282 /* SUUpdatePermissionPrompt.h in Headers */ = {isa = PBXBuildFile; fileRef = 612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */; };
72A450531C69A68900D67EEA /* SUUpdatePermissionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 72A450511C69A68900D67EEA /* SUUpdatePermissionResponse.h */; settings = {ATTRIBUTES = (Public, ); }; };
72A450541C69A68900D67EEA /* SUUpdatePermissionResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 72A450521C69A68900D67EEA /* SUUpdatePermissionResponse.m */; };
@@ -370,6 +373,9 @@
72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */; };
72EB87EB1CB8859100C37F42 /* Updater.app in Copy Tools */ = {isa = PBXBuildFile; fileRef = 721C24451CB753E6005440CB /* Updater.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; };
72EE17FB26D1CC8800C58B19 /* SUInstallerLauncher+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EE17FA26D1CBC000C58B19 /* SUInstallerLauncher+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
72EE17FC26D1CC9D00C58B19 /* SPUInstallationType.h in Headers */ = {isa = PBXBuildFile; fileRef = 7214B8851D45AD9A00CB5CED /* SPUInstallationType.h */; settings = {ATTRIBUTES = (Private, ); }; };
72EE181926DAE70900C58B19 /* SPUUpdateCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EE181826DAE6E100C58B19 /* SPUUpdateCheck.h */; settings = {ATTRIBUTES = (Public, ); }; };
72EF30BE2675CF38008CE987 /* SPUAppcastItemStateResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EF30BA2675CF38008CE987 /* SPUAppcastItemStateResolver.h */; settings = {ATTRIBUTES = (Private, ); }; };
72EF30BF2675CF38008CE987 /* SPUAppcastItemState.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EF30BB2675CF38008CE987 /* SPUAppcastItemState.m */; };
72EF30C02675CF38008CE987 /* SPUAppcastItemStateResolver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EF30BC2675CF38008CE987 /* SPUAppcastItemStateResolver.m */; };
@@ -382,7 +388,6 @@
72F94F581CC44DE1002DEE68 /* SPUXPCServiceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F94F561CC44DE1002DEE68 /* SPUXPCServiceInfo.h */; };
72F94F591CC44DE1002DEE68 /* SPUXPCServiceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F94F571CC44DE1002DEE68 /* SPUXPCServiceInfo.m */; };
72F94F5A1CC450DE002DEE68 /* SUInstallerLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */; };
72F94F5D1CC455B4002DEE68 /* org.sparkle-project.InstallerLauncher.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07AD1CAF08D6001A286B /* org.sparkle-project.InstallerLauncher.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
72F9EBE21D517E2F004AC8B6 /* SUUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F9EBE01D517E2F004AC8B6 /* SUUpdater.h */; settings = {ATTRIBUTES = (Public, ); }; };
72F9EBE31D517E2F004AC8B6 /* SUUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EBE11D517E2F004AC8B6 /* SUUpdater.m */; };
72F9EC341D5BF542004AC8B6 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; };
@@ -526,6 +531,34 @@
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
remoteInfo = Sparkle;
};
72045CD726FEE471004F96E5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 726E07EE1CAF37BD001A286B;
remoteInfo = SparkleDownloader;
};
72045CD926FEE471004F96E5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 724BB36B1D31D0B7005D534A;
remoteInfo = SparkleInstallerConnection;
};
72045CDB26FEE471004F96E5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 726E07AC1CAF08D6001A286B;
remoteInfo = SparkleInstallerLauncher;
};
72045CDD26FEE471004F96E5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 724BB3921D333832005D534A;
remoteInfo = SparkleInstallerStatus;
};
7205C4681E1306FB00E370AE /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -554,20 +587,6 @@
remoteGlobalIDString = 724BB3921D333832005D534A;
remoteInfo = SparkleInstallerStatus;
};
721D8A771D4952B60032E472 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 72B398D11D3D879300EE297F;
remoteInfo = Autoupdate;
};
721D8A791D4952B60032E472 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 721C24441CB753E6005440CB;
remoteInfo = "Installer Progress";
};
725148E8266D918900247C9C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -624,13 +643,6 @@
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
remoteInfo = Sparkle;
};
72F94F611CC48669002DEE68 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 726E07AC1CAF08D6001A286B;
remoteInfo = SparkleInstallerLauncher;
};
72F94F6A1CC4A0C8002DEE68 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -696,6 +708,20 @@
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
72045CDF26FEE51D004F96E5 /* Copy XPC Services */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
dstSubfolderSpec = 16;
files = (
72045CE026FEE535004F96E5 /* org.sparkle-project.Downloader.xpc in Copy XPC Services */,
72045CE126FEE535004F96E5 /* org.sparkle-project.InstallerConnection.xpc in Copy XPC Services */,
72045CE226FEE535004F96E5 /* org.sparkle-project.InstallerLauncher.xpc in Copy XPC Services */,
72045CE326FEE535004F96E5 /* org.sparkle-project.InstallerStatus.xpc in Copy XPC Services */,
);
name = "Copy XPC Services";
runOnlyForDeploymentPostprocessing = 0;
};
7205C43C1E13049400E370AE /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -705,25 +731,12 @@
);
runOnlyForDeploymentPostprocessing = 1;
};
721D8A711D4950910032E472 /* Copy Tools */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 6;
files = (
721D8A721D4950B80032E472 /* Autoupdate in Copy Tools */,
721D8A811D498B9B0032E472 /* Updater.app in Copy Tools */,
);
name = "Copy Tools";
runOnlyForDeploymentPostprocessing = 0;
};
726E4A261C86C88F00C57C6A /* Embed XPC Services */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
dstSubfolderSpec = 16;
files = (
72F94F5D1CC455B4002DEE68 /* org.sparkle-project.InstallerLauncher.xpc in Embed XPC Services */,
726E4A211C86C88F00C57C6A /* TestAppHelper.xpc in Embed XPC Services */,
);
name = "Embed XPC Services";
@@ -804,7 +817,6 @@
0263187214FEBB31005EBF43 /* uk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Sparkle.strings; sourceTree = "<group>"; };
0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
1420DF4E196247B500203BB0 /* Doxyfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Doxyfile; sourceTree = "<group>"; };
1420DF4F196247F900203BB0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
142E0E0819A83AAC00E4312B /* SUBinaryDeltaTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaTest.m; sourceTree = "<group>"; };
14652F7919A93E5F00959E44 /* set-git-version-info.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "set-git-version-info.sh"; sourceTree = "<group>"; };
@@ -909,6 +921,7 @@
61F3AC1215C22D4A00260CA2 /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/Sparkle.strings; sourceTree = "<group>"; };
61F614540E24A12D009F47E7 /* it */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Sparkle.strings; sourceTree = "<group>"; };
7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_phasedRollout.xml; sourceTree = "<group>"; };
72045CE426FEE708004F96E5 /* strip-xpc-services.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "strip-xpc-services.sh"; sourceTree = "<group>"; };
7205C43E1E13049400E370AE /* generate_appcast */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = generate_appcast; sourceTree = BUILT_PRODUCTS_DIR; };
7205C4401E13049400E370AE /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
7205C4461E1304C300E370AE /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
@@ -928,6 +941,7 @@
720B16421C66433D006985FB /* UITests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "UITests-Info.plist"; path = "UITests/UITests-Info.plist"; sourceTree = SOURCE_ROOT; };
720B16431C66433D006985FB /* SUTestApplicationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SUTestApplicationTest.swift; path = UITests/SUTestApplicationTest.swift; sourceTree = SOURCE_ROOT; };
720B4C2325EBFAFD005A0592 /* link-tools.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "link-tools.sh"; sourceTree = "<group>"; };
720C192827127A3800740C8E /* release-move-tag.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "release-move-tag.sh"; sourceTree = "<group>"; };
720E21791D0D00BF003A311C /* SPUUpdaterCycle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUUpdaterCycle.h; sourceTree = "<group>"; };
720E217A1D0D00BF003A311C /* SPUUpdaterCycle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUUpdaterCycle.m; sourceTree = "<group>"; };
7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = "<group>"; };
@@ -938,7 +952,6 @@
721652671D3C8FED00FD13D8 /* SUInstallerLauncherStatus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerLauncherStatus.h; path = InstallerLauncher/SUInstallerLauncherStatus.h; sourceTree = SOURCE_ROOT; };
7218EC362623F31C008FECF3 /* org.sparkle-project.InstallerConnection.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "org.sparkle-project.InstallerConnection.entitlements"; sourceTree = "<group>"; };
7218EC372623F32E008FECF3 /* org.sparkle-project.InstallerStatus.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "org.sparkle-project.InstallerStatus.entitlements"; sourceTree = "<group>"; };
7218EC4B2623F51C008FECF3 /* codesign_xpc_service.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = codesign_xpc_service.py; sourceTree = "<group>"; };
721AB11626C777D900D34A86 /* SPUDownloadDataPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUDownloadDataPrivate.h; sourceTree = "<group>"; };
721BC2061D17A532002BC71E /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
721BC2081D17A553002BC71E /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
@@ -1108,6 +1121,7 @@
724BB3B51D35AAC3005D534A /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; };
725602D31C83551C00DAA70E /* SUApplicationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUApplicationInfo.h; sourceTree = "<group>"; };
725602D41C83551C00DAA70E /* SUApplicationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUApplicationInfo.m; sourceTree = "<group>"; };
72563CA9272E1C5400AF39F0 /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = "<group>"; };
725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_minimumAutoupdateVersion.xml; sourceTree = "<group>"; };
725CB9561C7120410064365A /* SPUUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUUserDriver.h; sourceTree = "<group>"; };
725CB9581C7121830064365A /* SPUStandardUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUStandardUserDriver.h; sourceTree = "<group>"; };
@@ -1214,6 +1228,7 @@
729BB3D11D503826007C4276 /* org.sparkle-project.Downloader.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = "org.sparkle-project.Downloader.entitlements"; path = "Downloader/org.sparkle-project.Downloader.entitlements"; sourceTree = SOURCE_ROOT; };
729F10FD1C65A9B500DFCCC5 /* ConfigUITest.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITest.xcconfig; sourceTree = "<group>"; };
729F10FE1C65A9B500DFCCC5 /* ConfigUITestCoverage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestCoverage.xcconfig; sourceTree = "<group>"; };
729F7EAB27366353004592DC /* test-links.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "test-links.xml"; sourceTree = "<group>"; };
72A450511C69A68900D67EEA /* SUUpdatePermissionResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdatePermissionResponse.h; sourceTree = "<group>"; };
72A450521C69A68900D67EEA /* SUUpdatePermissionResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdatePermissionResponse.m; sourceTree = "<group>"; };
72A4A23F1BB6567D00E7820D /* SUFileManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUFileManagerTest.swift; sourceTree = "<group>"; };
@@ -1274,6 +1289,8 @@
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUUpdateSettingsWindowController.xib; sourceTree = "<group>"; };
72E45CFB1B641961005C701A /* sparkletestcast.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sparkletestcast.xml; sourceTree = "<group>"; };
72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ShowInstallerProgress.m; path = Sparkle/InstallerProgress/ShowInstallerProgress.m; sourceTree = SOURCE_ROOT; };
72EE17FA26D1CBC000C58B19 /* SUInstallerLauncher+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SUInstallerLauncher+Private.h"; sourceTree = "<group>"; };
72EE181826DAE6E100C58B19 /* SPUUpdateCheck.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUUpdateCheck.h; sourceTree = "<group>"; };
72EF30BA2675CF38008CE987 /* SPUAppcastItemStateResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUAppcastItemStateResolver.h; sourceTree = "<group>"; };
72EF30BB2675CF38008CE987 /* SPUAppcastItemState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUAppcastItemState.m; sourceTree = "<group>"; };
72EF30BC2675CF38008CE987 /* SPUAppcastItemStateResolver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUAppcastItemStateResolver.m; sourceTree = "<group>"; };
@@ -1548,6 +1565,7 @@
14732BB51960ECBA00593899 /* Vendor */,
1420DE391962322200203BB0 /* Documentation */,
FA1941C40D94A6EA00DD942E /* Configurations */,
72563CA9272E1C5400AF39F0 /* .github */,
726B2B5E1C645FC900388755 /* UI Tests */,
0867D69AFE84028FC02AAC07 /* Frameworks */,
034768DFFF38A50411DB9C8B /* Products */,
@@ -1599,7 +1617,6 @@
1420DE391962322200203BB0 /* Documentation */ = {
isa = PBXGroup;
children = (
1420DF4E196247B500203BB0 /* Doxyfile */,
721D8A891D4D273E0032E472 /* Internal */,
);
path = Documentation;
@@ -1694,6 +1711,7 @@
5F1510A11C96E591006E1629 /* testnamespaces.xml */,
FA30773C24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml */,
5A5DD41B249F0F4B0045EB3E /* test-relative-urls.xml */,
729F7EAB27366353004592DC /* test-links.xml */,
5A5DD40324958AFF0045EB3E /* SUUpdateValidatorTest */,
);
path = Resources;
@@ -1957,6 +1975,7 @@
720E21791D0D00BF003A311C /* SPUUpdaterCycle.h */,
720E217A1D0D00BF003A311C /* SPUUpdaterCycle.m */,
72F9EC471D5EA7D3004AC8B6 /* SPUUpdaterDelegate.h */,
72EE181826DAE6E100C58B19 /* SPUUpdateCheck.h */,
726E078B1CA891E9001A286B /* SPUUpdaterSettings.h */,
726E078C1CA891E9001A286B /* SPUUpdaterSettings.m */,
72F9EC3D1D5E823F004AC8B6 /* SPUUpdaterTimer.h */,
@@ -2091,6 +2110,7 @@
726E07B51CAF08D6001A286B /* Info.plist */,
726E07B31CAF08D6001A286B /* main.m */,
726E07B01CAF08D6001A286B /* SUInstallerLauncher.h */,
72EE17FA26D1CBC000C58B19 /* SUInstallerLauncher+Private.h */,
726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */,
726E07AF1CAF08D6001A286B /* SUInstallerLauncherProtocol.h */,
721652671D3C8FED00FD13D8 /* SUInstallerLauncherStatus.h */,
@@ -2303,8 +2323,9 @@
EA1E285722B6622E004AA304 /* ed25519-Release.xcconfig */,
EA1E285922B6622E004AA304 /* ed25519-Shared.xcconfig */,
14732BC91960F70A00593899 /* make-release-package.sh */,
7218EC4B2623F51C008FECF3 /* codesign_xpc_service.py */,
14652F7919A93E5F00959E44 /* set-git-version-info.sh */,
72045CE426FEE708004F96E5 /* strip-xpc-services.sh */,
720C192827127A3800740C8E /* release-move-tag.sh */,
720B4C2325EBFAFD005A0592 /* link-tools.sh */,
146EC84E19A68CF8004A50C5 /* Sparkle.podspec */,
);
@@ -2327,6 +2348,7 @@
7229E1BD1C98EFF200CB50D0 /* SPUDownloadDriver.h in Headers */,
7267E5FD1D3DD1B700D1BF90 /* SPUResumableUpdate.h in Headers */,
7267E5B61D3D8AEE00D1BF90 /* SPUInstallationInfo.h in Headers */,
72EE181926DAE70900C58B19 /* SPUUpdateCheck.h in Headers */,
72B767CE1C9B924900A07552 /* SPUInstallerDriver.h in Headers */,
723ABF30259D062F00BDB4FA /* SULegacyWebView.h in Headers */,
721BC20E1D1CDE55002BC71E /* SPULocalCacheDirectory.h in Headers */,
@@ -2339,8 +2361,10 @@
7246E0A31C83B685003B4E75 /* SPUStandardUpdaterController.h in Headers */,
725CB95A1C7121830064365A /* SPUStandardUserDriver.h in Headers */,
726E4A371C89116000C57C6A /* SPUStandardUserDriverDelegate.h in Headers */,
72EE17FC26D1CC9D00C58B19 /* SPUInstallationType.h in Headers */,
72EF30BE2675CF38008CE987 /* SPUAppcastItemStateResolver.h in Headers */,
72EF30C7267C716A008CE987 /* SUAppcastItem+Private.h in Headers */,
72EE17FB26D1CC8800C58B19 /* SUInstallerLauncher+Private.h in Headers */,
61299A5C09CA6D4500B7442F /* SUConstants.h in Headers */,
726DF88E1C84277600188804 /* SPUUserUpdateState.h in Headers */,
72B767DA1C9CD2E400A07552 /* SPUUIBasedUpdateDriver.h in Headers */,
@@ -2474,7 +2498,6 @@
);
dependencies = (
61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */,
72F94F621CC48669002DEE68 /* PBXTargetDependency */,
726E4A201C86C88F00C57C6A /* PBXTargetDependency */,
);
name = "Sparkle Test App";
@@ -2526,7 +2549,6 @@
724BB3681D31D0B7005D534A /* Sources */,
724BB3691D31D0B7005D534A /* Frameworks */,
724BB36A1D31D0B7005D534A /* Resources */,
7269E49E264919CD0088C213 /* Run Script: Set Git Version Info */,
);
buildRules = (
);
@@ -2544,7 +2566,6 @@
724BB38F1D333832005D534A /* Sources */,
724BB3901D333832005D534A /* Frameworks */,
724BB3911D333832005D534A /* Resources */,
7269E49F264919D40088C213 /* Run Script: Set Git Version Info */,
);
buildRules = (
);
@@ -2579,14 +2600,10 @@
buildPhases = (
726E07A91CAF08D6001A286B /* Sources */,
726E07AA1CAF08D6001A286B /* Frameworks */,
721D8A711D4950910032E472 /* Copy Tools */,
7269E49D264919C20088C213 /* Run Script: Set Git Version Info */,
);
buildRules = (
);
dependencies = (
721D8A781D4952B60032E472 /* PBXTargetDependency */,
721D8A7A1D4952B60032E472 /* PBXTargetDependency */,
);
name = SparkleInstallerLauncher;
productName = InstallerLauncher;
@@ -2600,7 +2617,6 @@
726E07EB1CAF37BD001A286B /* Sources */,
726E07EC1CAF37BD001A286B /* Frameworks */,
726E07ED1CAF37BD001A286B /* Resources */,
7269E4A0264919D90088C213 /* Run Script: Set Git Version Info */,
);
buildRules = (
);
@@ -2673,6 +2689,8 @@
8DC2EF500486A6940098B216 /* Headers */,
8DC2EF520486A6940098B216 /* Resources */,
142E0E0319A6A24100E4312B /* Copy Tools */,
72045CDF26FEE51D004F96E5 /* Copy XPC Services */,
72045CE626FEE8CC004F96E5 /* Strip XPC Services */,
8DC2EF540486A6940098B216 /* Sources */,
8DC2EF560486A6940098B216 /* Frameworks */,
6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */,
@@ -2681,6 +2699,10 @@
buildRules = (
);
dependencies = (
72045CD826FEE471004F96E5 /* PBXTargetDependency */,
72045CDA26FEE471004F96E5 /* PBXTargetDependency */,
72045CDC26FEE471004F96E5 /* PBXTargetDependency */,
72045CDE26FEE471004F96E5 /* PBXTargetDependency */,
72A5D5AC1D6929260009E5AC /* PBXTargetDependency */,
72D954BA1CBB6E27006F28BD /* PBXTargetDependency */,
);
@@ -2954,6 +2976,7 @@
722545B626805FF80036465C /* testappcast_info_updates.xml in Resources */,
7202DC9A269ABD3500737EC4 /* testappcast_phasedRollout.xml in Resources */,
5F1510A21C96E591006E1629 /* testnamespaces.xml in Resources */,
729F7EAC27366353004592DC /* test-links.xml in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3052,6 +3075,24 @@
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n";
showEnvVarsInLog = 0;
};
72045CE626FEE8CC004F96E5 /* Strip XPC Services */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Strip XPC Services";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$SRCROOT/Configurations/strip-xpc-services.sh\"\n";
};
720B4C2125EBFAA5005A0592 /* Run Script: Link Tools */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -3070,78 +3111,6 @@
shellPath = /bin/sh;
shellScript = "\"$SRCROOT/Configurations/link-tools.sh\"\n";
};
7269E49D264919C20088C213 /* Run Script: Set Git Version Info */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script: Set Git Version Info";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n";
};
7269E49E264919CD0088C213 /* Run Script: Set Git Version Info */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script: Set Git Version Info";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n";
};
7269E49F264919D40088C213 /* Run Script: Set Git Version Info */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script: Set Git Version Info";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n";
};
7269E4A0264919D90088C213 /* Run Script: Set Git Version Info */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script: Set Git Version Info";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n";
};
895C5DC524D78E460058A82D /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -3589,6 +3558,26 @@
target = 8DC2EF4F0486A6940098B216 /* Sparkle */;
targetProxy = 61FA528C0E2D9EB200EF58AD /* PBXContainerItemProxy */;
};
72045CD826FEE471004F96E5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 726E07EE1CAF37BD001A286B /* SparkleDownloader */;
targetProxy = 72045CD726FEE471004F96E5 /* PBXContainerItemProxy */;
};
72045CDA26FEE471004F96E5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 724BB36B1D31D0B7005D534A /* SparkleInstallerConnection */;
targetProxy = 72045CD926FEE471004F96E5 /* PBXContainerItemProxy */;
};
72045CDC26FEE471004F96E5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 726E07AC1CAF08D6001A286B /* SparkleInstallerLauncher */;
targetProxy = 72045CDB26FEE471004F96E5 /* PBXContainerItemProxy */;
};
72045CDE26FEE471004F96E5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 724BB3921D333832005D534A /* SparkleInstallerStatus */;
targetProxy = 72045CDD26FEE471004F96E5 /* PBXContainerItemProxy */;
};
7205C4691E1306FB00E370AE /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 7205C43D1E13049400E370AE /* generate_appcast */;
@@ -3609,16 +3598,6 @@
target = 724BB3921D333832005D534A /* SparkleInstallerStatus */;
targetProxy = 7218EC342623ED97008FECF3 /* PBXContainerItemProxy */;
};
721D8A781D4952B60032E472 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 72B398D11D3D879300EE297F /* Autoupdate */;
targetProxy = 721D8A771D4952B60032E472 /* PBXContainerItemProxy */;
};
721D8A7A1D4952B60032E472 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 721C24441CB753E6005440CB /* Installer Progress */;
targetProxy = 721D8A791D4952B60032E472 /* PBXContainerItemProxy */;
};
725148E9266D918900247C9C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 726E07EE1CAF37BD001A286B /* SparkleDownloader */;
@@ -3659,11 +3638,6 @@
target = 8DC2EF4F0486A6940098B216 /* Sparkle */;
targetProxy = 72EF30B826747E39008CE987 /* PBXContainerItemProxy */;
};
72F94F621CC48669002DEE68 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 726E07AC1CAF08D6001A286B /* SparkleInstallerLauncher */;
targetProxy = 72F94F611CC48669002DEE68 /* PBXContainerItemProxy */;
};
72F94F6B1CC4A0C8002DEE68 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 726E07AC1CAF08D6001A286B /* SparkleInstallerLauncher */;
@@ -4104,7 +4078,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 72F94ED51CC3441A002DEE68 /* ConfigInstallerLauncherDebug.xcconfig */;
buildSettings = {
INFOPLIST_FILE = InstallerLauncher/Info.plist;
};
name = Debug;
};
@@ -4112,7 +4085,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 72F94ED51CC3441A002DEE68 /* ConfigInstallerLauncherDebug.xcconfig */;
buildSettings = {
INFOPLIST_FILE = InstallerLauncher/Info.plist;
};
name = Coverage;
};
@@ -4120,7 +4092,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 726E07C11CAF1E79001A286B /* ConfigInstallerLauncher.xcconfig */;
buildSettings = {
INFOPLIST_FILE = InstallerLauncher/Info.plist;
};
name = Release;
};
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5D06E8CF0FD68C7C005AE3F6"
BuildableName = "BinaryDelta"
BlueprintName = "BinaryDelta"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5D06E8CF0FD68C7C005AE3F6"
BuildableName = "BinaryDelta"
BlueprintName = "BinaryDelta"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5D06E8CF0FD68C7C005AE3F6"
BuildableName = "BinaryDelta"
BlueprintName = "BinaryDelta"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+5 -5
View File
@@ -12,7 +12,7 @@
"%@ %@ is currently the newest version available." = "%1$@ %2$@ is currently the newest version available.";
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ is currently the newest version available.\n(You are currently running version %3$@.)";
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ is currently the newest version available.\n(You are currently running version %3$@.)";
"An error occurred while running the updater. Please try again later." = "An error occurred while running the updater. Please try again later.";
@@ -24,7 +24,7 @@
"Update Installed" = "Update Installed";
"%@ is now updated to version %@!" = "%@ is now updated to version %@!";
"%@ is now updated to version %@!" = "%@ is now updated to version %@!";
"%@ is now updated!" = "%@ is now updated!";
@@ -35,7 +35,7 @@
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available—you have %3$@. Would you like to learn more about this update on the web?";
/* Critical downloadable update */
"%@ %@ is now available--you have %@. This is an important update; would you like to download it now?" = "%1$@ %2$@ is now available--you have %3$@. This is an important update; would you like to download it now?";
"%@ %@ is now available--you have %@. This is an important update; would you like to download it now?" = "%1$@ %2$@ is now available—you have %3$@. This is an important update; would you like to download it now?";
"%@ downloaded" = "%@ downloaded";
@@ -137,11 +137,11 @@
"Your macOS version is too old" = "Your macOS version is too old";
"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required." = "%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required.";
"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required." = "%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required.";
"Your macOS version is too new" = "Your macOS version is too new";
"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@." = "%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.";
"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@." = "%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.";
/* Used when a new update is not found */
"Version History" = "Version History";
+17 -26
View File
@@ -47,44 +47,35 @@
// The user driver is only used for a termination callback
_userDriver = userDriver;
_updaterDelegate = updaterDelegate;
_coreDriver = [[SPUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
_coreDriver = [[SPUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle updateCheck:SPUUpdateCheckUpdatesInBackground updater:updater updaterDelegate:updaterDelegate delegate:self];
}
return self;
}
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{
[self.coreDriver prepareCheckForUpdatesWithCompletion:completionBlock];
[self.coreDriver preflightForUpdatePermissionPreventingInstallerInteraction:preventsInstallerInteraction reply:^(NSError * _Nullable error) {
if (error != nil) {
[self abortUpdateWithError:error];
} else {
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES requiresSilentInstall:YES];
}
}];
[self.coreDriver setCompletionHandler:completionBlock];
}
#pragma clang diagnostic push
#if __has_warning("-Wcompletion-handler")
#pragma clang diagnostic ignored "-Wcompletion-handler"
#endif
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)__unused completionBlock
#pragma clang diagnostic pop
- (void)setUpdateShownHandler:(void (^)(void))updateShownHandler
{
// Nothing really to do here.. this shouldn't be called.
SULog(SULogLevelError, @"Error: resumeInstallingUpdateWithCompletion: called on SPUAutomaticUpdateDriver");
}
#pragma clang diagnostic push
#if __has_warning("-Wcompletion-handler")
#pragma clang diagnostic ignored "-Wcompletion-handler"
#endif
- (void)resumeUpdate:(id<SPUResumableUpdate>)__unused resumableUpdate completion:(SPUUpdateDriverCompletion)__unused completionBlock
#pragma clang diagnostic pop
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
{
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES requiresSilentInstall:YES];
}
- (void)resumeInstallingUpdate
{
// Nothing really to do here.. this shouldn't be called.
SULog(SULogLevelError, @"Error: resumeDownloadedUpdate:completion: called on SPUAutomaticUpdateDriver");
SULog(SULogLevelError, @"Error: resumeInstallingUpdate: called on SPUAutomaticUpdateDriver");
}
- (void)resumeUpdate:(id<SPUResumableUpdate>)__unused resumableUpdate
{
// Nothing really to do here.. this shouldn't be called.
SULog(SULogLevelError, @"Error: resumeDownloadedUpdate: called on SPUAutomaticUpdateDriver");
}
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem
+5 -4
View File
@@ -8,6 +8,7 @@
#import <Foundation/Foundation.h>
#import "SPUUpdateDriver.h"
#import "SPUUpdateCheck.h"
NS_ASSUME_NONNULL_BEGIN
@@ -28,15 +29,15 @@ NS_ASSUME_NONNULL_BEGIN
@interface SPUBasicUpdateDriver : NSObject
- (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate;
- (instancetype)initWithHost:(SUHost *)host updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate;
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background;
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
- (void)resumeInstallingUpdate;
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate;
- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate resumableUpdate:(id<SPUResumableUpdate> _Nullable)resumableUpdate error:(nullable NSError *)error;
+25 -33
View File
@@ -10,8 +10,6 @@
#import "SUAppcastDriver.h"
#import "SPUUpdaterDelegate.h"
#import "SUErrors.h"
#import "SULog.h"
#import "SULog+NSError.h"
#import "SULocalizations.h"
#import "SUHost.h"
#import "SUAppcastItem.h"
@@ -31,6 +29,7 @@
@property (nonatomic, copy) SPUUpdateDriverCompletion completionBlock;
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic, readonly) SPUUpdateCheck updateCheck;
@property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this..
@property (nullable, nonatomic, readonly, weak) id <SPUUpdaterDelegate>updaterDelegate;
@@ -41,6 +40,7 @@
@implementation SPUBasicUpdateDriver
@synthesize host = _host;
@synthesize updateCheck = _updateCheck;
@synthesize updater = _updater;
@synthesize updaterDelegate = _updaterDelegate;
@synthesize delegate = _delegate;
@@ -48,11 +48,12 @@
@synthesize completionBlock = _completionBlock;
@synthesize aborted = _aborted;
- (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate
- (instancetype)initWithHost:(SUHost *)host updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate
{
self = [super init];
if (self != nil) {
_host = host;
_updateCheck = updateCheck;
_updater = updater;
_updaterDelegate = updaterDelegate;
_delegate = delegate;
@@ -62,7 +63,7 @@
return self;
}
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{
self.completionBlock = completionBlock;
}
@@ -90,14 +91,12 @@
[self notifyFinishLoadingAppcast];
SUAppcastItem *nonNullUpdateItem = updateItem;
[self notifyFoundValidUpdateWithAppcastItem:nonNullUpdateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain];
[self notifyFoundValidUpdateWithAppcastItem:nonNullUpdateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain resuming:YES];
}
}
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeInstallingUpdate
{
self.completionBlock = completionBlock;
NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier;
assert(hostBundleIdentifier != nil);
[SPUProbeInstallStatus probeInstallerUpdateItemForHostBundleIdentifier:hostBundleIdentifier completion:^(SPUInstallationInfo * _Nullable installationInfo) {
@@ -107,10 +106,8 @@
}];
}
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
{
self.completionBlock = completionBlock;
[self notifyResumableUpdateItem:resumableUpdate.updateItem secondaryUpdateItem:resumableUpdate.secondaryUpdateItem systemDomain:nil];
}
@@ -139,24 +136,30 @@
}
}
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain resuming:(BOOL)resuming
{
if (!self.aborted) {
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
object:self.updater
userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }];
if ([self.updaterDelegate respondsToSelector:@selector((updater:didFindValidUpdate:))]) {
[self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem];
// If the update is not being resumed from a prior session, give the delegate a chance to bail
NSError *shouldNotProceedError = nil;
if (!resuming && [self.updaterDelegate respondsToSelector:@selector(updater:shouldProceedWithUpdate:updateCheck:error:)] && ![self.updaterDelegate updater:self.updater shouldProceedWithUpdate:updateItem updateCheck:self.updateCheck error:&shouldNotProceedError]) {
[self.delegate basicDriverIsRequestingAbortUpdateWithError:shouldNotProceedError];
} else {
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
object:self.updater
userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }];
if ([self.updaterDelegate respondsToSelector:@selector((updater:didFindValidUpdate:))]) {
[self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem];
}
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain];
}
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain];
}
}
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem
{
[self notifyFoundValidUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryAppcastItem systemDomain:nil];
[self notifyFoundValidUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryAppcastItem systemDomain:nil resuming:NO];
}
- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult background:(BOOL)background
@@ -258,19 +261,8 @@
self.aborted = YES;
[self.appcastDriver cleanup:^{
if (error != nil) {
if (error.code != SUNoUpdateError && error.code != SUInstallationCanceledError && error.code != SUInstallationAuthorizeLaterError) { // Let's not bother logging this.
SULogError(error);
}
// Notify host app that updater has aborted
if ([self.updaterDelegate respondsToSelector:@selector((updater:didAbortWithError:))]) {
[self.updaterDelegate updater:self.updater didAbortWithError:(NSError * _Nonnull)error];
}
}
if (self.completionBlock != nil) {
self.completionBlock(shouldShowUpdateImmediately, resumableUpdate);
self.completionBlock(shouldShowUpdateImmediately, resumableUpdate, error);
self.completionBlock = nil;
}
}];
+5 -6
View File
@@ -9,6 +9,7 @@
#import <Foundation/Foundation.h>
#import "SPUUpdateDriver.h"
#import "SPUUserUpdateState.h"
#import "SPUUpdateCheck.h"
NS_ASSUME_NONNULL_BEGIN
@@ -49,17 +50,15 @@ NS_ASSUME_NONNULL_BEGIN
@interface SPUCoreBasedUpdateDriver : NSObject
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate;
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate;
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply;
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall;
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
- (void)resumeInstallingUpdate;
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate;
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background;
+11 -52
View File
@@ -39,7 +39,6 @@
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic) BOOL resumingInstallingUpdate;
@property (nonatomic) BOOL silentInstall;
@property (nonatomic) BOOL preventsInstallerInteraction;
@property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this..
@property (nullable, nonatomic, readonly, weak) id <SPUUpdaterDelegate>updaterDelegate;
@property (nonatomic) NSString *userAgent;
@@ -58,7 +57,6 @@
@synthesize host = _host;
@synthesize resumingInstallingUpdate = _resumingInstallingUpdate;
@synthesize silentInstall = _silentInstall;
@synthesize preventsInstallerInteraction = _preventsInstallerInteraction;
@synthesize updater = _updater;
@synthesize updaterDelegate = _updaterDelegate;
@synthesize userAgent = _userAgent;
@@ -66,7 +64,7 @@
@synthesize resumableUpdate = _resumableUpdate;
@synthesize downloadedUpdateForRemoval = _downloadedUpdateForRemoval;
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate
{
self = [super init];
if (self != nil) {
@@ -75,7 +73,7 @@
NSString *bundleIdentifier = host.bundle.bundleIdentifier;
assert(bundleIdentifier != nil);
_basicDriver = [[SPUBasicUpdateDriver alloc] initWithHost:host updater:updater updaterDelegate:updaterDelegate delegate:self];
_basicDriver = [[SPUBasicUpdateDriver alloc] initWithHost:host updateCheck:updateCheck updater:updater updaterDelegate:updaterDelegate delegate:self];
_installerDriver = [[SPUInstallerDriver alloc] initWithHost:host applicationBundle:applicationBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
_host = host;
@@ -85,33 +83,9 @@
return self;
}
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{
[self.basicDriver prepareCheckForUpdatesWithCompletion:completionBlock];
}
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply
{
// Save for later
self.preventsInstallerInteraction = preventsInstallerInteraction;
// If we don't allow interaction, make sure we have sufficient privileges to update
// If we don't, then we should abort early before trying to check for updates
// Note if we don't have permission to update an application update without interaction,
// then we won't have permission for package type of updates either (converse is not true)
if (!preventsInstallerInteraction) {
reply(nil);
} else {
// Otherwise check if we have sufficient privileges to update without interaction
[self.installerDriver checkIfApplicationInstallationRequiresAuthorizationWithReply:^(BOOL requiresAuthorization) {
if (requiresAuthorization) {
reply([NSError errorWithDomain:SUSparkleErrorDomain code:SUNotAllowedInteractionError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"No new update has been checked because the installation will require interaction, which has been prevented."] }]);
} else {
reply(nil);
}
}];
}
[self.basicDriver setCompletionHandler:completionBlock];
}
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall
@@ -123,23 +97,20 @@
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background];
}
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeInstallingUpdate
{
self.resumingInstallingUpdate = YES;
self.silentInstall = NO;
[self.basicDriver resumeInstallingUpdateWithCompletion:completionBlock];
[self.basicDriver resumeInstallingUpdate];
}
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
{
self.resumableUpdate = resumableUpdate;
self.silentInstall = NO;
// Note if installer interaction isn't allowed, we shouldn't have downloaded the update, and shouldn't be able to get here
// So no need to do a test if we can perform an update without authorization
[self.basicDriver resumeUpdate:resumableUpdate completion:completionBlock];
[self.basicDriver resumeUpdate:resumableUpdate];
}
- (void)basicDriverDidFinishLoadingAppcast
@@ -157,21 +128,9 @@
if (self.resumingInstallingUpdate) {
assert(systemDomain != nil);
[self.installerDriver resumeInstallingUpdateWithUpdateItem:updateItem systemDomain:systemDomain.boolValue];
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
} else {
if (!self.preventsInstallerInteraction) {
// Simple case - delegate allows interaction, so we should continue along
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
} else {
// Package type installations will always require installer interaction as long as we don't support running as root
// If it's not a package type installation, we should be okay since we did an auth check before checking for updates above
if (![updateItem.installationType isEqualToString:SPUInstallationTypeApplication]) {
[self.delegate coreDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUNotAllowedInteractionError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A new update is available but cannot be installed because interaction has been prevented."] }]];
} else {
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
}
}
}
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
}
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background
@@ -265,7 +224,7 @@
[self.delegate coreDriverDidStartExtractingUpdate];
}
[self.installerDriver extractDownloadedUpdate:downloadedUpdate silently:self.silentInstall preventsInstallerInteraction:self.preventsInstallerInteraction completion:^(NSError * _Nullable error) {
[self.installerDriver extractDownloadedUpdate:downloadedUpdate silently:self.silentInstall completion:^(NSError * _Nullable error) {
if (error != nil) {
if (error.code != SUInstallationAuthorizeLaterError) {
[self clearDownloadedUpdate];
+1 -1
View File
@@ -61,7 +61,7 @@
if (self != nil) {
_host = host;
if (!SPUXPCServiceExists(@DOWNLOADER_BUNDLE_ID)) {
if (!SPUXPCServiceIsEnabled(SUEnableDownloaderServiceKey)) {
_downloader = [[SPUDownloader alloc] initWithDelegate:self];
} else {
_connection = [[NSXPCConnection alloc] initWithServiceName:@DOWNLOADER_BUNDLE_ID];
+1 -3
View File
@@ -34,9 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)resumeInstallingUpdateWithUpdateItem:(SUAppcastItem *)updateItem systemDomain:(BOOL)systemDomain;
- (void)checkIfApplicationInstallationRequiresAuthorizationWithReply:(void (^)(BOOL requiresAuthorization))reply;
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently preventsInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(void (^)(NSError * _Nullable))completionHandler;
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently completion:(void (^)(NSError * _Nullable))completionHandler;
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI;
+6 -73
View File
@@ -106,7 +106,7 @@
NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier;
assert(hostBundleIdentifier != nil);
if (!SPUXPCServiceExists(@INSTALLER_CONNECTION_BUNDLE_ID)) {
if (!SPUXPCServiceIsEnabled(SUEnableInstallerConnectionServiceKey)) {
self.installerConnection = [[SUInstallerConnection alloc] initWithDelegate:self];
} else {
self.installerConnection = [[SUXPCInstallerConnection alloc] initWithDelegate:self];
@@ -141,7 +141,7 @@
}
// This can be called multiple times (eg: if a delta update fails, this may be called again with a regular update item)
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently preventsInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(void (^)(NSError * _Nullable))completionHandler
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently completion:(void (^)(NSError * _Nullable))completionHandler
{
self.updateItem = downloadedUpdate.updateItem;
self.temporaryDirectory = downloadedUpdate.temporaryDirectory;
@@ -150,7 +150,7 @@
self.currentStage = SPUInstallerNotStarted;
if (self.installerConnection == nil) {
[self launchAutoUpdateSilently:silently preventsInstallerInteraction:preventsInstallerInteraction completion:completionHandler];
[self launchAutoUpdateSilently:silently completion:completionHandler];
} else {
// The Install tool is already alive; just send out installation input data again
[self sendInstallationData];
@@ -317,80 +317,13 @@
}
}
- (void)checkIfApplicationInstallationRequiresAuthorizationWithReply:(void (^)(BOOL requiresAuthorization))reply
{
id<SUInstallerLauncherProtocol> installerLauncher = nil;
__block BOOL madeReply = NO;
NSXPCConnection *launcherConnection = nil;
if (!SPUXPCServiceExists(@INSTALLER_LAUNCHER_BUNDLE_ID)) {
installerLauncher = [[SUInstallerLauncher alloc] init];
} else {
launcherConnection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_LAUNCHER_BUNDLE_ID];
launcherConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerLauncherProtocol)];
launcherConnection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
if (!madeReply) {
// We'll break the retain cycle in the invalidation handler
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"
[launcherConnection invalidate];
#pragma clang diagnostic pop
}
});
};
launcherConnection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
#pragma clang diagnostic push
#if __has_warning("-Wcompletion-handler")
#pragma clang diagnostic ignored "-Wcompletion-handler"
#endif
if (!madeReply) {
#pragma clang diagnostic pop
// If something went horribly wrong, just guess that we won't require authorization
reply(NO);
// Break the retain cycle
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"
launcherConnection.interruptionHandler = nil;
launcherConnection.invalidationHandler = nil;
#pragma clang diagnostic pop
}
});
};
[launcherConnection resume];
installerLauncher = launcherConnection.remoteObjectProxy;
}
[installerLauncher checkIfApplicationInstallationRequiresAuthorizationWithHostBundlePath:self.host.bundlePath reply:^(BOOL requiresAuthorization) {
dispatch_async(dispatch_get_main_queue(), ^{
#pragma clang diagnostic push
#if __has_warning("-Wcompletion-handler")
#pragma clang diagnostic ignored "-Wcompletion-handler"
#endif
if (!madeReply) {
#pragma clang diagnostic pop
madeReply = YES;
[launcherConnection invalidate];
reply(requiresAuthorization);
}
});
}];
}
- (void)launchAutoUpdateSilently:(BOOL)silently preventsInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(void (^)(NSError *_Nullable))completionHandler
- (void)launchAutoUpdateSilently:(BOOL)silently completion:(void (^)(NSError *_Nullable))completionHandler
{
id<SUInstallerLauncherProtocol> installerLauncher = nil;
__block BOOL retrievedLaunchStatus = NO;
NSXPCConnection *launcherConnection = nil;
if (!SPUXPCServiceExists(@INSTALLER_LAUNCHER_BUNDLE_ID)) {
if (!SPUXPCServiceIsEnabled(SUEnableInstallerLauncherServiceKey)) {
installerLauncher = [[SUInstallerLauncher alloc] init];
} else {
launcherConnection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_LAUNCHER_BUNDLE_ID];
@@ -473,7 +406,7 @@
mainBundleIdentifier = (bundleIdentifier == nil) ? mainBundleName : bundleIdentifier;
}
[installerLauncher launchInstallerWithHostBundlePath:hostBundlePath updaterIdentifier:mainBundleIdentifier authorizationPrompt:authorizationPrompt installationType:installationType allowingDriverInteraction:driverAllowsInteraction allowingUpdaterInteraction:!preventsInstallerInteraction completion:^(SUInstallerLauncherStatus result, BOOL systemDomain) {
[installerLauncher launchInstallerWithHostBundlePath:hostBundlePath updaterIdentifier:mainBundleIdentifier authorizationPrompt:authorizationPrompt installationType:installationType allowingDriverInteraction:driverAllowsInteraction completion:^(SUInstallerLauncherStatus result, BOOL systemDomain) {
dispatch_async(dispatch_get_main_queue(), ^{
retrievedLaunchStatus = YES;
[launcherConnection invalidate];
+3 -2
View File
@@ -13,6 +13,7 @@
#import "SPUSecureCoding.h"
#import "SUInstallerStatus.h"
#import "SUXPCInstallerStatus.h"
#import "SUConstants.h"
#import "SULog.h"
@@ -27,7 +28,7 @@
+ (void)probeInstallerInProgressForHostBundleIdentifier:(NSString *)hostBundleIdentifier completion:(void (^)(BOOL))completionHandler
{
id<SUInstallerStatusProtocol> installerStatus = nil;
BOOL usesXPC = SPUXPCServiceExists(@INSTALLER_STATUS_BUNDLE_ID);
BOOL usesXPC = SPUXPCServiceIsEnabled(SUEnableInstallerStatusServiceKey);
if (!usesXPC) {
installerStatus = [[SUInstallerStatus alloc] init];
} else {
@@ -90,7 +91,7 @@
+ (void)probeInstallerUpdateItemForHostBundleIdentifier:(NSString *)hostBundleIdentifier completion:(void (^)(SPUInstallationInfo * _Nullable))completionHandler
{
id<SUInstallerStatusProtocol> installerStatus = nil;
BOOL usesXPC = SPUXPCServiceExists(@INSTALLER_STATUS_BUNDLE_ID);
BOOL usesXPC = SPUXPCServiceIsEnabled(SUEnableInstallerStatusServiceKey);
if (!usesXPC) {
installerStatus = [[SUInstallerStatus alloc] init];
} else {
+15 -10
View File
@@ -28,30 +28,35 @@
{
self = [super init];
if (self != nil) {
_basicDriver = [[SPUBasicUpdateDriver alloc] initWithHost:host updater:updater updaterDelegate:updaterDelegate delegate:self];
_basicDriver = [[SPUBasicUpdateDriver alloc] initWithHost:host updateCheck:SPUUpdateCheckUpdateInformation updater:updater updaterDelegate:updaterDelegate delegate:self];
}
return self;
}
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)__unused preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{
[self.basicDriver setCompletionHandler:completionBlock];
}
- (void)setUpdateShownHandler:(void (^)(void))updateShownHandler
{
}
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
{
// We don't preflight for update permission in this driver because we are just interested if an update is available
[self.basicDriver prepareCheckForUpdatesWithCompletion:completionBlock];
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
}
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeInstallingUpdate
{
[self.basicDriver resumeInstallingUpdateWithCompletion:completionBlock];
[self.basicDriver resumeInstallingUpdate];
}
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
{
self.resumableUpdate = resumableUpdate;
[self.basicDriver resumeUpdate:resumableUpdate completion:completionBlock];
[self.basicDriver resumeUpdate:resumableUpdate];
}
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)__unused appcastItem secondaryAppcastItem:(SUAppcastItem * _Nullable)__unused secondaryAppcastItem systemDomain:(NSNumber * _Nullable)__unused systemDomain
+25 -20
View File
@@ -19,6 +19,7 @@
@property (nonatomic, readonly) SPUUIBasedUpdateDriver *uiDriver;
@property (nonatomic) BOOL showedUpdate;
@property (nonatomic) void (^updateDidShowHandler)(void);
@end
@@ -26,6 +27,7 @@
@synthesize uiDriver = _uiDriver;
@synthesize showedUpdate = _showedUpdate;
@synthesize updateDidShowHandler = _updateDidShowHandler;
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
{
@@ -36,33 +38,38 @@
return self;
}
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{
[self.uiDriver prepareCheckForUpdatesWithCompletion:completionBlock];
[self.uiDriver preflightForUpdatePermissionPreventingInstallerInteraction:preventsInstallerInteraction reply:^(NSError * _Nullable error) {
if (error != nil) {
// Don't tell the user about the permission error for scheduled update checks
[self abortUpdateWithError:nil];
} else {
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
}
}];
[self.uiDriver setCompletionHandler:completionBlock];
}
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
- (void)setUpdateShownHandler:(void (^)(void))handler
{
[self.uiDriver resumeInstallingUpdateWithCompletion:completionBlock];
self.updateDidShowHandler = handler;
}
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
{
[self.uiDriver resumeUpdate:resumableUpdate completion:completionBlock];
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
}
- (void)resumeInstallingUpdate
{
[self.uiDriver resumeInstallingUpdate];
}
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
{
[self.uiDriver resumeUpdate:resumableUpdate];
}
- (void)uiDriverDidShowUpdate
{
self.showedUpdate = YES;
if (self.updateDidShowHandler != nil) {
self.updateDidShowHandler();
}
}
- (BOOL)showingUpdate
@@ -72,14 +79,12 @@
- (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *) error
{
// Don't tell the user that no update was found or some appcast fetch error occurred for scheduled update checks if we haven't shown the update
[self abortUpdateWithError:self.showedUpdate ? error : nil];
[self abortUpdateWithError:error];
}
- (void)coreDriverIsRequestingAbortUpdateWithError:(nullable NSError *) error
{
// Don't tell the user that an update error occurred for scheduled update checks if we haven't shown the update
[self abortUpdateWithError:self.showedUpdate ? error : nil];
[self abortUpdateWithError:error];
}
- (void)uiDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error
@@ -94,7 +99,7 @@
- (void)abortUpdateWithError:(nullable NSError *)error
{
[self.uiDriver abortUpdateWithError:error];
[self.uiDriver abortUpdateWithError:error showErrorToUser:self.showedUpdate];
}
@end
+13 -16
View File
@@ -24,33 +24,30 @@ NS_ASSUME_NONNULL_BEGIN
@protocol SPUUserDriver, SPUUpdaterDelegate, SPUStandardUserDriverDelegate;
/**
A controller class that instantiates a `SPUUpdater` and allows binding UI to it.
A controller class that instantiates a `SPUUpdater` and allows binding UI to its updater settings.
This class can be instantiated in a nib or created programatically using `-initWithUpdaterDelegate:userDriverDelegate:` or `-initWithStartingUpdater:updaterDelegate:userDriverDelegate:`.
The controller's updater targets the application's main bundle and uses Sparkle's standard user interface.
Typically, this class is used by sticking it as a custom NSObject subclass in an Interface Builder nib (probably in MainMenu) but it works well programatically too.
The controller creates an `SPUUpdater` instance and allows hooking up the check for updates action and handling menu item validation.
The controller creates an `SPUUpdater` instance using a `SPUStandardUserDriver` and allows hooking up the check for updates action and handling menu item validation.
It also allows hooking up the updater's and user driver's delegates.
If you need more control over what bundle you want to update, or you want to provide a custom user interface (via `SPUUserDriver`), please use `SPUUpdater` directly instead.
*/
SU_EXPORT @interface SPUStandardUpdaterController : NSObject
/**
Interface builder outlet for the updater's delegate.
This property should only be set using Interface Builder by creating a connection using the outlet.
*/
@property (nonatomic, weak, nullable) IBOutlet id<SPUUpdaterDelegate> updaterDelegate;
/**
Interface builder outlet for the user driver's delegate.
This property should only be set using Interface Builder by creating a connection using the outlet.
*/
@property (nonatomic, weak, nullable) IBOutlet id<SPUStandardUserDriverDelegate> userDriverDelegate;
{
/**
* Interface builder outlet for the updater's delegate.
*/
IBOutlet __weak id<SPUUpdaterDelegate> updaterDelegate;
/**
* Interface builder outlet for the user driver's delegate.
*/
IBOutlet __weak id<SPUStandardUserDriverDelegate> userDriverDelegate;
}
/**
Accessible property for the updater. Some properties on the updater can be binded via KVO
+30 -22
View File
@@ -17,49 +17,57 @@
#import "SULocalizations.h"
#import <AppKit/AppKit.h>
// We use public instance variables instead of properties for the updater / user driver delegates
// because we want them to be connectable outlets from Interface Builder, but we do not want their setters to be invoked
// programmatically.
@interface SPUStandardUpdaterController () <NSMenuItemValidation>
@property (nonatomic) SPUUpdater *updater;
@property (nonatomic) id<SPUUserDriver> userDriver;
@end
@implementation SPUStandardUpdaterController
@synthesize updater = _updater;
@synthesize userDriver = _userDriver;
@synthesize updaterDelegate = _updaterDelegate;
@synthesize userDriverDelegate = _userDriverDelegate;
- (instancetype)init
{
// Updater will be later started in -awakeFromNib
// Our updater delegate and user driver delegate outlets will be connected by then too.
// For now we can make sure the updater/userDriver are accessible
return [self initWithStartingUpdater:NO updaterDelegate:nil userDriverDelegate:nil];
}
- (void)awakeFromNib
{
// Note: awakeFromNib might be called more than once but -startUpdate handles that
// Note: awakeFromNib might be called more than once
// We have to use awakeFromNib otherwise the delegate outlets may not be connected yet,
// and we aren't a proper window or view controller, so we don't have a proper "did load" point
[self startUpdater];
if (self.updater == nil) {
[self _initUpdater];
[self startUpdater];
}
}
- (instancetype)initWithUpdaterDelegate:(nullable id<SPUUpdaterDelegate>)updaterDelegate userDriverDelegate:(nullable id<SPUStandardUserDriverDelegate>)userDriverDelegate
- (void)_initUpdater
{
return [self initWithStartingUpdater:YES updaterDelegate:updaterDelegate userDriverDelegate:userDriverDelegate];
NSBundle *hostBundle = [NSBundle mainBundle];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
SPUStandardUserDriver *userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle delegate:self->userDriverDelegate];
self.updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle applicationBundle:hostBundle userDriver:userDriver delegate:self->updaterDelegate];
self.userDriver = userDriver;
#pragma clang diagnostic pop
}
- (instancetype)initWithStartingUpdater:(BOOL)startUpdater updaterDelegate:(nullable id<SPUUpdaterDelegate>)updaterDelegate userDriverDelegate:(nullable id<SPUStandardUserDriverDelegate>)userDriverDelegate
- (instancetype)initWithUpdaterDelegate:(nullable id<SPUUpdaterDelegate>)theUpdaterDelegate userDriverDelegate:(nullable id<SPUStandardUserDriverDelegate>)theUserDriverDelegate
{
return [self initWithStartingUpdater:YES updaterDelegate:theUpdaterDelegate userDriverDelegate:theUserDriverDelegate];
}
- (instancetype)initWithStartingUpdater:(BOOL)startUpdater updaterDelegate:(nullable id<SPUUpdaterDelegate>)theUpdaterDelegate userDriverDelegate:(nullable id<SPUStandardUserDriverDelegate>)theUserDriverDelegate
{
if ((self = [super init])) {
_updaterDelegate = updaterDelegate;
_userDriverDelegate = userDriverDelegate;
self->updaterDelegate = theUpdaterDelegate;
self->userDriverDelegate = theUserDriverDelegate;
NSBundle *hostBundle = [NSBundle mainBundle];
SPUStandardUserDriver *userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle delegate:userDriverDelegate];
_updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle applicationBundle:hostBundle userDriver:userDriver delegate:updaterDelegate];
_userDriver = userDriver;
[self _initUpdater];
if (startUpdater) {
[self startUpdater];
+22 -3
View File
@@ -274,9 +274,28 @@
switch (reason) {
case SPUNoUpdateFoundReasonOnLatestVersion:
case SPUNoUpdateFoundReasonOnNewerThanLatestVersion: {
if (latestAppcastItem.releaseNotesURL != nil) {
// Show the user the past version history if available
[alert addButtonWithTitle:SULocalizedString(@"Version History", nil)];
// Show the user the past version history if available
NSString *localizedButtonTitle = SULocalizedString(@"Version History", nil);
// Check if the delegate implements a Version History action
id <SPUStandardUserDriverDelegate> delegate = self.delegate;
if ([delegate respondsToSelector:@selector(standardUserDriverShowVersionHistoryForAppcastItem:)]) {
[alert addButtonWithTitle:localizedButtonTitle];
secondaryAction = ^{
[delegate standardUserDriverShowVersionHistoryForAppcastItem:latestAppcastItem];
};
} else if (latestAppcastItem.fullReleaseNotesURL != nil) {
// Open the full release notes URL if informed
[alert addButtonWithTitle:localizedButtonTitle];
secondaryAction = ^{
[[NSWorkspace sharedWorkspace] openURL:(NSURL * _Nonnull)latestAppcastItem.fullReleaseNotesURL];
};
} else if (latestAppcastItem.releaseNotesURL != nil) {
// Fall back to opening the release notes URL
[alert addButtonWithTitle:localizedButtonTitle];
secondaryAction = ^{
[[NSWorkspace sharedWorkspace] openURL:(NSURL * _Nonnull)latestAppcastItem.releaseNotesURL];
+16
View File
@@ -45,4 +45,20 @@ SU_EXPORT @protocol SPUStandardUserDriverDelegate <NSObject>
*/
- (_Nullable id <SUVersionDisplay>)standardUserDriverRequestsVersionDisplayer;
/**
Handles showing the full release notes to the user.
When a user checks for new updates and no new update is found, Sparkle will offer to show the application's version history to the user
by providing a "Version History" button in the no new update available alert.
If this delegate method is not implemented, Sparkle will instead offer to open the
`fullReleaseNotesLink` (or `releaseNotesLink` if the former is unavailable) from the appcast's latest `item` in the user's web browser.
If this delegate method is implemented, Sparkle will instead ask the delegate to show the full release notes to the user.
A delegate may want to implement this method if they want to show in-app or offline release notes.
@param item The appcast item corresponding to the latest version available.
*/
- (void)standardUserDriverShowVersionHistoryForAppcastItem:(SUAppcastItem *_Nonnull)item;
@end
+4 -6
View File
@@ -31,17 +31,15 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver userInitiated:(BOOL)userInitiated updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUUIBasedUpdateDriverDelegate>)delegate;
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply;
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background;
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
- (void)resumeInstallingUpdate;
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate;
- (void)abortUpdateWithError:(nullable NSError *)error;
- (void)abortUpdateWithError:(nullable NSError *)error showErrorToUser:(BOOL)showedUserProgress;
@end
+22 -27
View File
@@ -89,7 +89,6 @@
@property (nonatomic) SPUReleaseNotesDriver *releaseNotesDriver;
@property (nonatomic) BOOL resumingInstallingUpdate;
@property (nonatomic) BOOL resumingDownloadedInfoOrUpdate;
@property (nonatomic) BOOL preventsInstallerInteraction;
@property (nonatomic, nullable) NSDictionary *httpHeaders;
@property (nonatomic, nullable) NSString *userAgent;
@@ -107,7 +106,6 @@
@synthesize delegate = _delegate;
@synthesize resumingInstallingUpdate = _resumingInstallingUpdate;
@synthesize resumingDownloadedInfoOrUpdate = _resumingDownloadedInfoOrUpdate;
@synthesize preventsInstallerInteraction = _preventsInstallerInteraction;
@synthesize httpHeaders = _httpHeaders;
@synthesize userAgent = _userAgent;
@@ -122,21 +120,16 @@
_updaterDelegate = updaterDelegate;
_host = host;
_coreDriver = [[SPUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
SPUUpdateCheck updateCheck = userInitiated ? SPUUpdateCheckUpdates : SPUUpdateCheckUpdatesInBackground;
_coreDriver = [[SPUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle updateCheck:updateCheck updater:updater updaterDelegate:updaterDelegate delegate:self];
}
return self;
}
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{
[self.coreDriver prepareCheckForUpdatesWithCompletion:completionBlock];
}
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply
{
self.preventsInstallerInteraction = preventsInstallerInteraction;
[self.coreDriver preflightForUpdatePermissionPreventingInstallerInteraction:preventsInstallerInteraction reply:reply];
[self.coreDriver setCompletionHandler:completionBlock];
}
- (void)_clearSkippedUpdatesIfUserInitiated
@@ -156,20 +149,20 @@
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background requiresSilentInstall:NO];
}
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeInstallingUpdate
{
[self _clearSkippedUpdatesIfUserInitiated];
self.resumingInstallingUpdate = YES;
[self.coreDriver resumeInstallingUpdateWithCompletion:completionBlock];
[self.coreDriver resumeInstallingUpdate];
}
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
{
[self _clearSkippedUpdatesIfUserInitiated];
self.resumingDownloadedInfoOrUpdate = YES;
[self.coreDriver resumeUpdate:resumableUpdate completion:completionBlock];
[self.coreDriver resumeUpdate:resumableUpdate];
}
- (void)basicDriverDidFinishLoadingAppcast
@@ -213,7 +206,7 @@
[self.coreDriver extractDownloadedUpdate];
break;
case SPUUserUpdateStageInstalling:
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:!self.preventsInstallerInteraction];
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:YES];
break;
case SPUUserUpdateStageNotDownloaded:
[self.coreDriver downloadUpdateFromAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem inBackground:NO];
@@ -241,7 +234,7 @@
break;
case SPUUserUpdateStageInstalling:
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:!self.preventsInstallerInteraction];
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:YES];
break;
}
@@ -255,7 +248,7 @@
break;
}
case SPUUserUpdateStageInstalling: {
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:!self.preventsInstallerInteraction];
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:YES];
break;
}
}
@@ -270,7 +263,7 @@
[self.delegate uiDriverDidShowUpdate];
}
if (updateItem.releaseNotesURL != nil && (![updaterDelegate respondsToSelector:@selector(updaterShouldDownloadReleaseNotes:)] || [updaterDelegate updaterShouldDownloadReleaseNotes:self.updater])) {
if (updateItem.releaseNotesURL != nil && (![updaterDelegate respondsToSelector:@selector(updater:shouldDownloadReleaseNotesForUpdate:)] || [updaterDelegate updater:self.updater shouldDownloadReleaseNotesForUpdate:updateItem])) {
__weak __typeof__(self) weakSelf = self;
self.releaseNotesDriver = [[SPUReleaseNotesDriver alloc] initWithReleaseNotesURL:updateItem.releaseNotesURL httpHeaders:self.httpHeaders userAgent:self.userAgent host:self.host completionHandler:^(SPUDownloadData * _Nullable downloadData, NSError * _Nullable error) {
@@ -332,7 +325,7 @@
if (!willInstallImmediately) {
[self.userDriver showReadyToInstallAndRelaunch:^(SPUUserUpdateChoice choice) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.coreDriver finishInstallationWithResponse:choice displayingUserInterface:!self.preventsInstallerInteraction];
[self.coreDriver finishInstallationWithResponse:choice displayingUserInterface:YES];
});
}];
}
@@ -367,14 +360,16 @@
[self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
}
- (void)_abortUpdateWithError:(nullable NSError *)error
- (void)_abortUpdateWithError:(nullable NSError *)error showErrorToUser:(BOOL)showErrorToUser
{
void (^abortUpdate)(void) = ^{
[self.userDriver dismissUpdateInstallation];
if (showErrorToUser) {
[self.userDriver dismissUpdateInstallation];
}
[self.coreDriver abortUpdateAndShowNextUpdateImmediately:NO error:error];
};
if (error != nil) {
if (error != nil && showErrorToUser) {
NSError *nonNullError = error;
if (error.code == SUNoUpdateError) {
@@ -409,14 +404,14 @@
}
}
- (void)abortUpdateWithError:(nullable NSError *)error
- (void)abortUpdateWithError:(nullable NSError *)error showErrorToUser:(BOOL)showErrorToUser
{
if (self.releaseNotesDriver != nil) {
[self.releaseNotesDriver cleanup:^{
[self _abortUpdateWithError:error];
[self _abortUpdateWithError:error showErrorToUser:showErrorToUser];
}];
} else {
[self _abortUpdateWithError:error];
[self _abortUpdateWithError:error showErrorToUser:showErrorToUser];
}
}
+33
View File
@@ -0,0 +1,33 @@
//
// SPUUpdateCheck.h
// SPUUpdateCheck
//
// Created by Mayur Pawashe on 8/28/21.
// Copyright © 2021 Sparkle Project. All rights reserved.
//
#ifndef SPUUpdateCheck_h
#define SPUUpdateCheck_h
/**
Describes the type of update check being performed.
Each update check corresponds to an update check method on `SPUUpdater`.
*/
typedef NS_ENUM(NSInteger, SPUUpdateCheck)
{
/**
The user-initiated update check corresponding to `-[SPUUpdater checkForUpdates]`.
*/
SPUUpdateCheckUpdates = 0,
/**
The background scheduled update check corresponding to `-[SPUUpdater checkForUpdatesInBackground]`.
*/
SPUUpdateCheckUpdatesInBackground = 1,
/**
The informational probe update check corresponding to `-[SPUUpdater checkForUpdateInformation]`.
*/
SPUUpdateCheckUpdateInformation = 2
};
#endif /* SPUUpdateCheck_h */
+8 -4
View File
@@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol SPUResumableUpdate;
typedef void (^SPUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable resumableUpdate);
typedef void (^SPUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable resumableUpdate, NSError * _Nullable error);
// This protocol describes an update driver that drives updates
// An update driver may have multiple levels of other controller components (eg: basic update driver, core based update driver, ui based update driver, appcast driver, etc)
@@ -19,11 +19,15 @@ typedef void (^SPUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, id<S
// The newer architecture is still complex but should be more reliable to maintain and extend.
@protocol SPUUpdateDriver <NSObject>
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock;
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
- (void)setUpdateShownHandler:(void (^)(void))updateShownHandler;
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders;
- (void)resumeInstallingUpdate;
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate;
@property (nonatomic, readonly) BOOL showingUpdate;
+37 -7
View File
@@ -26,10 +26,19 @@ NS_ASSUME_NONNULL_BEGIN
/**
The main API in Sparkle for controlling the update mechanism.
This class is used to configure the update parameters as well as manually
and automatically schedule and control checks for updates.
This class is used to configure the update parameters as well as manually and automatically schedule and control checks for updates.
If you want to use a standard updater or instantiate an updater in a nib, see `SPUStandardUpdaterController` for convenience.
For convenience, you can create a standard or nib instantiable updater by using `SPUStandardUpdaterController`.
Prefer to set initial properties in your bundle's Info.plist as described in [Customizing Sparkle](https://sparkle-project.org/documentation/customization/).
Otherwise only if you need dynamic behavior (eg. for user preferences) should you set properties on the updater such as:
- `automaticallyChecksForUpdates`
- `updateCheckInterval`
- `automaticallyDownloadsUpdates`
- `feedURL`
Please view the documentation on each of these properties for more detail if you are to configure them dynamically.
*/
SU_EXPORT @interface SPUUpdater : NSObject
@@ -83,7 +92,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
This is meant for users initiating a new update check or checking the current update progress.
If an update hasn't started, the user may be shown that a new check for updates is occurring.
If an update has already been downloaded or begun installing, the user may be presented to install that update.
If an update has already been downloaded or begun installing from a previous session, the user may be presented to install that update.
If the user is already being presented with an update, that update will be shown to the user in active focus.
This will find updates that the user has previously opted into skipping.
@@ -95,12 +104,18 @@ SU_EXPORT @interface SPUUpdater : NSObject
/**
Checks for updates, but does not display any UI unless an update is found.
You usually do not need to call this method directly. If `automaticallyChecksForUpdates` is @c YES,
Sparkle calls this method automatically according to its update schedule using the `updateCheckInterval`
and the `lastUpdateCheckDate`.
This is meant for programmatically initating a check for updates.
That is, it will display no UI unless it finds an update, in which case it proceeds as usual.
This will not find updates that the user has opted into skipping.
Note if there is no resumable update found, and automated updating is turned on,
the update will be downloaded in the background without disrupting the user.
This method does not do anything if there is a `sessionInProgress`.
*/
- (void)checkForUpdatesInBackground;
@@ -113,7 +128,12 @@ SU_EXPORT @interface SPUUpdater : NSObject
`-[SPUUpdaterDelegate updaterDidNotFindUpdate:]` will be called,
so you can use that information in your UI.
`-[SPUUpdaterDelegate updater:didFinishUpdateCycleForUpdateCheck:error:]` will be called when
this probing check is completed.
Updates that have been skipped by the user will not be found.
This method does not do anything if there is a `sessionInProgress`.
*/
- (void)checkForUpdateInformation;
@@ -121,9 +141,12 @@ SU_EXPORT @interface SPUUpdater : NSObject
A property indicating whether or not updates can be checked by the user.
An update check can be made by the user when an update session isn't in progress, or when an update or its progress is being shown to the user.
A user cannot check for updates when data (such as the feed or an update) is still being downloaded automatically in the background.
This property is suitable to use for menu item validation for seeing if `-checkForUpdates` can be invoked.
This property is also KVO-compliant.
Note this property does not reflect whether or not an update session is in progress. Please see `sessionInProgress` property instead.
*/
@property (nonatomic, readonly) BOOL canCheckForUpdates;
@@ -133,13 +156,16 @@ SU_EXPORT @interface SPUUpdater : NSObject
An update session is in progress when the appcast is being downloaded, an update is being downloaded,
an update is being shown, update permission is being requested, or the installer is being started.
An active session is when Sparkle's fired scheduler is running.
Note an update session may be inactive even though Sparkle's installer (ran as a separate process) may be running,
Note an update session may not be running even though Sparkle's installer (ran as a separate process) may be running,
or even though the update has been downloaded but the installation has been deferred. In both of these cases, a new update session
may be activated with the update resumed at a later point (automatically or manually).
See also `canCheckForUpdates` property which is more suited for menu item validation.
See also:
- `canCheckForUpdates` property which is more suited for menu item validation and deciding if the user can initiate update checks.
- `-[SPUUpdaterDelegate updater:didFinishUpdateCycleForUpdateCheck:error:]` which lets the updater delegate know when an update cycle and session finishes.
*/
@property (nonatomic, readonly) BOOL sessionInProgress;
@@ -147,7 +173,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
A property indicating whether or not to check for updates automatically.
By default, Sparkle asks users on second launch for permission if they want automatic update checks enabled
and sets this property based on their response. If SUEnableAutomaticChecks is set in the Info.plist,
and sets this property based on their response. If `SUEnableAutomaticChecks` is set in the Info.plist,
this permission request is not performed however.
Setting this property will persist in the host bundle's user defaults.
@@ -244,6 +270,10 @@ SU_EXPORT @interface SPUUpdater : NSObject
/**
The date of the last update check or nil if no check has been performed yet.
For testing purposes, the last update check is stored in the `SULastCheckTime` key in the host bundle's user defaults.
For example, `defaults delete my-bundle-id SULastCheckTime` can be invoked to clear the last update check time and test
if update checks are automatically scheduled.
*/
@property (nonatomic, readonly, copy, nullable) NSDate *lastUpdateCheckDate;
+230 -122
View File
@@ -15,6 +15,7 @@
#import "SPUUpdateDriver.h"
#import "SUConstants.h"
#import "SULog.h"
#import "SULog+NSError.h"
#import "SUCodeSigningVerifier.h"
#import "SUSystemProfiler.h"
#import "SPUScheduledUpdateDriver.h"
@@ -57,6 +58,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@property (nonatomic) BOOL startedUpdater;
@property (nonatomic, nullable) id<SPUResumableUpdate> resumableUpdate;
@property (nonatomic) BOOL sessionInProgress;
@property (nonatomic) BOOL canCheckForUpdates;
@property (nonatomic) BOOL showingPermissionRequest;
@property (nonatomic, copy) NSDate *updateLastCheckedDate;
@@ -82,6 +84,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@synthesize startedUpdater = _startedUpdater;
@synthesize resumableUpdate = _resumableUpdate;
@synthesize sessionInProgress = _sessionInProgress;
@synthesize canCheckForUpdates = _canCheckForUpdates;
@synthesize showingPermissionRequest = _showingPermissionRequest;
@synthesize updateLastCheckedDate = _updateLastCheckedDate;
@synthesize loggedATSWarning = _loggedATSWarning;
@@ -149,11 +152,12 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
return YES;
}
if (![self checkIfConfiguredProperlyAndRequireFeedURL:NO error:error]) {
if (![self checkIfConfiguredProperlyAndRequireFeedURL:NO validateXPCServices:YES error:error]) {
return NO;
}
self.startedUpdater = YES;
self.canCheckForUpdates = YES;
// Start updater on next update cycle so we make sure the application invoking the updater is ready
// This also gives the developer a cycle to check for updates before Sparkle's update cycle scheduler kicks in
@@ -179,7 +183,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
return ([bundle objectForInfoDictionaryKey:@"NSAppTransportSecurity"] == nil);
}
- (BOOL)checkIfConfiguredProperlyAndRequireFeedURL:(BOOL)requireFeedURL error:(NSError * __autoreleasing *)error
- (BOOL)checkIfConfiguredProperlyAndRequireFeedURL:(BOOL)requireFeedURL validateXPCServices:(BOOL)validateXPCServices error:(NSError * __autoreleasing *)error
{
NSString *hostName = self.host.name;
@@ -204,6 +208,44 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
return NO;
}
NSBundle *mainBundle = [NSBundle mainBundle];
if (validateXPCServices) {
// Check that all enabled XPC Services are embedded
SUHost *mainBundleHost = [[SUHost alloc] initWithBundle:mainBundle];
NSArray<NSString *> *xpcServiceIDs = @[@INSTALLER_LAUNCHER_BUNDLE_ID, @DOWNLOADER_BUNDLE_ID, @INSTALLER_CONNECTION_BUNDLE_ID, @INSTALLER_STATUS_BUNDLE_ID];
NSArray<NSString *> *xpcServiceEnabledKeys = @[SUEnableInstallerLauncherServiceKey, SUEnableDownloaderServiceKey, SUEnableInstallerConnectionServiceKey, SUEnableInstallerStatusServiceKey];
NSUInteger xpcServiceCount = xpcServiceIDs.count;
for (NSUInteger xpcServiceIndex = 0; xpcServiceIndex < xpcServiceCount; xpcServiceIndex++) {
NSString *xpcServiceEnabledKey = xpcServiceEnabledKeys[xpcServiceIndex];
NSString *xpcServiceBundleName = [xpcServiceIDs[xpcServiceIndex] stringByAppendingPathExtension:@"xpc"];
if ([mainBundleHost boolForInfoDictionaryKey:xpcServiceEnabledKey]) {
NSURL *xpcServiceBundleURL = [[self.sparkleBundle.bundleURL URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:xpcServiceBundleName];
if (![xpcServiceBundleURL checkResourceIsReachableAndReturnError:NULL]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidUpdaterError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"XPC Service is enabled (%@) but does not exist: %@", xpcServiceEnabledKey, xpcServiceBundleURL.path] }];
}
return NO;
}
}
// Make sure the app isn't bundling XPC Services directly
NSURL *mainBundleXPCServiceURL = [[[mainBundle.bundleURL URLByAppendingPathComponent:@"Contents"] URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:xpcServiceBundleName];
if ([mainBundleXPCServiceURL checkResourceIsReachableAndReturnError:NULL]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidUpdaterError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"XPC Service (%@) must be in the Sparkle framework, not in the application bundle (%@). Please visit https://sparkle-project.org/documentation/sandboxing/ for up to date Sandboxing instructions.", xpcServiceBundleName, mainBundleXPCServiceURL.path] }];
}
return NO;
}
}
}
BOOL servingOverHttps = NO;
NSError *feedError = nil;
NSURL *feedURL = [self retrieveFeedURL:&feedError];
@@ -216,17 +258,27 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
}
}
NSBundle *mainBundle = [NSBundle mainBundle];
BOOL test;
BOOL updatingMainBundle = [self.host.bundle isEqualTo:mainBundle];
if (feedURL != nil) {
servingOverHttps = [[[feedURL scheme] lowercaseString] isEqualToString:@"https"];
if (!servingOverHttps) {
BOOL foundXPCPersistentDownloaderService = NO;
BOOL foundATSPersistentIssue = [self checkATSIssueForBundle:SPUXPCServiceBundle(@DOWNLOADER_BUNDLE_ID) getBundleExists:&foundXPCPersistentDownloaderService];
if (!servingOverHttps && !self.loggedATSWarning) {
BOOL foundXPCDownloaderService = NO;
SUHost *mainBundleHost = [[SUHost alloc] initWithBundle:mainBundle];
NSBundle *downloaderBundle;
if ([mainBundleHost boolForInfoDictionaryKey:SUEnableDownloaderServiceKey]) {
NSURL *downloaderServiceBundleURL = [[[self.sparkleBundle.bundleURL URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:@DOWNLOADER_BUNDLE_ID] URLByAppendingPathExtension:@"xpc"];
downloaderBundle = [NSBundle bundleWithURL:downloaderServiceBundleURL];
} else {
downloaderBundle = nil;
}
BOOL foundATSPersistentIssue = [self checkATSIssueForBundle:downloaderBundle getBundleExists:&foundXPCDownloaderService];
BOOL foundATSMainBundleIssue = NO;
if (!foundATSPersistentIssue && !foundXPCPersistentDownloaderService) {
if (!foundATSPersistentIssue && !foundXPCDownloaderService) {
BOOL foundATSIssue = ([mainBundle objectForInfoDictionaryKey:@"NSAppTransportSecurity"] == nil);
if (updatingMainBundle) {
@@ -237,12 +289,10 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
}
if (foundATSPersistentIssue || foundATSMainBundleIssue) {
if (!self.loggedATSWarning) {
// Just log a warning. Don't outright fail in case we are wrong (eg: app is linked on an old SDK where ATS doesn't take effect)
SULog(SULogLevelDefault, @"The feed URL (%@) may need to change to use HTTPS.\nFor more information: https://sparkle-project.org/documentation/app-transport-security", [feedURL absoluteString]);
self.loggedATSWarning = YES;
}
// Just log a warning. Don't outright fail in case we are wrong (eg: app is linked on an old SDK where ATS doesn't take effect)
SULog(SULogLevelDefault, @"The feed URL (%@) may need to change to use HTTPS.\nFor more information: https://sparkle-project.org/documentation/app-transport-security", [feedURL absoluteString]);
self.loggedATSWarning = YES;
}
}
}
@@ -290,13 +340,6 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
}
}
// Check XPC Services are functional
for (NSString *xpcServiceID in @[@INSTALLER_LAUNCHER_BUNDLE_ID, @DOWNLOADER_BUNDLE_ID, @INSTALLER_CONNECTION_BUNDLE_ID, @INSTALLER_STATUS_BUNDLE_ID]) {
if (!SPUXPCValidateServiceIfBundleExists(xpcServiceID, self.sparkleBundle, error)) {
return NO;
}
}
return YES;
}
@@ -340,6 +383,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
self.showingPermissionRequest = YES;
self.sessionInProgress = YES;
self.canCheckForUpdates = YES;
__weak SPUUpdater *weakSelf = self;
[self.userDriver showUpdatePermissionRequest:updatePermissionRequest reply:^(SUUpdatePermissionResponse *response) {
@@ -359,7 +403,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
// We start the update checks and register as observer for changes after the prompt finishes
} else {
// We check if the user's said they want updates, or they haven't said anything, and the default is set to checking.
[self scheduleNextUpdateCheck];
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:YES];
}
}
@@ -388,17 +432,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
[self didChangeValueForKey:NSStringFromSelector(@selector((lastUpdateCheckDate)))];
}
- (void)scheduleNextUpdateCheck
{
[self scheduleNextUpdateCheckFiringImmediately:NO];
}
- (BOOL)canCheckForUpdates
{
return self.startedUpdater && (self.showingPermissionRequest || self.driver.showingUpdate || !self.sessionInProgress);
}
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately
// Note this method is never called when sessionInProgress is YES
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately usingCurrentTime:(BOOL)usingCurrentTime
{
[self.updaterTimer invalidate];
@@ -412,14 +447,54 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
if (firingImmediately) {
[self checkForUpdatesInBackground];
} else {
[self retrieveNextUpdateCheckInterval:^(NSTimeInterval updateCheckInterval) {
// This may not return the same update check interval as the developer has configured
// Notably it may differ when we have an update that has been already downloaded and needs to resume,
// as well as if that update is marked critical or not
void (^retrieveNextUpdateCheckInterval)(void (^)(NSTimeInterval)) = ^(void (^completionHandler)(NSTimeInterval)) {
NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier;
assert(hostBundleIdentifier != nil);
[SPUProbeInstallStatus probeInstallerUpdateItemForHostBundleIdentifier:hostBundleIdentifier completion:^(SPUInstallationInfo * _Nullable installationInfo) {
dispatch_async(dispatch_get_main_queue(), ^{
NSTimeInterval regularCheckInterval = [self updateCheckInterval];
if (installationInfo == nil) {
// Proceed as normal if there's no resumable updates
completionHandler(regularCheckInterval);
} else {
if (!installationInfo.canSilentlyInstall || [installationInfo.appcastItem isCriticalUpdate] || [installationInfo.appcastItem isInformationOnlyUpdate]) {
completionHandler(MIN(regularCheckInterval, SUImpatientUpdateCheckInterval));
} else {
completionHandler(MAX(regularCheckInterval, SUImpatientUpdateCheckInterval));
}
}
});
}];
};
self.canCheckForUpdates = NO;
self.sessionInProgress = YES;
retrieveNextUpdateCheckInterval(^(NSTimeInterval updateCheckInterval) {
self.canCheckForUpdates = YES;
self.sessionInProgress = NO;
// This callback is asynchronous, so the timer may be set. Invalidate to make sure it isn't.
[self.updaterTimer invalidate];
// How long has it been since last we checked for an update?
NSDate *lastCheckDate = [self lastUpdateCheckDate];
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
NSTimeInterval intervalSinceCheck = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
NSTimeInterval intervalSinceCheck;
if (usingCurrentTime) {
// How long has it been since last we checked for an update?
NSDate *lastCheckDate = [self lastUpdateCheckDate];
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
intervalSinceCheck = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
if (intervalSinceCheck < 0) {
// Last update check date is in the future and bogus, so reset it to current date
[self updateLastUpdateCheckDate];
intervalSinceCheck = 0;
}
} else {
intervalSinceCheck = 0;
}
// Now we want to figure out how long until we check again.
if (updateCheckInterval < SUMinimumUpdateCheckInterval)
@@ -434,7 +509,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
// We're overdue! Run one now.
[self checkForUpdatesInBackground];
}
}];
});
}
}
@@ -456,6 +531,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
}
self.sessionInProgress = YES;
self.canCheckForUpdates = NO;
// We don't want the probe check to act on the driver if the updater is going near death
__weak SPUUpdater *weakSelf = self;
@@ -488,14 +564,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
updaterDelegate:strongSelf.delegate];
}
BOOL preventsInstallerInteraction;
if ([strongSelf.delegate respondsToSelector:@selector(updater:shouldAllowInstallerInteractionForUpdateCheck:)]) {
preventsInstallerInteraction = ![strongSelf.delegate updater:strongSelf shouldAllowInstallerInteractionForUpdateCheck:SPUUpdateCheckBackgroundScheduled];
} else {
preventsInstallerInteraction = NO;
}
[strongSelf checkForUpdatesWithDriver:updateDriver installerInProgress:installerIsRunning preventsInstallerInteraction:preventsInstallerInteraction];
[strongSelf checkForUpdatesWithDriver:updateDriver updateCheck:SPUUpdateCheckUpdatesInBackground installerInProgress:installerIsRunning];
});
}];
}
@@ -524,6 +593,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
}
self.sessionInProgress = YES;
self.canCheckForUpdates = NO;
id <SPUUpdateDriver> theUpdateDriver = [[SPUUserInitiatedUpdateDriver alloc] initWithHost:self.host applicationBundle:self.applicationBundle updater:self userDriver:self.userDriver updaterDelegate:self.delegate];
@@ -535,14 +605,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
dispatch_async(dispatch_get_main_queue(), ^{
SPUUpdater *strongSelf = weakSelf;
if (strongSelf != nil) {
BOOL preventsInstallerInteraction;
if ([strongSelf.delegate respondsToSelector:@selector(updater:shouldAllowInstallerInteractionForUpdateCheck:)]) {
preventsInstallerInteraction = ![strongSelf.delegate updater:strongSelf shouldAllowInstallerInteractionForUpdateCheck:SPUUpdateCheckUserInitiated];
} else {
preventsInstallerInteraction = NO;
}
[strongSelf checkForUpdatesWithDriver:theUpdateDriver installerInProgress:installerInProgress preventsInstallerInteraction:preventsInstallerInteraction];
[strongSelf checkForUpdatesWithDriver:theUpdateDriver updateCheck:SPUUpdateCheckUpdates installerInProgress:installerInProgress];
}
});
}];
@@ -562,6 +625,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
}
self.sessionInProgress = YES;
self.canCheckForUpdates = NO;
NSString *bundleIdentifier = self.host.bundle.bundleIdentifier;
assert(bundleIdentifier != nil);
@@ -569,14 +633,15 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
dispatch_async(dispatch_get_main_queue(), ^{
SPUUpdater *strongSelf = weakSelf;
if (strongSelf != nil) {
[strongSelf checkForUpdatesWithDriver:[[SPUProbingUpdateDriver alloc] initWithHost:strongSelf.host updater:strongSelf updaterDelegate:strongSelf.delegate] installerInProgress:installerInProgress preventsInstallerInteraction:NO];
[strongSelf checkForUpdatesWithDriver:[[SPUProbingUpdateDriver alloc] initWithHost:strongSelf.host updater:strongSelf updaterDelegate:strongSelf.delegate] updateCheck:SPUUpdateCheckUpdateInformation installerInProgress:installerInProgress];
}
});
}];
}
- (void)checkForUpdatesWithDriver:(id <SPUUpdateDriver> )d installerInProgress:(BOOL)installerInProgress preventsInstallerInteraction:(BOOL)preventsInstallerInteraction
- (void)checkForUpdatesWithDriver:(id <SPUUpdateDriver> )d updateCheck:(SPUUpdateCheck)updateCheck installerInProgress:(BOOL)installerInProgress
{
assert(self.driver == nil);
if (self.driver != nil) {
return;
}
@@ -585,57 +650,124 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
[self updateLastUpdateCheckDate];
if( [self.delegate respondsToSelector: @selector((updaterMayCheckForUpdates:))] && ![self.delegate updaterMayCheckForUpdates:self] )
{
self.sessionInProgress = NO;
[self scheduleNextUpdateCheck];
return;
}
self.driver = d;
assert(self.driver != nil);
// Because an application can change the configuration (eg: the feed url) at any point, we should always check if it's valid
NSError *configurationError = nil;
if (![self checkIfConfiguredProperlyAndRequireFeedURL:YES error:&configurationError]) {
// Don't think we should schedule a next update check if the bundle has been misconfigured once,
// which would mean something is really off
SULog(SULogLevelError, @"Sparkle configuration error (%ld): %@", (long)configurationError.code, configurationError.localizedDescription);
SULog(SULogLevelDefault, @"Disabling scheduled updates..");
void (^notifyDelegateOfDriverCompletion)(NSError * _Nullable, BOOL) = ^(NSError * _Nullable error, BOOL shouldShowUpdateImmediately) {
if (error != nil) {
if (error.code != SUNoUpdateError && error.code != SUInstallationCanceledError && error.code != SUInstallationAuthorizeLaterError) { // Let's not bother logging this.
SULogError(error);
}
// Notify host app that update driver has aborted if a non-recoverable error occurs
if (error.code != SUInstallationAuthorizeLaterError && [self.delegate respondsToSelector:@selector((updater:didAbortWithError:))]) {
[self.delegate updater:self didAbortWithError:(NSError * _Nonnull)error];
}
}
self.sessionInProgress = NO;
[self.driver abortUpdateWithError:configurationError];
self.driver = nil;
// Notify host app that update driver has finished
// As long as we're not going to immmediately kick off a new check
if (!shouldShowUpdateImmediately && [self.delegate respondsToSelector:@selector((updater:didFinishUpdateCycleForUpdateCheck:error:))]) {
[self.delegate updater:self didFinishUpdateCycleForUpdateCheck:updateCheck error:error];
}
};
void (^abortUpdateDriver)(NSError * _Nullable , BOOL) = ^(NSError * _Nullable abortError, BOOL shouldScheduleNextUpdateCheck) {
__weak SPUUpdater *weakSelf = self;
[self.driver setCompletionHandler:^(BOOL __unused shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable __unused resumableUpdate, NSError * _Nullable error) {
SPUUpdater *strongSelf = weakSelf;
if (strongSelf != nil) {
strongSelf.driver = nil;
[strongSelf updateLastUpdateCheckDate];
strongSelf.sessionInProgress = NO;
strongSelf.canCheckForUpdates = YES;
notifyDelegateOfDriverCompletion(error, NO);
// Ensure the delegate doesn't start a new session when being notified of the previous one ending
if (!strongSelf.sessionInProgress) {
if (shouldScheduleNextUpdateCheck) {
[strongSelf scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:NO];
} else {
SULog(SULogLevelDefault, @"Disabling scheduled updates..");
}
}
}
}];
[self.driver abortUpdateWithError:abortError];
};
// Check if the delegate wants to defer checking for updates
NSError *mayCheckForUpdatesError = nil;
if (
([self.delegate respondsToSelector:@selector(updater:mayPerformUpdateCheck:error:)] && ![self.delegate updater:self mayPerformUpdateCheck:updateCheck error:&mayCheckForUpdatesError]) ||
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
([self.delegate respondsToSelector:@selector((updaterMayCheckForUpdates:))] && ![self.delegate updaterMayCheckForUpdates:self]))
#pragma clang diagnostic pop
{
abortUpdateDriver(mayCheckForUpdatesError, YES);
return;
}
NSURL *theFeedURL = [self parameterizedFeedURL];
if (theFeedURL) {
__weak SPUUpdater *weakSelf = self;
SPUUpdateDriverCompletion completionBlock = ^(BOOL shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable resumableUpdate) {
SPUUpdater *strongSelf = weakSelf;
if (strongSelf != nil) {
strongSelf.resumableUpdate = resumableUpdate;
strongSelf.driver = nil;
self.sessionInProgress = NO;
[strongSelf updateLastUpdateCheckDate];
[strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately];
}
};
// Because an application can change the configuration (eg: the feed url) at any point, we should always check if it's valid
// We will not schedule a next update check if the bundle is misconfigured
NSError *configurationError = nil;
if (![self checkIfConfiguredProperlyAndRequireFeedURL:YES validateXPCServices:NO error:&configurationError]) {
SULog(SULogLevelError, @"Sparkle configuration error (%ld): %@", (long)configurationError.code, configurationError.localizedDescription);
if (installerInProgress) {
[self.driver resumeInstallingUpdateWithCompletion:completionBlock];
} else if (self.resumableUpdate != nil) {
[self.driver resumeUpdate:(id<SPUResumableUpdate> _Nonnull)self.resumableUpdate completion:completionBlock];
} else {
[self.driver checkForUpdatesAtAppcastURL:theFeedURL withUserAgent:[self userAgentString] httpHeaders:[self httpHeaders] preventingInstallerInteraction:preventsInstallerInteraction completion:completionBlock];
abortUpdateDriver(configurationError, NO);
return;
}
// Run our update driver and schedule next update check on its completion
__weak SPUUpdater *weakSelf = self;
[self.driver setCompletionHandler:^(BOOL shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable resumableUpdate, NSError * _Nullable error) {
SPUUpdater *strongSelf = weakSelf;
if (strongSelf != nil) {
strongSelf.resumableUpdate = resumableUpdate;
strongSelf.driver = nil;
[strongSelf updateLastUpdateCheckDate];
strongSelf.sessionInProgress = NO;
strongSelf.canCheckForUpdates = YES;
notifyDelegateOfDriverCompletion(error, shouldShowUpdateImmediately);
// Ensure the delegate doesn't start a new session when being notified of the previous one ending
if (!strongSelf.sessionInProgress) {
[strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately usingCurrentTime:NO];
}
}
}];
[self.driver setUpdateShownHandler:^{
weakSelf.canCheckForUpdates = YES;
}];
if (installerInProgress) {
// Resume an update that has already begun installing in the background
[self.driver resumeInstallingUpdate];
} else if (self.resumableUpdate != nil) {
// Resume an update or info that has already been downloaded
[self.driver resumeUpdate:(id<SPUResumableUpdate> _Nonnull)self.resumableUpdate];
} else {
// I think this is really unlikely to occur but better be safe
[self.driver abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidFeedURLError userInfo:@{ NSLocalizedDescriptionKey: @"Sparkle cannot form a valid feed URL." }]];
self.sessionInProgress = NO;
self.driver = nil;
// Check that the parameterized feed URL is valid
NSURL *theFeedURL = [self parameterizedFeedURL];
if (theFeedURL == nil) {
// I think this is really unlikely to occur but better be safe
// We will not schedule a next update check if the feed URL cannot be formed
SULog(SULogLevelError, @"Error: failed to retrieve feed URL for bundle");
abortUpdateDriver([NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidFeedURLError userInfo:@{ NSLocalizedDescriptionKey: @"Sparkle cannot form a valid feed URL." }], NO);
} else {
// Check for new updates
[self.driver checkForUpdatesAtAppcastURL:theFeedURL withUserAgent:[self userAgentString] httpHeaders:[self httpHeaders]];
}
}
}
@@ -653,7 +785,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
if (!self.sessionInProgress) {
[self cancelNextUpdateCycle];
[self scheduleNextUpdateCheck];
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:YES];
}
}
@@ -890,30 +1022,6 @@ static NSString *escapeURLComponent(NSString *str) {
return [self.updaterSettings updateCheckInterval];
}
// This may not return the same update check interval as the developer has configured
// Notably it may differ when we have an update that has been already downloaded and needs to resume,
// as well as if that update is marked critical or not
- (void)retrieveNextUpdateCheckInterval:(void (^)(NSTimeInterval))completionHandler
{
NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier;
assert(hostBundleIdentifier != nil);
[SPUProbeInstallStatus probeInstallerUpdateItemForHostBundleIdentifier:hostBundleIdentifier completion:^(SPUInstallationInfo * _Nullable installationInfo) {
dispatch_async(dispatch_get_main_queue(), ^{
NSTimeInterval regularCheckInterval = [self updateCheckInterval];
if (installationInfo == nil) {
// Proceed as normal if there's no resumable updates
completionHandler(regularCheckInterval);
} else {
if (!installationInfo.canSilentlyInstall || [installationInfo.appcastItem isCriticalUpdate] || [installationInfo.appcastItem isInformationOnlyUpdate]) {
completionHandler(MIN(regularCheckInterval, SUImpatientUpdateCheckInterval));
} else {
completionHandler(MAX(regularCheckInterval, SUImpatientUpdateCheckInterval));
}
}
});
}];
}
- (void)dealloc
{
// Stop checking for updates
+65 -41
View File
@@ -15,6 +15,7 @@
#import <Foundation/Foundation.h>
#endif
#import <Sparkle/SUExport.h>
#import <Sparkle/SPUUpdateCheck.h>
@protocol SUVersionComparison;
@class SPUUpdater, SUAppcast, SUAppcastItem;
@@ -57,12 +58,6 @@ SU_EXPORT extern NSString *const SUSystemProfilerPreferredLanguageKey;
// SPUUpdater Delegate:
// -----------------------------------------------------------------------------
typedef NS_ENUM(NSInteger, SPUUpdateCheck)
{
SPUUpdateCheckUserInitiated = 0,
SPUUpdateCheckBackgroundScheduled = 1
};
/**
Provides delegation methods to control the behavior of an `SPUUpdater` object.
*/
@@ -70,15 +65,17 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
@optional
/**
Returns whether to allow Sparkle to pop up.
Returns whether to allow Sparkle to check for updates.
For example, this may be used to prevent Sparkle from interrupting a setup assistant.
Alternatively, you may want to consider starting the updater after eg: the setup assistant finishes
@param updater The updater instance.
@return @c YES if the updater may check for updates otherwise @c NO
*/
- (BOOL)updaterMayCheckForUpdates:(SPUUpdater *)updater;
@param updateCheck The type of update check that will be performed if the updater is allowed to check for updates.
@param error The (optionally) populated error object if the updater may not perform a new update check.
@return @c YES if the updater is allowed to check for updates, otherwise @c NO
*/
- (BOOL)updater:(SPUUpdater *)updater mayPerformUpdateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error;
/**
Returns the set of Sparkle channels the updater is allowed to find new updates from.
@@ -107,12 +104,12 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
- (NSSet<NSString *> *)allowedChannelsForUpdater:(SPUUpdater *)updater;
/**
Returns a custom appcast URL.
Returns a custom appcast URL used for checking for new updates.
Override this to dynamically specify the feed URL.
@param updater The updater instance.
@return An appcast feed URL to check for new updates in. Return @c nil for the default behavior and if you don't want to be delegated this task.
@return An appcast feed URL to check for new updates in, or @c nil for the default behavior and if you don't want to be delegated this task.
*/
- (nullable NSString *)feedURLStringForUpdater:(SPUUpdater *)updater;
@@ -128,14 +125,13 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
*/
- (NSArray<NSDictionary<NSString *, NSString *> *> *)feedParametersForUpdater:(SPUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
/**
Returns whether Sparkle should prompt the user about automatic update checks.
Returns whether Sparkle should prompt the user about checking for new updates automatically.
Use this to override the default behavior.
@param updater The updater instance.
@return @c YES if the updater should prompt for permission to check for updates, otherwise @c NO
@return @c YES if the updater should prompt for permission to check for new updates automatically, otherwise @c NO
*/
- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SPUUpdater *)updater;
@@ -224,6 +220,21 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
*/
- (nullable SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SPUUpdater *)updater;
/**
Returns whether or not the updater should proceed with the new chosen update from the appcast.
By default, the updater will always proceed with the best selected update found in an appcast. Override this to override this behavior.
If you return @c NO and populate the @c error, the user is not shown this @c updateItem nor is the update downloaded or installed.
@param updater The updater instance.
@param updateItem The selected update item to proceed with.
@param updateCheck The type of update check that would be performed if proceeded.
@param error An error object that must be populated by the delegate if the updater should not proceed with the update.
@return @c YES if the updater should proceed with @c updateItem, otherwise @c NO if the updater should not proceed with the update with an @c error populated.
*/
- (BOOL)updater:(SPUUpdater *)updater shouldProceedWithUpdate:(SUAppcastItem *)updateItem updateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error;
/**
Called when an update is skipped by the user.
@@ -238,10 +249,11 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
This is specifically for the @c <releaseNotesLink> element in the appcast item.
@param updater The updater instance.
@param updateItem The update item to download and show release notes from.
@return @c YES to download and show the release notes if available, otherwise @c NO. The default behavior is @c YES.
*/
- (BOOL)updaterShouldDownloadReleaseNotes:(SPUUpdater *)updater;
- (BOOL)updater:(SPUUpdater *)updater shouldDownloadReleaseNotesForUpdate:(SUAppcastItem *)updateItem;
/**
Called immediately before downloading the specified update.
@@ -270,7 +282,7 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
- (void)updater:(SPUUpdater *)updater failedToDownloadUpdate:(SUAppcastItem *)item error:(NSError *)error;
/**
Called when the user clicks the cancel button while and update is being downloaded.
Called when the user cancels an update while it is being downloaded.
@param updater The updater instance.
*/
@@ -312,14 +324,14 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
@param item The appcast item corresponding to the update that is proposed to be installed.
@param installHandler The install handler that must be completed before continuing with the relaunch.
@return @c YES to delay the relaunch until @p installHandler is invoked.
@return @c YES to delay the relaunch until @c installHandler is invoked.
*/
- (BOOL)updater:(SPUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)item untilInvokingBlock:(void (^)(void))installHandler;
/**
Returns whether the application should be relaunched at all.
Some apps @b cannot be relaunched under certain circumstances.
Some apps **cannot** be relaunched under certain circumstances.
This method can be used to explicitly prevent a relaunch.
@param updater The updater instance.
@@ -369,25 +381,6 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
*/
- (void)updaterWillNotScheduleUpdateCheck:(SPUUpdater *)updater;
/**
Returns whether or not the updater should allow interaction from the installer
Use this to override the default behavior which is to allow interaction with the installer.
If interaction is allowed, then an authorization prompt may show up to the user if they do
not curently have sufficient privileges to perform the installation of the new update.
The installer may also show UI and progress when interaction is allowed.
On the other hand, if interaction is not allowed, then an installation may fail if the user does not
have sufficient privileges to perform the installation. In this case, the feed and update may not even be downloaded.
Note this has no effect if the update has already been downloaded in the background silently and ready to be resumed.
@param updater The updater instance.
@param updateCheck The type of update check being performed.
*/
- (BOOL)updater:(SPUUpdater *)updater shouldAllowInstallerInteractionForUpdateCheck:(SPUUpdateCheck)updateCheck;
/**
Returns the decryption password (if any) which is used to extract the update archive DMG.
@@ -405,7 +398,7 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
Also if the updater is given responsibility and the update item is marked critical, the new update will be presented to the user immediately after.
Even if the @p immediateInstallHandler is not invoked, the installer will attempt to install the update on termination.
Even if the @c immediateInstallHandler is not invoked, the installer will attempt to install the update on termination.
@param updater The updater instance.
@param item The appcast item corresponding to the update that is proposed to be installed.
@@ -415,13 +408,44 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
- (BOOL)updater:(SPUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)item immediateInstallationBlock:(void (^)(void))immediateInstallHandler;
/**
Called after an update is aborted due to an error.
Called after the update driver aborts due to an error.
The update driver runs when checking for updates. This delegate method is called an error occurs during this process.
Some special possible values of `error.code` are:
- `SUNoUpdateError`: No new update was found.
- `SUInstallationCanceledError`: The user canceled installing the update when requested for authorization.
@param updater The updater instance.
@param error The error that caused the abort
@param error The error that caused the update driver to abort.
*/
- (void)updater:(SPUUpdater *)updater didAbortWithError:(NSError *)error;
/**
Called after the update driver finishes.
The update driver runs when checking for updates. This delegate method is called when that check is finished.
An update may be scheduled to be installed during the update cycle, or no updates may be found, or an available update may be dismissed or skipped (which is the same as no error).
If the @c error is @c nil, no error has occurred.
Some special possible values of `error.code` are:
- `SUNoUpdateError`: No new update was found.
- `SUInstallationCanceledError`: The user canceled installing the update when requested for authorization.
@param updater The updater instance.
@param updateCheck The type of update check was performed.
@param error The error that caused the update driver to abort. This is @c nil if the update driver finished normally and there is no error.
*/
- (void)updater:(SPUUpdater *)updater didFinishUpdateCycleForUpdateCheck:(SPUUpdateCheck)updateCheck error:(nullable NSError *)error;
/* Deprecated methods */
- (BOOL)updaterMayCheckForUpdates:(SPUUpdater *)updater __deprecated_msg("Please use -[SPUUpdaterDelegate updater:mayPerformUpdateCheck:error:] instead.");
@end
NS_ASSUME_NONNULL_END
+20 -15
View File
@@ -58,17 +58,17 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
* Let the user know a new update is found and ask them what they want to do.
* Before this point, `-showUserInitiatedUpdateCheckWithCancellation:` may be called.
*
* @param appcastItem The Appcast Item containing information that reflects the new update.
* The potential `stage`s on the updater @c state are:
*
* @param state The current state of the user update.
* The state.stage values are:
* `SPUUpdateStateNotDownloaded` - Update has not been downloaded yet.
*
* `SPUUpdateStateDownloaded` - Update has already been downloaded but not started installing yet.
*
* `SPUUpdateStateInstalling` - Update has been downloaded and already started installing.
*
* state.userInitiated indicates if the update was initiated by the user or if it was automatically scheduled in the background.
* The `userIntiated` property on the @c state indicates if the update was initiated by the user or if it was automatically scheduled in the background.
*
* Additionally, these properties on the appcastItem are of importance:
* Additionally, these properties on the @c appcastItem are of importance:
*
* @c appcastItem.informationOnlyUpdate indicates if the update is only informational and should not be downloaded. You can direct the user to the infoURL property of the appcastItem in their web browser. Sometimes information only updates are used as a fallback in case a bad update is shipped, so you'll want to support this case.
*
@@ -76,9 +76,9 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
*
* @c appcastItem.criticalUpdate indicates if the update is a critical update.
*
* @param reply
* A reply of `SPUUserUpdateChoiceInstall` begins or resumes downloading or installing the update.
* If the state.stage is `SPUUserUpdateStateInstalling`, this may send a quit event to the application and relaunch it immediately (in this state, this behaves as a fast "install and Relaunch"). Do not use this reply if @c appcastItem.informationOnlyUpdate is YES.
* If the state.stage is `SPUUserUpdateStateInstalling`, this may send a quit event to the application and relaunch it immediately (in this state, this behaves as a fast "install and Relaunch").
* Do not use this reply if @c appcastItem.informationOnlyUpdate is YES.
*
* A reply of `SPUUserUpdateChoiceDismiss` dismisses the update for the time being. The user may be reminded of the update at a later point.
* If the state.stage is `SPUUserUpdateStateDownloaded`, the downloaded update is kept after dismissing until the next time an update is shown to the user.
@@ -87,6 +87,10 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
* A reply of `SPUUserUpdateChoiceSkip` skips this particular version and won't notify the user again, unless they initiate an update check themselves.
* If @c appcastItem.majorUpgrade is YES, the major update and any future minor updates to that major release are skipped.
* If the state.stage is `SPUUpdateStateInstalling`, the installation is also canceled when the update is skipped.
*
* @param appcastItem The Appcast Item containing information that reflects the new update.
* @param state The current state of the user update. See above discussion for notable properties.
* @param reply The reply which indicates if the update should be installed, dismissed, or skipped. See above discussion for more details.
*/
- (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem state:(SPUUserUpdateState *)state reply:(void (^)(SPUUserUpdateChoice))reply;
@@ -118,17 +122,17 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
* Let the user know a new update was not found after they tried initiating an update check.
* Before this point, `-showUserInitiatedUpdateCheckWithCancellation:` may be called.
*
* @param error The error associated with why a new update was not found.
* There are various reasons a new update is unavailable and can't be installed.
* This error object is populated with recovery and suggestion strings suitable to be shown in an alert.
* There are various reasons a new update is unavailable and can't be installed.
* The @c error object is populated with recovery and suggestion strings suitable to be shown in an alert.
*
* The userInfo dictionary is also populated with two keys:
* The @c userInfo dictionary on the @c error is also populated with two keys:
*
* `SPULatestAppcastItemFoundKey`: if available, this may provide the latest SUAppcastItem that was found.
* `SPULatestAppcastItemFoundKey`: if available, this may provide the latest SUAppcastItem that was found.
*
* `SPUNoUpdateFoundReasonKey`: if available, this will provide the `SUNoUpdateFoundReason`. For example the reason could be because
* the latest version in the feed requires a newer OS version or could be because the user is already on the latest version.
* `SPUNoUpdateFoundReasonKey`: if available, this will provide the `SUNoUpdateFoundReason`. For example the reason could be because
* the latest version in the feed requires a newer OS version or could be because the user is already on the latest version.
*
* @param error The error associated with why a new update was not found. See above discussion for more details.
* @param acknowledgement Acknowledge to the updater that no update found error was shown.
*/
- (void)showUpdateNotFoundWithError:(NSError *)error acknowledgement:(void (^)(void))acknowledgement;
@@ -208,7 +212,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
* Let the user know that the update is ready to install and relaunch, and ask them whether they want to proceed.
* Note if the target application has already terminated, this method may not be invoked.
*
* @param reply
* A reply of `SPUUserUpdateChoiceInstall` installs the update the new update immediately. The application is relaunched only if it is still running by the time this reply is invoked. If the application terminates on its own, Sparkle will attempt to automatically install the update.
*
* A reply of `SPUUserUpdateChoiceDismiss` dismisses the update installation for the time being. Note the update may still be installed automatically after the application terminates.
@@ -216,6 +219,8 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
* A reply of `SPUUserUpdateChoiceSkip` cancels the current update that has begun installing and dismisses the update. In this circumstance, the update is canceled but this update version is not skipped in the future.
*
* Before this point, `-showInstallingUpdate` will be called.
*
* @param reply The reply which indicates if the update should be installed, dismissed, or skipped. See above discussion for more details.
*/
- (void)showReadyToInstallAndRelaunch:(void (^)(SPUUserUpdateChoice))reply;
+43 -25
View File
@@ -20,6 +20,7 @@
@property (nonatomic) BOOL showingUserInitiatedProgress;
@property (nonatomic) BOOL showingUpdate;
@property (nonatomic) BOOL aborted;
@property (nonatomic) void (^updateDidShowHandler)(void);
@end
@@ -30,6 +31,7 @@
@synthesize showingUserInitiatedProgress = _showingUserInitiatedProgress;
@synthesize showingUpdate = _showingUpdate;
@synthesize aborted = _aborted;
@synthesize updateDidShowHandler = _updateDidShowHandler;
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
{
@@ -41,40 +43,56 @@
return self;
}
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{
[self.uiDriver prepareCheckForUpdatesWithCompletion:completionBlock];
[self.uiDriver setCompletionHandler:completionBlock];
}
- (void)setUpdateShownHandler:(void (^)(void))handler
{
self.updateDidShowHandler = handler;
}
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
{
self.showingUserInitiatedProgress = YES;
[self.uiDriver preflightForUpdatePermissionPreventingInstallerInteraction:preventsInstallerInteraction reply:^(NSError * _Nullable error) {
if (!self.aborted) {
if (error != nil) {
[self abortUpdateWithError:error];
} else {
self.showingUserInitiatedProgress = YES;
self.showingUpdate = YES;
[self.userDriver showUserInitiatedUpdateCheckWithCancellation:^{
dispatch_async(dispatch_get_main_queue(), ^{
if (self.showingUserInitiatedProgress) {
[self abortUpdate];
}
});
}];
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:NO];
if (self.updateDidShowHandler != nil) {
self.updateDidShowHandler();
self.updateDidShowHandler = nil;
}
[self.userDriver showUserInitiatedUpdateCheckWithCancellation:^{
dispatch_async(dispatch_get_main_queue(), ^{
if (self.showingUserInitiatedProgress) {
[self abortUpdate];
}
}
});
}];
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:NO];
}
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeInstallingUpdate
{
[self.uiDriver resumeInstallingUpdateWithCompletion:completionBlock];
[self.uiDriver resumeInstallingUpdate];
}
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
{
[self.uiDriver resumeUpdate:resumableUpdate completion:completionBlock];
[self.uiDriver resumeUpdate:resumableUpdate];
}
- (void)uiDriverDidShowUpdate
{
// When a new update check has not been initiated and an update has been resumed,
// update the driver to indicate we are showing an update to the user
self.showingUpdate = YES;
if (self.updateDidShowHandler != nil) {
self.updateDidShowHandler();
self.updateDidShowHandler = nil;
}
}
- (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error
@@ -122,7 +140,7 @@
self.showingUserInitiatedProgress = NO;
}
self.aborted = YES;
[self.uiDriver abortUpdateWithError:error];
[self.uiDriver abortUpdateWithError:error showErrorToUser:YES];
}
@end
+1 -5
View File
@@ -10,10 +10,6 @@
NS_ASSUME_NONNULL_BEGIN
BOOL SPUXPCServiceExists(NSString *bundleName);
BOOL SPUXPCValidateServiceIfBundleExists(NSString *bundleName, NSBundle *sparkleBundle, NSError * __autoreleasing *error);
NSBundle * _Nullable SPUXPCServiceBundle(NSString *bundleName);
BOOL SPUXPCServiceIsEnabled(NSString *enabledKey);
NS_ASSUME_NONNULL_END
+4 -53
View File
@@ -9,63 +9,14 @@
#import "SPUXPCServiceInfo.h"
#import "SUErrors.h"
#import "SUConstants.h"
#import "SUHost.h"
#include "AppKitPrevention.h"
BOOL SPUXPCServiceExists(NSString *bundleName)
{
NSBundle *xpcBundle = SPUXPCServiceBundle(bundleName);
return (xpcBundle != nil);
}
BOOL SPUXPCValidateServiceIfBundleExists(NSString *bundleName, NSBundle *sparkleBundle, NSError * __autoreleasing *error)
{
NSBundle *xpcBundle = SPUXPCServiceBundle(bundleName);
if (xpcBundle == nil) {
return YES;
}
#if !DEBUG
// Post install scripts for appending git hash info to CFBundleShortVersionString are too unreliable to verify for debug/development
// Fortunately debug builds of Sparkle are not usable in a production environment
(void)sparkleBundle; // Mark parameter as used
#else
// Make sure the display versions of Sparkle and the XPC bundle match
// These versions may contain a git hash identifier if built from the Sparkle repository
NSString *sparkleDisplayVersion = [sparkleBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
NSString *xpcDisplayVersion = [xpcBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
if (sparkleDisplayVersion == nil || xpcDisplayVersion == nil || ![sparkleDisplayVersion isEqualToString:xpcDisplayVersion]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidUpdaterError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"XPC Version mismatch. Framework display version is %@ but XPC Service (%@) display version is %@. Bundled XPC Service cannot be used.", sparkleDisplayVersion, xpcBundle.bundlePath, xpcDisplayVersion] }];
}
return NO;
}
#endif
// Make sure the bundle versions of Sparkle and the XPC bundle match
NSString *xpcBundleVersion = [xpcBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
if (xpcBundleVersion == nil || ![xpcBundleVersion isEqualToString:@""CURRENT_PROJECT_VERSION]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidUpdaterError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"XPC Version mismatch. Framework bundle version is %@ but XPC Service (%@) bundle version is %@. Bundled XPC Service cannot be used.", @""CURRENT_PROJECT_VERSION, xpcBundle.bundlePath, xpcBundleVersion] }];
}
return NO;
}
return YES;
}
NSBundle * _Nullable SPUXPCServiceBundle(NSString *bundleName)
BOOL SPUXPCServiceIsEnabled(NSString *enabledKey)
{
NSBundle *mainBundle = [NSBundle mainBundle];
NSURL *executableURL = mainBundle.executableURL;
if (executableURL == nil) {
return nil;
}
SUHost *mainBundleHost = [[SUHost alloc] initWithBundle:mainBundle];
NSURL *xpcBundleURL = [[[executableURL.URLByDeletingLastPathComponent.URLByDeletingLastPathComponent URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:bundleName] URLByAppendingPathExtension:@"xpc"];
return [NSBundle bundleWithURL:xpcBundleURL];
return [mainBundleHost boolForInfoDictionaryKey:enabledKey];
}
+11
View File
@@ -163,6 +163,17 @@ SU_EXPORT @interface SUAppcastItem : NSObject<NSSecureCoding>
*/
@property (copy, readonly, nullable) NSString *itemDescription;
/**
The full release notes URL of the appcast item if provided.
The link should point to the product's full changelog.
Sparkle's standard user interface offers to show these full release notes when a user checks for a new update and no new update is available.
This is extracted from the @c <sparkle:fullReleaseNotesLink> element.
*/
@property (readonly, nullable) NSURL *fullReleaseNotesURL;
/**
The required minimum system operating version string for this update if provided.
+50 -7
View File
@@ -29,6 +29,7 @@ static NSString *SUAppcastItemDescriptionKey = @"itemDescription";
static NSString *SUAppcastItemMaximumSystemVersionKey = @"maximumSystemVersion";
static NSString *SUAppcastItemMinimumSystemVersionKey = @"minimumSystemVersion";
static NSString *SUAppcastItemReleaseNotesURLKey = @"releaseNotesURL";
static NSString *SUAppcastItemFullReleaseNotesURLKey = @"fullReleaseNotesURL";
static NSString *SUAppcastItemTitleKey = @"title";
static NSString *SUAppcastItemVersionStringKey = @"versionString";
static NSString *SUAppcastItemPropertiesKey = @"propertiesDictionary";
@@ -65,6 +66,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
@synthesize maximumSystemVersion = _maximumSystemVersion;
@synthesize minimumSystemVersion = _minimumSystemVersion;
@synthesize releaseNotesURL = _releaseNotesURL;
@synthesize fullReleaseNotesURL = _fullReleaseNotesURL;
@synthesize title = _title;
@synthesize versionString = _versionString;
@synthesize osString = _osString;
@@ -114,6 +116,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
_minimumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMinimumSystemVersionKey] copy];
_minimumAutoupdateVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastElementMinimumAutoupdateVersion] copy];
_releaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemReleaseNotesURLKey];
_fullReleaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemFullReleaseNotesURLKey];
_title = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemTitleKey] copy];
NSString *versionString = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemVersionStringKey] copy];
@@ -188,6 +191,10 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
[encoder encodeObject:self.releaseNotesURL forKey:SUAppcastItemReleaseNotesURLKey];
}
if (self.fullReleaseNotesURL != nil) {
[encoder encodeObject:self.fullReleaseNotesURL forKey:SUAppcastItemFullReleaseNotesURLKey];
}
if (self.title != nil) {
[encoder encodeObject:self.title forKey:SUAppcastItemTitleKey];
}
@@ -378,10 +385,17 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
if (![theInfoURL isKindOfClass:[NSString class]]) {
SULog(SULogLevelError, @"%@ -%@ Info URL is not of valid type.", NSStringFromClass([self class]), NSStringFromSelector(_cmd));
} else {
NSURL *infoURL;
if (appcastURL != nil) {
_infoURL = [NSURL URLWithString:theInfoURL relativeToURL:appcastURL];
infoURL = [NSURL URLWithString:theInfoURL relativeToURL:appcastURL];
} else {
_infoURL = [NSURL URLWithString:theInfoURL];
infoURL = [NSURL URLWithString:theInfoURL];
}
if ([infoURL.scheme caseInsensitiveCompare:@"http"] == NSOrderedSame || [infoURL.scheme caseInsensitiveCompare:@"https"] == NSOrderedSame) {
_infoURL = infoURL;
} else {
SULog(SULogLevelError, @"%@ -%@ Info URL must have a http or https URL scheme.", NSStringFromClass([self class]), NSStringFromSelector(_cmd));
}
}
}
@@ -424,10 +438,19 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
if (enclosureURLString) {
// Sparkle used to always URL-encode, so for backwards compatibility spaces in URLs must be forgiven.
NSString *fileURLString = [enclosureURLString stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
NSURL *fileURL;
if (appcastURL != nil) {
_fileURL = [NSURL URLWithString:fileURLString relativeToURL:appcastURL];
fileURL = [NSURL URLWithString:fileURLString relativeToURL:appcastURL];
} else {
_fileURL = [NSURL URLWithString:fileURLString];
fileURL = [NSURL URLWithString:fileURLString];
}
if ([fileURL.scheme caseInsensitiveCompare:@"http"] == NSOrderedSame || [fileURL.scheme caseInsensitiveCompare:@"https"] == NSOrderedSame) {
_fileURL = fileURL;
} else {
SULog(SULogLevelError, @"File URLs must have a http or https URL scheme.");
_fileURL = nil;
}
}
if (enclosure) {
@@ -533,16 +556,36 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
} else {
url = [NSURL URLWithString:releaseNotesString];
}
if ([url isFileURL]) {
SULog(SULogLevelError, @"Release notes with file:// URLs are not supported");
} else {
if ([url.scheme caseInsensitiveCompare:@"http"] == NSOrderedSame || [url.scheme caseInsensitiveCompare:@"https"] == NSOrderedSame) {
_releaseNotesURL = url;
} else {
SULog(SULogLevelError, @"Release notes must have a http or https URL scheme.");
_releaseNotesURL = nil;
}
} else if ([self.itemDescription hasPrefix:@"http://"] || [self.itemDescription hasPrefix:@"https://"]) { // if the description starts with http:// or https:// use that.
_releaseNotesURL = [NSURL URLWithString:(NSString * _Nonnull)self.itemDescription];
} else {
_releaseNotesURL = nil;
}
// Get full release notes URL if informed.
NSString *fullReleaseNotesString = [dict objectForKey:SUAppcastElementFullReleaseNotesLink];
if (fullReleaseNotesString) {
NSURL *url;
if (appcastURL != nil) {
url = [NSURL URLWithString:fullReleaseNotesString relativeToURL:appcastURL];
} else {
url = [NSURL URLWithString:fullReleaseNotesString];
}
if ([url.scheme caseInsensitiveCompare:@"http"] == NSOrderedSame || [url.scheme caseInsensitiveCompare:@"https"] == NSOrderedSame) {
_fullReleaseNotesURL = url;
} else {
SULog(SULogLevelError, @"Full release notes must have a http or https URL scheme.");
_fullReleaseNotesURL = nil;
}
} else {
_fullReleaseNotesURL = nil;
}
NSArray *deltaDictionaries = [dict objectForKey:SUAppcastElementDeltas];
if (deltaDictionaries) {
+5
View File
@@ -52,6 +52,10 @@ extern NSString *const SUPublicEDKeyKey;
extern NSString *const SUAutomaticallyUpdateKey;
extern NSString *const SUAllowsAutomaticUpdatesKey;
extern NSString *const SUEnableAutomaticChecksKey;
extern NSString *const SUEnableInstallerLauncherServiceKey;
extern NSString *const SUEnableDownloaderServiceKey;
extern NSString *const SUEnableInstallerConnectionServiceKey;
extern NSString *const SUEnableInstallerStatusServiceKey;
extern NSString *const SUEnableSystemProfilingKey;
extern NSString *const SUSendProfileInfoKey;
extern NSString *const SUUpdateGroupIdentifierKey;
@@ -85,6 +89,7 @@ extern NSString *const SUAppcastElementMinimumAutoupdateVersion;
extern NSString *const SUAppcastElementMinimumSystemVersion;
extern NSString *const SUAppcastElementMaximumSystemVersion;
extern NSString *const SUAppcastElementReleaseNotesLink;
extern NSString *const SUAppcastElementFullReleaseNotesLink;
extern NSString *const SUAppcastElementTags;
extern NSString *const SUAppcastElementPhasedRolloutInterval;
extern NSString *const SUAppcastElementInformationalUpdate;
+5
View File
@@ -49,6 +49,10 @@ NSString *const SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
NSString *const SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
NSString *const SUEnableSystemProfilingKey = @"SUEnableSystemProfiling";
NSString *const SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks";
NSString *const SUEnableInstallerLauncherServiceKey = @"SUEnableInstallerLauncherService";
NSString *const SUEnableDownloaderServiceKey = @"SUEnableDownloaderService";
NSString *const SUEnableInstallerConnectionServiceKey = @"SUEnableInstallerConnectionService";
NSString *const SUEnableInstallerStatusServiceKey = @"SUEnableInstallerStatusService";
NSString *const SUSendProfileInfoKey = @"SUSendProfileInfo";
NSString *const SUUpdateGroupIdentifierKey = @"SUUpdateGroupIdentifier";
NSString *const SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate";
@@ -82,6 +86,7 @@ NSString *const SUAppcastElementMinimumAutoupdateVersion = @"sparkle:minimumAuto
NSString *const SUAppcastElementMinimumSystemVersion = @"sparkle:minimumSystemVersion";
NSString *const SUAppcastElementMaximumSystemVersion = @"sparkle:maximumSystemVersion";
NSString *const SUAppcastElementReleaseNotesLink = @"sparkle:releaseNotesLink";
NSString *const SUAppcastElementFullReleaseNotesLink = @"sparkle:fullReleaseNotesLink";
NSString *const SUAppcastElementTags = @"sparkle:tags";
NSString *const SUAppcastElementPhasedRolloutInterval = @"sparkle:phasedRolloutInterval";
NSString *const SUAppcastElementInformationalUpdate = @"sparkle:informationalUpdate";
+1 -1
View File
@@ -71,7 +71,7 @@ typedef NS_ENUM(OSStatus, SUError) {
SUDowngradeError = 4006,
SUInstallationCanceledError = 4007,
SUInstallationAuthorizeLaterError = 4008,
SUNotAllowedInteractionError = 4009,
SUNotValidUpdateError = 4009,
SUAgentInvalidationError = 4010,
// API misuse errors.
+3 -2
View File
@@ -30,8 +30,9 @@
self = [super init];
if (self != nil) {
_webView = [[WebView alloc] initWithFrame:NSZeroRect];
WebPreferences *preferences = _webView.preferences;
WebPreferences *preferences = [[WebPreferences alloc] initWithIdentifier:@"sparkle-project.org.legacy-web-view"];
preferences.autosaves = NO;
preferences.javaScriptEnabled = javaScriptEnabled;
preferences.javaEnabled = NO;
preferences.plugInsEnabled = NO;
+1 -1
View File
@@ -320,7 +320,7 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
// If the developer is using the downloader XPC service, they are very most likely are a) sandboxed b) do not use outgoing network entitlement.
// In this case, fall back to legacy WebKit view.
// (In theory it is possible for a non-sandboxed app or sandboxed app with outgoing network entitlement to use the XPC service, it's just pretty unlikely. And falling back to a legacy web view would not be too harmful in those cases).
BOOL useWKWebView = !SPUXPCServiceExists(@DOWNLOADER_BUNDLE_ID);
BOOL useWKWebView = !SPUXPCServiceIsEnabled(SUEnableDownloaderServiceKey);
if (useWKWebView) {
self.webView = [[SUWKWebView alloc] initWithColorStyleSheetLocation:colorStyleURL fontFamily:defaultFontFamily fontPointSize:defaultFontSize javaScriptEnabled:javaScriptEnabled];
+1 -1
View File
@@ -256,7 +256,7 @@ static NSMutableDictionary *sharedUpdaters = nil;
return versionDisplayer;
}
- (BOOL)updaterMayCheckForUpdates:(SPUUpdater *)__unused updater
- (BOOL)updater:(SPUUpdater *)__unused updater mayPerformUpdateCheck:(SPUUpdateCheck)__unused updateCheck error:(NSError *__autoreleasing _Nullable *)error
{
BOOL updaterMayCheck = YES;
if ([self.delegate respondsToSelector:@selector(updaterMayCheckForUpdates:)]) {
+1 -1
View File
@@ -79,7 +79,7 @@ static WKUserScript *_userScriptWithInjectedStyleSource(NSString *styleSource)
WKUserContentController *userContentController = [[WKUserContentController alloc] init];
NSString *fontStyleContents = [NSString stringWithFormat:@"body { font-family: %@; font-size: %dpt; }", fontFamily, fontPointSize];
NSString *fontStyleContents = [NSString stringWithFormat:@"body { font-family: %@; font-size: %dpx; }", fontFamily, fontPointSize];
NSString *finalStyleContents;
if (colorStyleContents == nil) {
+1 -1
View File
@@ -16,7 +16,7 @@
BOOL SUWebViewIsSafeURL(NSURL *url, BOOL *isAboutBlankURL)
{
NSString *scheme = url.scheme;
BOOL isAboutBlank = [url.absoluteString isEqualToString:@"about:blank"];
BOOL isAboutBlank = [url.absoluteString isEqualToString:@"about:blank"] || [url.absoluteString isEqualToString:@"about:srcdoc"];
BOOL whitelistedSafe = isAboutBlank || [@[@"http", @"https", @"macappstore", @"macappstores", @"itms-apps", @"itms-appss"] containsObject:scheme];
*isAboutBlankURL = isAboutBlank;
+1 -1
View File
@@ -20,4 +20,4 @@
"gz7-LM-gNf.title" = "Odeslat anonymní systémový profil";
/* Class = "NSTextFieldCell"; title = "Anonymous system profile information is used to help us plan future development work.\nPlease contact us if you have any questions about this.\n\nThis is the information that would be sent:"; ObjectID = "183"; */
"183.title" = "Informace z anonymního systémového profilu pomáhají vývojářům lépe plánovat budoucí vývoj aplikace.\nBudete-li mít nějaký dotaz, obraťte se na nás.\n\nTyto informace by měly být odeslány:";
"183.title" = "Informace z anonymního systémového profilu pomáhají vývojářům lépe plánovat budoucí vývoj aplikace.\nBudete-li mít nějaký dotaz, obraťte se na nás.\n\nToto jsou informace, které budou odeslány:";
Binary file not shown.
Binary file not shown.
+125 -22
View File
@@ -1,93 +1,196 @@
"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ wurde geladen und steht zur Installation bereit! Dies ist ein wichtiges Update. Möchtest du %1$@ jetzt durch die neue Version ersetzen und neu starten?";
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ wurde geladen und steht zur Installation bereit! Möchtest du %1$@ jetzt durch die neue Version ersetzen und neu starten?";
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "%1$@ kann nicht aktualisiert werden, da es aus dem Downloads-Order, oder von einer DMG Datei oder Laufwerk ohne Schreibzugriff gestartet wurde.";
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Kopiere %1$@ in den Programmeordner, starte es von dort aus und versuche es erneut zu aktualisieren.";
"Quit %1$@, move it into your Applications folder, relaunch it from there and try again." = "Beenden Sie „%1$@“, bewegen Sie es in den Ordner „Programme“, starten Sie das Programm von dort erneut und versuchen Sie es noch einmal.";
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "„%1$@“ kann nicht aktualisiert werden, wenn das Programm von dem Ort ausgeführt wird, an den es heruntergeladen wurde.";
/* (No Comment) */
"%@ %@ is currently the newest version available." = "%1$@ %2$@ ist zurzeit die neueste verfügbare Version.";
/* (No Comment) */
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ ist zurzeit die neueste verfügbare Version.\n(Die derzeit installierte Version ist %3$@.)";
/* Critical downloadable update */
"%@ %@ is now available--you have %@. This is an important update; would you like to download it now?" = "%1$@ %2$@ ist verfügbar – du verwendest Version %3$@. Dies ist ein wichtiges Update. Möchtest du die neue Version jetzt laden?";
/* Description text for SUUpdateAlert when the update is downloadable. */
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ ist verfügbar – du verwendest Version %3$@. Möchtest du die neue Version jetzt laden?";
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ ist verfügbar – du verwendest Version %3$@. Möchtest du die neue Version jetzt laden?";
/* Description text for SUUpdateAlert when the update informational with no download. */
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ ist verfügbar – du verwendest Version %3$@. Möchtest du mehr über dieses Update erfahren?";
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ ist verfügbar – du verwendest Version %3$@. Möchtest du mehr über dieses Update erfahren?";
/* (No Comment) */
"%@ downloaded" = "%@ geladen";
/* (No Comment) */
"%@ is now updated to version %@!" = "%@ ist aktualisiert auf Version %@!";
/* (No Comment) */
"%@ is now updated!" = "%@ ist aktualisiert!";
/* (No Comment) */
"%@ of %@" = "%1$@ von %2$@";
/* (No Comment) */
"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ wurde geladen und steht zur Installation bereit! Dies ist ein wichtiges Update. Möchtest du %1$@ jetzt durch die neue Version ersetzen und neu starten?";
/* (No Comment) */
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ wurde geladen und steht zur Installation bereit! Möchtest du %1$@ jetzt durch die neue Version ersetzen und neu starten?";
/* (No Comment) */
"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@." = "%1$@ %2$@ ist verfügbar, aber deine Version von macOS ist zu neu für dieses Update. Das Update unterstützt nur bis macOS %3$@.";
/* (No Comment) */
"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required." = "%1$@ %2$@ ist verfügbar, aber deine Version von macOS ist zu alt, um das Update zu installieren. Es wird mindestens macOS %3$@ benötigt.";
/* (No Comment) */
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "%1$@ kann nicht aktualisiert werden, da es aus dem Downloads-Order, oder von einer DMG-Datei oder einem Laufwerk ohne Schreibzugriff gestartet wurde.";
/* (No Comment) */
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "„%1$@“ kann nicht aktualisiert werden, wenn das Programm von dem Ort ausgeführt wird, an den es heruntergeladen wurde.";
/* Authorization message shown when app wants permission to update another app / bundle. */
"%1$@ wants permission to update %2$@." = "%1$@ benötigt Zugriffsrechte zum Aktualisieren von %@$@.";
/* Authorization message shown when app wants permission to update itself. */
"%1$@ wants permission to update." = "%1$@ benötigt Zugriffsrechte zum Aktualisieren";
/* (No Comment) */
"A new version of %@ is available!" = "Eine neue Version von %@ ist verfügbar!";
/* (No Comment) */
"A new version of %@ is ready to install!" = "Eine neue Version von %@ steht zur Installation bereit!";
"An error occurred in retrieving update information. Please try again later." = "Beim Laden der Updateinformationen trat ein Fehler auf. Bitte versuche es später erneut.";
/* (No Comment) */
"An error occurred in retrieving update information. Please try again later." = "Beim Laden der Updateinformationen ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
/* (No Comment) */
"An error occurred while connecting to the installer. Please try again later." = "Beim Verbinden mit dem Installationsprogramm ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
/* (No Comment) */
"An error occurred while downloading the update feed." = "Beim Laden der Updateinformationen ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
/* (No Comment) */
"An error occurred while downloading the update. Please try again later." = "Beim Laden des Updates ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
/* (No Comment) */
"An error occurred while extracting the archive. Please try again later." = "Beim Entpacken des Archivs ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
/* (No Comment) */
"An error occurred while installing the update. Please try again later." = "Beim Installieren des Updates ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
/* (No Comment) */
"An error occurred while launching the installer. Please try again later." = "Beim Starten des Installationsprogramms ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
/* (No Comment) */
"An error occurred while parsing the update feed." = "Beim Lesen der Updateinformationen ist ein Fehler aufgetreten.";
/* (No Comment) */
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Beim Neustart von %1$@ ist ein Fehler aufgetreten. Die neue Version von %1$@ steht beim nächsten Programmstart zur Verfügung.";
/* (No Comment) */
"An error occurred while running the updater. Please try again later." = "Beim Ausführen des Aktualisierungsprogramms ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
/* (No Comment) */
"An error occurred while starting the installer. Please try again later." = "Beim Starten des Installationsprogramms ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
/* (No Comment) */
"An important update to %@ is ready to install" = "Ein wichtiges Update von %@ steht zur Installation bereit";
/* Title confirmation for skipping major upgrade and future updates */
"Are you sure you want to skip this upgrade?" = "Möchtest du dieses Update wirklich überspringen?";
/* the unit for bytes */
"B" = "B";
/* (No Comment) */
"Cancel" = "Abbrechen";
/* (No Comment) */
"Cancel Update" = "Aktualisierung abbrechen";
"Checking for updates..." = "Nach Updates suchen …";
/* (No Comment) */
"Checking for updates..." = "Nach Updates suchen …";
/* Not skipping a major upgrade */
"Don't Skip" = "Nicht überspringen";
/* Take care not to overflow the status window. */
"Downloading update..." = "Update laden …";
"Downloading update..." = "Update laden …";
/* Take care not to overflow the status window. */
"Extracting update..." = "Update entpacken …";
"Extracting update..." = "Update entpacken …";
/* (No Comment) */
"Failed to resume installing update." = "Das Fortsetzen der Installation ist fehlgeschlagen.";
/* the unit for gigabytes */
"GB" = "GB";
/* (No Comment) */
"Install and Relaunch" = "Installieren und neu starten";
/* (No Comment) */
"Install on Quit" = "Installieren beim Beenden";
/* Take care not to overflow the status window. */
"Installing update..." = "Update installieren …";
"Installing update..." = "Update installieren …";
/* the unit for kilobytes */
"KB" = "KB";
/* Alternative name for "Install" button if we have a paid update or other update
without a download but with a URL. */
"Learn More..." = "Mehr über …";
/* the unit for megabytes */
"MB" = "MB";
/* OK button. */
"OK" = "OK";
/* (No Comment) */
"Quit %1$@, move it into your Applications folder, relaunch it from there and try again." = "Beende „%1$@“, bewege es in den Ordner „Programme“, starte das Programm von dort erneut und versuche es noch einmal.";
/* Status message on progress window once download has finished. */
"Ready to Install" = "Bereit zum Installieren";
/* Message that is optionally shown at startup to allow users to turn on/off update checks. */
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Soll %1$@ automatisch nach Updates suchen? Du kannst im %1$@-Menü auch manuell nach Updates suchen.";
/* Skipping major upgrade */
"Skip Upgrade" = "Update überspringen";
/* Confirmation message for skipping major upgrade and future updates */
"Skipping this major upgrade will opt out of alerts for future updates." = "Wenn du dieses Hauptupdate überspringst, wirst du keine Hinweise für zukünftige Updates erhalten.";
/* (No Comment) */
"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version" = "Das Aktualisierungsprogramm wurde nicht richtig gestartet. Du solltest den App-Entwickler kontaktieren, um diesen Fehler zu melden und zu prüfen, ob du die neueste Version hast.";
/* (No Comment) */
"The update is improperly signed." = "Das Update ist nicht ordnungsgemäß signiert.";
/* (No Comment) */
"Unable to Check For Updates" = "Suche nach Updates ist fehlgeschlagen";
/* (No Comment) */
"Update Error!" = "Fehler beim Aktualisieren!";
/* (No Comment) */
"Update Installed" = "Update installiert";
/* (No Comment) */
"Updating %@" = "Aktualisierung von %@";
/* (No Comment) */
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Kopiere %1$@ in den Programmeordner, starte es von dort aus und versuche es erneut zu aktualisieren.";
/* Used when a new update is not found */
"Version History" = "Versionsverlauf";
/* 'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI) */
"You already have the newest version of %@." = "Du hast bereits die neueste Version von %@.";
/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */
"You're up-to-date!" = "Du bist auf dem neuesten Stand!";
/* Alternative name for "Install" button if we have a paid update or other update
without a download but with a URL. */
/* (No Comment) */
"Your macOS version is too new" = "Deine Version von macOS ist zu neu";
/* (No Comment) */
"Your macOS version is too old" = "Deine Version von macOS ist zu alt";
"Learn More..." = "Mehr über …";
+2
View File
@@ -91,3 +91,5 @@
"Learn More..." = "En savoir plus…";
"The update is improperly signed." = "La signature numérique de la mise à jour est incorrecte";
"Version History" = "Historique des versions";
Binary file not shown.
Binary file not shown.
+124 -16
View File
@@ -1,12 +1,11 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ is gedownload en klaar om te installeren! Wil je %1$@ nu installeren en herstarten?";
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "%1$@ kan niet worden geüpdatet, omdat het vanuit een alleen-lezen- of tijdelijke locatie geopend is.";
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Verplaats %1$@ naar de map ’Programma’s’, herstart vandaar en probeer opnieuw.";
/* (No Comment) */
"%@ %@ is currently the newest version available." = "%1$@ %2$@ is momenteel de nieuwste versie.";
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ is momenteel de nieuwste versie.\n(You are currently running version %3$@.)";
/* (No Comment) */
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ is momenteel de nieuwste versie.\n(Je gebruikt op dit moment versie %3$@.)";
/* Critical downloadable update */
"%@ %@ is now available--you have %@. This is an important update; would you like to download it now?" = "%1$@ %2$@ is nu beschikbaar – je hebt %3$@. Dit is een belangrijke update. Wil je deze nu downloaden?";
/* Description text for SUUpdateAlert when the update is downloadable. */
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ is nu beschikbaar – je hebt %3$@. Wil je de update nu downloaden?";
@@ -14,75 +13,184 @@
/* Description text for SUUpdateAlert when the update informational with no download. */
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is nu beschikbaar – je hebt %3$@. Wil je een webpagina openen met meer informatie?";
/* (No Comment) */
"%@ downloaded" = "%@ gedownload";
/* (No Comment) */
"%@ is now updated to version %@!" = "%@ is nu bijgewerkt naar versie %@!";
/* (No Comment) */
"%@ is now updated!" = "%@ is nu bijgewerkt!";
/* (No Comment) */
"%@ of %@" = "%1$@ van %2$@";
/* (No Comment) */
"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ is gedownload en klaar om te installeren! Dit is een belangrijke update. Wil je deze nu installeren en %1$@ herstarten?";
/* (No Comment) */
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ is gedownload en klaar om te installeren! Wil je deze nu installeren en %1$@ herstarten?";
/* (No Comment) */
"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@." = "%1$@ %2$@ is beschikbaar, maar je versie van macOS is te nieuw voor deze update. De update kan alleen worden gebruikt tot macOS %3$@.";
/* (No Comment) */
"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required." = "%1$@ %2$@ is beschikbaar, maar je versie van macOS is te oud om deze te installeren. Ten minste macOS %3$@ is vereist.";
/* (No Comment) */
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "%1$@ kan niet worden bijgewerkt, omdat het vanuit een alleen-lezen- of tijdelijke locatie is geopend.";
/* (No Comment) */
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ kan niet worden bijgewerkt als het is geopend vanuit de downloadlocatie.";
/* Authorization message shown when app wants permission to update another app / bundle. */
"%1$@ wants permission to update %2$@." = "%1$@ vraagt om toestemming om %2$@ bij te werken.";
/* Authorization message shown when app wants permission to update itself. */
"%1$@ wants permission to update." = "%1$@ vraagt om toestemming om bij te werken.";
/* (No Comment) */
"A new version of %@ is available!" = "Een nieuwe versie van %@ is beschikbaar!";
/* (No Comment) */
"A new version of %@ is ready to install!" = "Een nieuwe versie van %@ is klaar om te installeren!";
"An error occurred in retrieving update information. Please try again later." = "Bij het ophalen van update-informatie deed zich een fout voor. Probeer het later opnieuw.";
/* (No Comment) */
"An error occurred in retrieving update information. Please try again later." = "Er heeft zich een fout voorgedaan bij het ophalen van update-informatie. Probeer het later opnieuw.";
"An error occurred while downloading the update. Please try again later." = "Bij het downloaden van de update deed zich een fout voor. Probeer het later opnieuw";
/* (No Comment) */
"An error occurred while connecting to the installer. Please try again later." = "Er heeft zich een fout voorgedaan bij het verbinden met het installatieprogramma. Probeer het later opnieuw.";
"An error occurred while extracting the archive. Please try again later." = "Bij het uitpakken van het archief deed zich een fout voor. Probeer het later opnieuw.";
/* (No Comment) */
"An error occurred while downloading the update feed." = "Er heeft zich een fout voorgedaan bij het downloaden van de update-informatie.";
"An error occurred while installing the update. Please try again later." = "Bij het installeren van de update deed zich een fout voor. Probeer het later opnieuw.";
/* (No Comment) */
"An error occurred while downloading the update. Please try again later." = "Er heeft zich een fout voorgedaan bij het downloaden van de update. Probeer het later opnieuw";
"An error occurred while parsing the update feed." = "Bij het verwerken van de update-informatie deed zich een fout voor.";
/* (No Comment) */
"An error occurred while extracting the archive. Please try again later." = "Er heeft zich een fout voorgedaan bij het uitpakken van het archief. Probeer het later opnieuw.";
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Bij het herstarten van %1$@ deed zich een fout voor. De nieuwe versie is beschikbaar wanneer je %1$@ de volgende keer opent.";
/* (No Comment) */
"An error occurred while installing the update. Please try again later." = "Er heeft zich een fout voorgedaan bij het installeren van de update. Probeer het later opnieuw.";
/* (No Comment) */
"An error occurred while launching the installer. Please try again later." = "Er heeft zich een fout voorgedaan bij het starten van het installatieprogramma. Probeer het later opnieuw.";
/* (No Comment) */
"An error occurred while parsing the update feed." = "Er heeft zich een fout voorgedaan bij het verwerken van de update-informatie.";
/* (No Comment) */
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Er heeft zich een fout voorgedaan bij het herstarten van %1$@. De nieuwe versie is beschikbaar wanneer je %1$@ de volgende keer opent.";
/* (No Comment) */
"An error occurred while running the updater. Please try again later." = "Er heeft zich een fout voorgedaan bij het uitvoeren van het bijwerkprogramma. Probeer het later opnieuw.";
/* (No Comment) */
"An error occurred while starting the installer. Please try again later." = "Er heeft zich een fout voorgedaan bij het starten van het installatieprogramma. Probeer het later opnieuw.";
/* (No Comment) */
"An important update to %@ is ready to install" = "Een belangrijke update voor %@ is klaar om te installeren";
/* Title confirmation for skipping major upgrade and future updates */
"Are you sure you want to skip this upgrade?" = "Weet je zeker dat je deze update wilt overslaan?";
/* the unit for bytes */
"B" = "B";
/* (No Comment) */
"Cancel" = "Annuleer";
/* (No Comment) */
"Cancel Update" = "Annuleer update";
/* (No Comment) */
"Checking for updates..." = "Naar updates zoeken…";
/* Not skipping a major upgrade */
"Don't Skip" = "Sla niet over";
/* Take care not to overflow the status window. */
"Downloading update..." = "Update downloaden…";
/* Take care not to overflow the status window. */
"Extracting update..." = "Update uitpakken…";
/* (No Comment) */
"Failed to resume installing update." = "Het hervatten van de update-installatie is mislukt.";
/* the unit for gigabytes */
"GB" = "GB";
/* (No Comment) */
"Install and Relaunch" = "Installeer en herstart";
/* (No Comment) */
"Install on Quit" = "Installeer bij het stoppen";
/* Take care not to overflow the status window. */
"Installing update..." = "Update installeren…";
/* the unit for kilobytes */
"KB" = "KB";
/* Alternative name for "Install" button if we have a paid update or other update
without a download but with a URL. */
"Learn More..." = "Meer informatie…";
/* the unit for megabytes */
"MB" = "MB";
/* OK button. */
"OK" = "OK";
/* (No Comment) */
"Quit %1$@, move it into your Applications folder, relaunch it from there and try again." = "Stop %1$@, verplaats het naar de map 'Apps', herstart het van daaruit en probeer opnieuw.";
/* Status message on progress window once download has finished. */
"Ready to Install" = "Klaar om te installeren";
/* Message that is optionally shown at startup to allow users to turn on/off update checks. */
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Wil je dat %1$@ automatisch naar updates zoekt? Je kunt altijd nog handmatig zoeken naar updates via het %1$@-menu.";
/* Skipping major upgrade */
"Skip Upgrade" = "Sla update over";
/* Confirmation message for skipping major upgrade and future updates */
"Skipping this major upgrade will opt out of alerts for future updates." = "Als je deze hoofdupdate overslaat, zul je geen meldingen voor toekomstige updates ontvangen.";
/* (No Comment) */
"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version" = "Het bijwerkprogramma is niet goed gestart. Je kunt wellicht met de app-ontwikkelaar contact opnemen om de fout te melden en te controleren dat je de nieuwste versie hebt";
/* (No Comment) */
"The update is improperly signed." = "De update is onjuist gesigneerd.";
/* (No Comment) */
"Unable to Check For Updates" = "Zoeken naar updates mislukt";
/* (No Comment) */
"Update Error!" = "Fout bij het bijwerken!";
/* (No Comment) */
"Update Installed" = "Update geïnstalleerd";
/* (No Comment) */
"Updating %@" = "%@ bijwerken…";
/* (No Comment) */
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Gebruik Finder om %1$@ naar de map 'Apps' te kopiëren, herstart het van daaruit en probeer opnieuw.";
/* Used when a new update is not found */
"Version History" = "Versiegeschiedenis";
/* 'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI) */
"You already have the newest version of %@." = "Je hebt al de nieuwste versie van %@.";
/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */
"You're up-to-date!" = "Je hebt de nieuwste versie!";
/* Alternative name for "Install" button if we have a paid update or other update
without a download but with a URL. */
/* (No Comment) */
"Your macOS version is too new" = "Je versie van macOS is te nieuw";
/* (No Comment) */
"Your macOS version is too old" = "Je versie van macOS is te oud";
"Learn More..." = "Meer informatie…";
+4 -4
View File
@@ -1,15 +1,15 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ загружен и готов к использованию! Хотите установить и перезапустить %1$@?";
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "Во время работы %1$@ с тома, предназначенного только для чтения, как например, образа диска или накопителя на оптических дисках, его невозможно обновить.";
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "Не удаётся обновить %1$@ с тома, предназначенного только для чтения.";
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Переместите %1$@ в Папку приложений, перезапустите его оттуда и повторите попытку.";
"%@ %@ is currently the newest version available." = "В настоящий момент %1$@ %2$@ является новейшей версией.";
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "В настоящий момент %1$@ %2$@ является новейшей версией.\n(You are currently running version %3$@.)";
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "В настоящий момент %1$@ %2$@ является новейшей версией.\n(У вас установлена %3$@.)";
/* Description text for SUUpdateAlert when the update is downloadable. */
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ теперь доступен – вы имеете %3$@. Хотите загрузить его сейчас?";
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ теперь доступен – у вас установлен %3$@. Хотите загрузить его сейчас?";
/* Description text for SUUpdateAlert when the update informational with no download. */
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available--you have %3$@. Would you like to learn more about this update on the web?";
@@ -30,7 +30,7 @@
"An error occurred while installing the update. Please try again later." = "Произошла ошибка при установке обновления. Повторите попытку позже.";
"An error occurred while parsing the update feed." = "Ошибка произошла при извлечении канала обновления.";
"An error occurred while parsing the update feed." = "Произошла ошибка при извлечении канала обновления.";
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Произошла ошибка при перезапуске %1$@, но при последующем запуске %1$@ будет доступна новая версия.";
@@ -32,6 +32,8 @@
<string>http://localhost:1337/sparkletestcast.xml</string>
<key>SUPublicEDKey</key>
<string>eRFPLZuNM6m8bltmtpPX4fzKbufI1z6rKJHtgIIsllk=</string>
<key>SUEnableInstallerLauncherService</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
+2
View File
@@ -7,6 +7,8 @@
<item>
<title>Version 2.0</title>
<sparkle:version>2.0</sparkle:version>
<link>https://sparkle-project.org</link>
<sparkle:fullReleaseNotesLink>releasenotes.html</sparkle:fullReleaseNotesLink>
<description>
<![CDATA[
<ul>
+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>For unit test only</title>
<item>
<title>Version 3.0</title>
<pubDate>Sat, 26 Jul 2014 15:20:12 +0000</pubDate>
<sparkle:releaseNotesLink>https://sparkle-project.org/notes/relnote-3.0.txt</sparkle:releaseNotesLink>
<sparkle:fullReleaseNotesLink>https://sparkle-project.org/fullnotes.txt</sparkle:fullReleaseNotesLink>
<link>https://sparkle-project.org</link>
<enclosure url="https://sparkle-project.org/release-3.0.zip" sparkle:version="3.0" length="1346234" />
</item>
<item>
<title>Version 2.0</title>
<pubDate>Sat, 26 Jul 2014 15:20:12 +0000</pubDate>
<sparkle:releaseNotesLink>http://sparkle-project.org/notes/relnote-2.0.txt</sparkle:releaseNotesLink>
<sparkle:fullReleaseNotesLink>http://sparkle-project.org/fullnotes.txt</sparkle:fullReleaseNotesLink>
<link>http://sparkle-project.org</link>
<enclosure url="http://sparkle-project.org/release-2.0.zip" sparkle:version="2.0" length="1346234" />
</item>
<item>
<title>Version 1.0</title>
<pubDate>Sat, 26 Jul 2014 15:20:12 +0000</pubDate>
<sparkle:releaseNotesLink>file://sparkle-project.org/notes/relnote-1.0.txt</sparkle:releaseNotesLink>
<sparkle:fullReleaseNotesLink>file://sparkle-project.org/fullnotes.txt</sparkle:fullReleaseNotesLink>
<link>file://sparkle-project.org</link>
<enclosure url="file://sparkle-project.org/release-1.0.zip" sparkle:version="1.0" length="1346234" />
</item>
</channel>
</rss>
+16
View File
@@ -15,5 +15,21 @@
<sparkle:version>2.0</sparkle:version>
<link>/info/info-2.0.txt</link>
</item>
<item>
<title>Version 1.0</title>
<description>desc</description>
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
<sparkle:version>1.0</sparkle:version>
<sparkle:fullReleaseNotesLink>notes/fullnotes.txt</sparkle:fullReleaseNotesLink>
<enclosure url="release-1.0.zip" sparkle:version="1.0" length="1346234" />
</item>
<item>
<title>Version 0.9</title>
<description>desc</description>
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
<sparkle:version>0.9</sparkle:version>
<sparkle:fullReleaseNotesLink>https://sparkle-project.org/releasenotes.html</sparkle:fullReleaseNotesLink>
<enclosure url="release-0.9.zip" sparkle:version="0.9" length="1346234" />
</item>
</channel>
</rss>
+44 -1
View File
@@ -644,6 +644,44 @@ class SUAppcastTest: XCTestCase {
XCTFail(err.localizedDescription)
}
}
func testLinks() {
let testFile = Bundle(for: SUAppcastTest.self).path(forResource: "test-links", ofType: "xml")!
let testData = NSData(contentsOfFile: testFile)!
do {
let baseURL: URL? = nil
let stateResolver = SPUAppcastItemStateResolver(hostVersion: "1.0", applicationVersionComparator: SUStandardVersionComparator.default, standardVersionComparator: SUStandardVersionComparator.default)
let appcast = try SUAppcast(xmlData: testData as Data, relativeTo: baseURL, stateResolver: stateResolver)
let items = appcast.items
XCTAssertEqual(3, items.count)
// Test https
XCTAssertEqual("https://sparkle-project.org/notes/relnote-3.0.txt", items[0].releaseNotesURL?.absoluteString)
XCTAssertEqual("https://sparkle-project.org/fullnotes.txt", items[0].fullReleaseNotesURL?.absoluteString)
XCTAssertEqual("https://sparkle-project.org", items[0].infoURL?.absoluteString)
XCTAssertEqual("https://sparkle-project.org/release-3.0.zip", items[0].fileURL?.absoluteString)
// Test http
XCTAssertEqual("http://sparkle-project.org/notes/relnote-2.0.txt", items[1].releaseNotesURL?.absoluteString)
XCTAssertEqual("http://sparkle-project.org/fullnotes.txt", items[1].fullReleaseNotesURL?.absoluteString)
XCTAssertEqual("http://sparkle-project.org", items[1].infoURL?.absoluteString)
XCTAssertEqual("http://sparkle-project.org/release-2.0.zip", items[1].fileURL?.absoluteString)
// Test bad file URLs
XCTAssertEqual(nil, items[2].releaseNotesURL?.absoluteString)
XCTAssertEqual(nil, items[2].fullReleaseNotesURL?.absoluteString)
XCTAssertEqual(nil, items[2].infoURL?.absoluteString)
XCTAssertEqual(nil, items[2].fileURL?.absoluteString)
} catch let err as NSError {
NSLog("%@", err)
XCTFail(err.localizedDescription)
}
}
func testRelativeURLs() {
let testFile = Bundle(for: SUAppcastTest.self).path(forResource: "test-relative-urls", ofType: "xml")!
@@ -657,12 +695,17 @@ class SUAppcastTest: XCTestCase {
let appcast = try SUAppcast(xmlData: testData as Data, relativeTo: baseURL, stateResolver: stateResolver)
let items = appcast.items
XCTAssertEqual(2, items.count)
XCTAssertEqual(4, items.count)
XCTAssertEqual("https://fake.sparkle-project.org/updates/release-3.0.zip", items[0].fileURL?.absoluteString)
XCTAssertEqual("https://fake.sparkle-project.org/updates/notes/relnote-3.0.txt", items[0].releaseNotesURL?.absoluteString)
XCTAssertEqual("https://fake.sparkle-project.org/info/info-2.0.txt", items[1].infoURL?.absoluteString)
XCTAssertEqual("https://fake.sparkle-project.org/updates/notes/fullnotes.txt", items[2].fullReleaseNotesURL?.absoluteString)
// If a different base URL is in the feed, we should respect the base URL in the feed
XCTAssertEqual("https://sparkle-project.org/releasenotes.html", items[3].fullReleaseNotesURL?.absoluteString)
} catch let err as NSError {
NSLog("%@", err)
+1 -1
View File
@@ -358,7 +358,7 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec
// Make sure old version patches still work for simple cases
- (void)testRegularFileAddedWithAzureVersion
{
XCTAssertTrue([self createAndApplyPatchUsingVersion:SUAzureMajorVersion beforeDiffHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
XCTAssertTrue([self createAndApplyPatchUsingVersion:SUBinaryDeltaMajorVersion1 beforeDiffHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
NSString *destinationFile2 = [destinationDirectory stringByAppendingPathComponent:@"B"];
+1 -1
View File
@@ -27,7 +27,7 @@ class DeltaUpdate {
class func create(from: ArchiveItem, to: ArchiveItem, archivePath: URL) throws -> DeltaUpdate {
var applyDiffError: NSError?
if !createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .beigeMajorVersion, false, &applyDiffError) {
if !createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .version2, false, &applyDiffError) {
throw applyDiffError!
}
+47 -3
View File
@@ -29,6 +29,26 @@ func text(_ text: String) -> XMLNode {
return XMLNode.text(withStringValue: text) as! XMLNode
}
func extractVersion(parent: XMLNode) -> String? {
guard let itemElement = parent as? XMLElement else {
return nil
}
// Look for version attribute in enclosure
if let enclosure = findElement(name: "enclosure", parent: itemElement) {
if let versionAttribute = enclosure.attribute(forName: SUAppcastAttributeVersion) {
return versionAttribute.stringValue
}
}
// Look for top level version element
if let versionElement = findElement(name: SUAppcastElementVersion, parent: itemElement) {
return versionElement.stringValue
}
return nil
}
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent
@@ -68,6 +88,8 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
var numNewUpdates = 0
var numExistingUpdates = 0
let versionComparator = SUStandardVersionComparator()
var numItems = 0
for update in updates {
@@ -102,12 +124,34 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
if createNewItem {
item = XMLElement.element(withName: "item") as! XMLElement
// When we insert a new item, find the best place to insert the new update item in
// This takes account of existing items and even ones that we don't have existing info on
var foundBestUpdateInsertion = false
if let itemNodes = try? channel.nodes(forXPath: "item") {
for childItemNode in itemNodes {
guard let childItemNode = childItemNode as? XMLElement else {
continue
}
guard let childItemVersion = extractVersion(parent: childItemNode) else {
continue
}
if versionComparator.compareVersion(update.version, toVersion: childItemVersion) == .orderedDescending {
channel.insertChild(item, at: childItemNode.index)
foundBestUpdateInsertion = true
break
}
}
}
if !foundBestUpdateInsertion {
channel.addChild(item)
}
} else {
item = existingItems[0] as! XMLElement
// Remove the existing item to make sure it's inserted in the correct order when we re-add it
channel.removeChild(at: item.index)
}
channel.addChild(item)
if nil == findElement(name: "title", parent: item) {
item.addChild(XMLElement.element(withName: "title", stringValue: update.shortVersion) as! XMLElement)
+111 -34
View File
@@ -8,8 +8,25 @@
#import "SPUCommandLineDriver.h"
#import <Sparkle/Sparkle.h>
#import <Sparkle/SUInstallerLauncher+Private.h>
#import "SPUCommandLineUserDriver.h"
#define SPARKLE_CLI_ERROR_DOMAIN @"sparkle-cli"
typedef NS_ENUM(NSInteger, CLIErrorCode) {
CLIErrorCodeCannotPerformCheck = 1,
CLIErrorCodeCannotInstallPackage,
CLIErrorCodeCannotInstallMajorUpgrade
};
typedef NS_ENUM(int, CLIErrorExitStatus) {
CLIErrorExitStatusMajorUpgradeNotAllowed = 2,
CLIErrorExitStatusInstallerInteractionNotAllowed = 3,
CLIErrorExitStatusUpdateNotFound = 4,
CLIErrorExitStatusUpdateCancelledAuthorization = 5,
CLIErrorExitStatusUpdatePermissionRequested = 6
};
@interface SPUCommandLineDriver () <SPUUpdaterDelegate>
@property (nonatomic, readonly) SPUUpdater *updater;
@@ -19,6 +36,7 @@
@property (nonatomic, readonly) BOOL allowMajorUpgrades;
@property (nonatomic, readonly) NSSet<NSString *> *allowedChannels;
@property (nonatomic, copy, readonly, nullable) NSString *customFeedURL;
@property (nonatomic, readonly) SUUpdatePermissionResponse *updatePermissionResponse;
@end
@@ -31,6 +49,7 @@
@synthesize allowMajorUpgrades = _allowMajorUpgrades;
@synthesize allowedChannels = _allowedChannels;
@synthesize customFeedURL = _customFeedURL;
@synthesize updatePermissionResponse = _updatePermissionResponse;
- (instancetype)initWithUpdateBundlePath:(NSString *)updateBundlePath applicationBundlePath:(nullable NSString *)applicationBundlePath allowedChannels:(NSSet<NSString *> *)allowedChannels customFeedURL:(nullable NSString *)customFeedURL updatePermissionResponse:(nullable SUUpdatePermissionResponse *)updatePermissionResponse deferInstallation:(BOOL)deferInstallation interactiveInstallation:(BOOL)interactiveInstallation allowMajorUpgrades:(BOOL)allowMajorUpgrades verbose:(BOOL)verbose
{
@@ -56,6 +75,7 @@
_allowMajorUpgrades = allowMajorUpgrades;
_allowedChannels = allowedChannels;
_customFeedURL = [customFeedURL copy];
_updatePermissionResponse = updatePermissionResponse;
id <SPUUserDriver> userDriver = [[SPUCommandLineUserDriver alloc] initWithUpdatePermissionResponse:updatePermissionResponse deferInstallation:deferInstallation verbose:verbose];
_updater = [[SPUUpdater alloc] initWithHostBundle:updateBundle applicationBundle:applicationBundle userDriver:userDriver delegate:self];
@@ -79,17 +99,65 @@
exit(EXIT_SUCCESS);
}
// If the installation is interactive, we can show an authorization prompt for requesting additional privileges,
// along with allowing the installer to show UI when installing
- (BOOL)updater:(SPUUpdater *)__unused updater shouldAllowInstallerInteractionForUpdateCheck:(SPUUpdateCheck)updateCheck
- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SPUUpdater *)__unused updater
{
if (self.updatePermissionResponse == nil) {
// We don't want to make this decision on behalf of the user.
fprintf(stderr, "Error: Asked to grant update permission and --grant-automatic-checks is not specified. Exiting.\n");
exit(CLIErrorExitStatusUpdatePermissionRequested);
}
return YES;
}
// If the installation is not interactive, we should not perform an update check if we don't have permission to update the bundle path
- (BOOL)updater:(SPUUpdater *)updater mayPerformUpdateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error
{
switch (updateCheck) {
case SPUUpdateCheckUserInitiated:
case SPUUpdateCheckBackgroundScheduled:
return self.interactive;
case SPUUpdateCheckUpdates:
case SPUUpdateCheckUpdatesInBackground:
if (self.interactive || !SPUSystemNeedsAuthorizationAccessForBundlePath(self.updater.hostBundle.bundlePath)) {
return YES;
}
if (error != NULL) {
*error = [NSError errorWithDomain:SPARKLE_CLI_ERROR_DOMAIN code:CLIErrorCodeCannotPerformCheck userInfo:@{ NSLocalizedDescriptionKey: @"A new update check cannot be performed because updating this bundle will require user authorization. Please use --interactive to allow this." }];
}
return NO;
case SPUUpdateCheckUpdateInformation:
return YES;
}
}
// If the installation is not interactive, we should only proceed with application based updates and not package-based ones
- (BOOL)updater:(SPUUpdater *)updater shouldProceedWithUpdate:(nonnull SUAppcastItem *)updateItem updateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error
{
// We can always probe for update information
if (updateCheck == SPUUpdateCheckUpdateInformation) {
return YES;
}
// If we encounter a major upgrade and not allowed to act on it, then error
if (updateItem.majorUpgrade && !self.allowMajorUpgrades) {
if (error != NULL) {
*error = [NSError errorWithDomain:SPARKLE_CLI_ERROR_DOMAIN code:CLIErrorCodeCannotInstallMajorUpgrade userInfo:@{ NSLocalizedDescriptionKey: @"Major upgrade available but not allowed to install it. Pass --allow-major-upgrades to allow this." }];
}
return NO;
}
if (!self.interactive && ![updateItem.installationType isEqualToString:SPUInstallationTypeApplication]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SPARKLE_CLI_ERROR_DOMAIN code:CLIErrorCodeCannotInstallPackage userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A new package-based update has been found (%@), but installing it will require user authorization. Please use --interactive to allow this.", updateItem.versionString] }];
}
return NO;
}
return YES;
}
- (NSSet<NSString *> *)allowedChannelsForUpdater:(SPUUpdater *)__unused updater
{
return self.allowedChannels;
@@ -100,47 +168,56 @@
return self.customFeedURL;
}
// In case we find an update during probing, otherwise we leave this to the user driver
// In case we find an update during probing
- (void)updater:(SPUUpdater *)__unused updater didFindValidUpdate:(SUAppcastItem *)item
{
// If we encounter a major upgrade and not allowed to act on it, then exit(2)
if (item.majorUpgrade && !self.allowMajorUpgrades) {
if (self.probingForUpdates) {
if (self.verbose) {
fprintf(stderr, "Major upgrade available");
if (self.probingForUpdates) {
fprintf(stderr, "\n");
if (item.majorUpgrade) {
fprintf(stderr, "Major upgrade available.\n");
} else {
fprintf(stderr, " but not allowed to install it.\n");
fprintf(stderr, "Update available!\n");
}
}
exit(2);
} else if (self.probingForUpdates) {
}
}
- (void)updater:(SPUUpdater *)updater didFinishUpdateCycleForUpdateCheck:(SPUUpdateCheck)__unused updateCheck error:(nullable NSError *)error __attribute__((noreturn))
{
if (error == nil) {
if (self.verbose) {
fprintf(stderr, "Update available!\n");
fprintf(stderr, "Exiting.\n");
}
exit(EXIT_SUCCESS);
}
}
- (void)updaterDidNotFindUpdate:(SPUUpdater *)__unused updater __attribute__((noreturn))
{
if (self.verbose) {
fprintf(stderr, "No update available!\n");
}
exit(EXIT_FAILURE);
}
- (void)updater:(SPUUpdater *)__unused updater didAbortWithError:(NSError *)error
{
dispatch_async(dispatch_get_main_queue(), ^{
if (self.verbose) {
fprintf(stderr, "Aborted update with error (%ld): %s\n", (long)error.code, error.localizedDescription.UTF8String);
} else if ([error.domain isEqualToString:SPARKLE_CLI_ERROR_DOMAIN]) {
fprintf(stderr, "%s\n", error.localizedDescription.UTF8String);
if (error.code == CLIErrorCodeCannotInstallMajorUpgrade) {
// Major upgrades are not allowed
exit(CLIErrorExitStatusMajorUpgradeNotAllowed);
} else {
// This is one of our own interactive update failures
exit(CLIErrorExitStatusInstallerInteractionNotAllowed);
}
} else if (error.code == SUNoUpdateError) {
if (self.verbose) {
fprintf(stderr, "No new update available!\n");
}
exit(CLIErrorExitStatusUpdateNotFound);
} else if (error.code == SUInstallationCanceledError) {
// User canceled authorization themselves
assert(self.interactive);
if (self.verbose) {
fprintf(stderr, "Update was cancelled.\n");
}
exit(CLIErrorExitStatusUpdateCancelledAuthorization);
} else {
fprintf(stderr, "Error: Update has failed due to error %ld (%s). %s\n", (long)error.code, error.domain.UTF8String, error.localizedDescription.UTF8String);
exit(EXIT_FAILURE);
});
}
}
- (BOOL)updaterShouldDownloadReleaseNotes:(SPUUpdater *)__unused updater
- (BOOL)updater:(SPUUpdater *)updater shouldDownloadReleaseNotesForUpdate:(nonnull SUAppcastItem *)__unused item
{
return self.verbose;
}
+8 -24
View File
@@ -10,8 +10,6 @@
#import <AppKit/AppKit.h>
#import <Sparkle/Sparkle.h>
#define SCHEDULED_UPDATE_TIMER_THRESHOLD 2.0 // seconds
@interface SPUCommandLineUserDriver ()
@property (nonatomic, nullable, readonly) SUUpdatePermissionResponse *updatePermissionResponse;
@@ -43,16 +41,10 @@
- (void)showUpdatePermissionRequest:(SPUUpdatePermissionRequest *)__unused request reply:(void (^)(SUUpdatePermissionResponse *))reply
{
if (self.updatePermissionResponse == nil) {
// We don't want to make this decision on behalf of the user.
fprintf(stderr, "Error: Asked to grant update permission. Exiting.\n");
exit(EXIT_FAILURE);
} else {
if (self.verbose) {
fprintf(stderr, "Granting permission for automatic update checks with sending system profile %s...\n", self.updatePermissionResponse.sendSystemProfile ? "enabled" : "disabled");
}
reply(self.updatePermissionResponse);
if (self.verbose) {
fprintf(stderr, "Granting permission for automatic update checks with sending system profile %s...\n", self.updatePermissionResponse.sendSystemProfile ? "enabled" : "disabled");
}
reply(self.updatePermissionResponse);
}
- (void)showUserInitiatedUpdateCheckWithCancellation:(void (^)(void))__unused cancellation
@@ -159,18 +151,14 @@
}
}
- (void)showUpdateNotFoundWithError:(NSError *)error acknowledgement:(void (^)(void))__unused acknowledgement __attribute__((noreturn))
- (void)showUpdateNotFoundWithError:(NSError *)__unused error acknowledgement:(void (^)(void))acknowledgement
{
if (self.verbose) {
fprintf(stderr, "No new update available!\n");
}
exit(EXIT_SUCCESS);
acknowledgement();
}
- (void)showUpdaterError:(NSError *)error acknowledgement:(void (^)(void))__unused acknowledgement __attribute__((noreturn))
- (void)showUpdaterError:(NSError *)__unused error acknowledgement:(void (^)(void))acknowledgement
{
fprintf(stderr, "Error: Update has failed: %s\n", error.localizedDescription.UTF8String);
exit(EXIT_FAILURE);
acknowledgement();
}
- (void)showDownloadInitiatedWithCancellation:(void (^)(void))__unused cancellation
@@ -245,12 +233,8 @@
acknowledgement();
}
- (void)dismissUpdateInstallation __attribute__((noreturn))
- (void)dismissUpdateInstallation
{
if (self.verbose) {
fprintf(stderr, "Exiting.\n");
}
exit(EXIT_SUCCESS);
}
- (void)showSendingTerminationSignal
+2 -2
View File
@@ -41,8 +41,8 @@ static void printUsage(char **argv)
fprintf(stderr, " --%s\n Allows probing and installing major upgrades. Without passing this, an exit\n status of 2 is returned if a major upgrade is found.\n", ALLOW_MAJOR_UPGRADES_FLAG);
fprintf(stderr, " --%s\n List of allowed Sparkle channels to look for updates in. By default,\n only the default channel is used.\n", CHANNELS_FLAG);
fprintf(stderr, " --%s\n URL for appcast feed. This URL will be used for the feed instead of the one\n in the bundle's Info.plist or in the bundle's user defaults.\n", FEED_URL_FLAG);
fprintf(stderr, " --%s\n Allows prompting the user for an authorization dialog prompt if the\n installer needs elevated privileges, or allows performing an interactive\n installer package.\n", INTERACTIVE_FLAG);
fprintf(stderr, " --%s\n If update permission is requested, this enables automatic update checks.\n Note that this behavior may overwrite the user's defaults for the bundle.\n This option has no effect if --%s is passed, or if the\n user has replied to this request already, or if the developer configured\n to skip it.\n", GRANT_AUTOMATIC_CHECKING_FLAG, CHECK_NOW_FLAG);
fprintf(stderr, " --%s\n Allows prompting the user for an authorization dialog prompt if the\n installer needs elevated privileges, or allows performing an interactive\n installer package. Without passing this, an exit status of 3 is returned\n if an update requires user interaction. An exit status of 5 is returned\n if the user cancels the authorization prompt.\n", INTERACTIVE_FLAG);
fprintf(stderr, " --%s\n If update permission is requested, this enables automatic update checks.\n Note that this behavior may overwrite the user's defaults for the bundle.\n This option has no effect if --%s is passed, or if the\n user has replied to this request already, or if the developer configured\n to skip it. Without passing this, an exit status of 6 is returned\n if permission is needed.\n", GRANT_AUTOMATIC_CHECKING_FLAG, CHECK_NOW_FLAG);
fprintf(stderr, " --%s\n Choose to send system profile information if update permission is requested.\n This option can only take effect if --%s is passed.\n", SEND_PROFILE_FLAG, GRANT_AUTOMATIC_CHECKING_FLAG);
fprintf(stderr, " --%s\n Defer installation until after the application terminates on its own. The\n application will not be relaunched unless the installation is resumed later.\n", DEFER_FLAG);
fprintf(stderr, " --%s\n Enable verbose logging.\n", VERBOSE_FLAG);