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
30 changed files with 536 additions and 72 deletions

No files matched your search

+39 -2
View File
@@ -14,10 +14,12 @@ jobs:
include:
- xcode: 'xcode12.5.1'
xcode-path: '/Applications/Xcode_12.5.1.app/Contents/Developer'
upload-dist: true
upload-dist: false
run-analyzer: false
- xcode: 'xcode13.1'
xcode-path: '/Applications/Xcode_13.1.app/Contents/Developer'
upload-dist: false # In Beta, so no upload
upload-dist: true
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 }}
+36 -11
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 }}
@@ -27,16 +42,26 @@ jobs:
- name: "Extract latest changes from CHANGELOG"
run: |
./Configurations/generate_latest_changes.py > latest-changes.txt
- name: "Extract version information from project"
- name: "Overwrite project versions in project"
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
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
@@ -46,7 +71,7 @@ jobs:
run: |
git config user.name Sparkle-Bot
git config user.email sparkle.project.bot@gmail.com
git tag "${{ env.MARKETING_VERSION }}"
git tag "${{ github.event.inputs.marketingVersion }}"
- name: "Build release distribution"
run: make release
@@ -65,8 +90,8 @@ 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
+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];
+13 -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,13 @@ 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)
+2
View File
@@ -32,11 +32,13 @@ 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"
// These variables must have a space after the '=' too
SPARKLE_VERSION_SUFFIX = -beta.4
CURRENT_PROJECT_VERSION = 2004
@@ -16,4 +16,3 @@ DEAD_CODE_STRIPPING = YES
GCC_TREAT_WARNINGS_AS_ERRORS = NO
GCC_WARN_UNINITIALIZED_AUTOS = YES
COPY_PHASE_STRIP = NO
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO
+8
View File
@@ -43,6 +43,14 @@ if [ "$ACTION" = "" ] ; then
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/Symbols"
+8 -7
View File
@@ -1,11 +1,11 @@
# 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.
@@ -20,15 +20,16 @@ Please visit [Sparkle's website](http://sparkle-project.org) for up to date docu
## 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
+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>
+2 -2
View File
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
s.name = "Sparkle"
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.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"
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
: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',
+6
View File
@@ -325,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 */; };
@@ -1120,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>"; };
@@ -1226,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>"; };
@@ -1562,6 +1565,7 @@
14732BB51960ECBA00593899 /* Vendor */,
1420DE391962322200203BB0 /* Documentation */,
FA1941C40D94A6EA00DD942E /* Configurations */,
72563CA9272E1C5400AF39F0 /* .github */,
726B2B5E1C645FC900388755 /* UI Tests */,
0867D69AFE84028FC02AAC07 /* Frameworks */,
034768DFFF38A50411DB9C8B /* Products */,
@@ -1707,6 +1711,7 @@
5F1510A11C96E591006E1629 /* testnamespaces.xml */,
FA30773C24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml */,
5A5DD41B249F0F4B0045EB3E /* test-relative-urls.xml */,
729F7EAB27366353004592DC /* test-links.xml */,
5A5DD40324958AFF0045EB3E /* SUUpdateValidatorTest */,
);
path = Resources;
@@ -2971,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;
};
@@ -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>
+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
+2 -1
View File
@@ -141,6 +141,7 @@ 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.
@@ -163,7 +164,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
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.
- `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;
+27 -11
View File
@@ -225,7 +225,9 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
NSURL *xpcServiceBundleURL = [[self.sparkleBundle.bundleURL URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:xpcServiceBundleName];
if (![xpcServiceBundleURL checkResourceIsReachableAndReturnError:NULL]) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidUpdaterError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"XPC Service is enabled (%@) but does not exist: %@", xpcServiceEnabledKey, xpcServiceBundleURL.path] }];
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;
}
@@ -235,7 +237,9 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
NSURL *mainBundleXPCServiceURL = [[[mainBundle.bundleURL URLByAppendingPathComponent:@"Contents"] URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:xpcServiceBundleName];
if ([mainBundleXPCServiceURL checkResourceIsReachableAndReturnError: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] }];
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;
}
@@ -254,6 +258,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
}
}
BOOL test;
BOOL updatingMainBundle = [self.host.bundle isEqualTo:mainBundle];
if (feedURL != nil) {
@@ -398,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 scheduleNextUpdateCheckFiringImmediately:NO];
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:YES];
}
}
@@ -428,7 +433,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
}
// Note this method is never called when sessionInProgress is YES
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately usingCurrentTime:(BOOL)usingCurrentTime
{
[self.updaterTimer invalidate];
@@ -475,10 +480,21 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
// 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)
@@ -673,7 +689,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
// 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];
[strongSelf scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:NO];
} else {
SULog(SULogLevelDefault, @"Disabling scheduled updates..");
}
@@ -724,7 +740,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
// Ensure the delegate doesn't start a new session when being notified of the previous one ending
if (!strongSelf.sessionInProgress) {
[strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately];
[strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately usingCurrentTime:NO];
}
}
}];
@@ -769,7 +785,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
if (!self.sessionInProgress) {
[self cancelNextUpdateCycle];
[self scheduleNextUpdateCheckFiringImmediately:NO];
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:YES];
}
}
+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) {
+1
View File
@@ -89,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;
+1
View File
@@ -86,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
@@ -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
View File
@@ -8,6 +8,7 @@
<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!
}