mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-23 04:34:27 +00:00
Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1adbbccf5e | ||
|
|
d792a3a4a9 | ||
|
|
32bc43fa9b | ||
|
|
4b9388d9aa | ||
|
|
c53ed49e5e | ||
|
|
011a7dbb36 | ||
|
|
fb1f5aafbe | ||
|
|
52511a2b1c | ||
|
|
5b312aa63e | ||
|
|
7cec9dbbe0 | ||
|
|
dde2b48af7 | ||
|
|
9b6f962b31 | ||
|
|
1cba9f466d | ||
|
|
dbe1ae94f9 | ||
|
|
45956ae5b0 | ||
|
|
4c1bebedf9 | ||
|
|
873a026627 | ||
|
|
9e54c5ca4d | ||
|
|
083790afa7 | ||
|
|
c3030a6621 | ||
|
|
e48edc6856 | ||
|
|
a81f8f3d2d | ||
|
|
88c325a66f |
No files matched your search
@@ -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 }}
|
||||
|
||||
@@ -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 }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
|
||||
- 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 }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
tag_name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
fail_on_unmatched_files: true
|
||||
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
body_path: latest-changes.txt
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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,16 @@ 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)
|
||||
* Prevent potential rapid update checks from sleep/wake events using a minimum monotonic delay from #2000 (Zorg)
|
||||
* Whitelist about:srcdoc as a safe web URL from #1938, #2007 (Louis Pontoise, Zorg)
|
||||
* Backport not hiding update window on deactivation from #2008 (Zorg)
|
||||
|
||||
# 1.27.0
|
||||
|
||||
* Deprecate not using EdDSA and skip DSA verification when possible in #1892 (Zorg)
|
||||
|
||||
@@ -32,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.4
|
||||
CURRENT_PROJECT_VERSION = 2004
|
||||
// These variables must have a space after the '=' too
|
||||
SPARKLE_VERSION_SUFFIX = -beta.5
|
||||
CURRENT_PROJECT_VERSION = 2005
|
||||
|
||||
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
|
||||
@@ -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
|
||||
@@ -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"
|
||||
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
import PackageDescription
|
||||
|
||||
// Version is technically not required here, SPM doesn't check
|
||||
let version = "2.0.0-beta.4"
|
||||
let version = "2.0.0-beta.5"
|
||||
// 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.4"
|
||||
let checksum = "4f863dc048e8c4170e0c3fdbdb9a9b03af605adbd778aa11799db3f34068202d"
|
||||
let tag = "2.0.0-beta.5"
|
||||
let checksum = "a53a83db87a5e705d58227f6d9088c76425ddb00e0a9eded87ae845ce5903529"
|
||||
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
|
||||
|
||||
let package = Package(
|
||||
|
||||
+8
-7
@@ -1,11 +1,11 @@
|
||||
# Sparkle 2 (Beta)  []()
|
||||
|
||||
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
|
||||
|
||||
@@ -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>
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "2.0.0-beta.4"
|
||||
s.version = "2.0.0-beta.5"
|
||||
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',
|
||||
|
||||
@@ -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>
|
||||
Vendored
+22
-3
@@ -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
@@ -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
|
||||
Vendored
+5
-2
@@ -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;
|
||||
@@ -278,12 +279,14 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
|
||||
/**
|
||||
Appropriately schedules or cancels the update checking timer according to the preferences for time interval and automatic checks.
|
||||
|
||||
If you change the `updateCheckInterval` or `automaticallyChecksForUpdates` properties, the update cycle will be reset automatically after a short delay.
|
||||
The update cycle is also started automatically after the updater is started. In these cases, this method should not be called directly.
|
||||
|
||||
This call does not change the date of the next check, but only the internal timer.
|
||||
*/
|
||||
- (void)resetUpdateCycle;
|
||||
|
||||
|
||||
/**
|
||||
The system profile information that is sent when checking for updates.
|
||||
*/
|
||||
|
||||
Vendored
+86
-19
@@ -62,6 +62,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@property (nonatomic) BOOL showingPermissionRequest;
|
||||
|
||||
@property (nonatomic, copy) NSDate *updateLastCheckedDate;
|
||||
@property (nonatomic) NSTimeInterval lastMonotonicUpdateCheckTime;
|
||||
|
||||
@property (nonatomic) BOOL loggedATSWarning;
|
||||
@property (nonatomic) BOOL loggedNoSecureKeyWarning;
|
||||
@@ -87,6 +88,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@synthesize canCheckForUpdates = _canCheckForUpdates;
|
||||
@synthesize showingPermissionRequest = _showingPermissionRequest;
|
||||
@synthesize updateLastCheckedDate = _updateLastCheckedDate;
|
||||
@synthesize lastMonotonicUpdateCheckTime = _lastMonotonicUpdateCheckTime;
|
||||
@synthesize loggedATSWarning = _loggedATSWarning;
|
||||
@synthesize loggedNoSecureKeyWarning = _loggedNoSecureKeyWarning;
|
||||
|
||||
@@ -225,7 +227,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 +239,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;
|
||||
}
|
||||
@@ -398,7 +404,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 usingCurrentDate:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,17 +424,27 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
return [self updateLastCheckedDate];
|
||||
}
|
||||
|
||||
- (NSTimeInterval)currentMonotonicTimeInterval
|
||||
{
|
||||
// This is monotonic system time while the system is not asleep
|
||||
return [[NSProcessInfo processInfo] systemUptime];
|
||||
}
|
||||
|
||||
- (void)updateLastUpdateCheckDate
|
||||
{
|
||||
[self willChangeValueForKey:NSStringFromSelector(@selector((lastUpdateCheckDate)))];
|
||||
|
||||
// We use an intermediate property for last update check date due to https://github.com/sparkle-project/Sparkle/pull/1135
|
||||
[self setUpdateLastCheckedDate:[NSDate date]];
|
||||
[self.host setObject:[self updateLastCheckedDate] forUserDefaultsKey:SULastCheckTimeKey];
|
||||
|
||||
self.lastMonotonicUpdateCheckTime = [self currentMonotonicTimeInterval];
|
||||
|
||||
[self didChangeValueForKey:NSStringFromSelector(@selector((lastUpdateCheckDate)))];
|
||||
}
|
||||
|
||||
// Note this method is never called when sessionInProgress is YES
|
||||
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately
|
||||
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately usingCurrentDate:(BOOL)usingCurrentDate
|
||||
{
|
||||
[self.updaterTimer invalidate];
|
||||
|
||||
@@ -475,23 +491,74 @@ 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 dateIntervalSinceCheck;
|
||||
NSTimeInterval minimumMonotonicEnforcedDelay;
|
||||
if (usingCurrentDate) {
|
||||
// How long has it been since last we checked for an update?
|
||||
NSDate *lastCheckDate = [self lastUpdateCheckDate];
|
||||
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
|
||||
NSTimeInterval wallTimeInterval = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
|
||||
if (wallTimeInterval < 0) {
|
||||
// Last update check date is in the future and bogus, so reset it to current date
|
||||
[self updateLastUpdateCheckDate];
|
||||
|
||||
// And assume a full update interval is needed
|
||||
dateIntervalSinceCheck = 0;
|
||||
minimumMonotonicEnforcedDelay = SUMinimumMonotonicUpdateCheckInterval;
|
||||
} else {
|
||||
// Check the monotonic clock for an enforced minimum delay
|
||||
NSTimeInterval lastMonotonicUpdateCheckTime = self.lastMonotonicUpdateCheckTime;
|
||||
if (lastMonotonicUpdateCheckTime <= 0) {
|
||||
// When the updater is first started, the last monotonic time may not have been updated yet.
|
||||
// In this case there is no enforced minimum delay.
|
||||
minimumMonotonicEnforcedDelay = 0;
|
||||
} else {
|
||||
// Compute an enforced minimum delay based on elapsed monotonic time
|
||||
// The elapsed monotonic time is more stable than wall time interval and does not include the
|
||||
// amount of time while the system is asleep
|
||||
NSTimeInterval currentMonotonicTime = [self currentMonotonicTimeInterval];
|
||||
NSTimeInterval elapsedMonotonicTime = (currentMonotonicTime - lastMonotonicUpdateCheckTime);
|
||||
|
||||
if (elapsedMonotonicTime < SUMinimumMonotonicUpdateCheckInterval) {
|
||||
minimumMonotonicEnforcedDelay = (SUMinimumMonotonicUpdateCheckInterval - elapsedMonotonicTime);
|
||||
} else {
|
||||
minimumMonotonicEnforcedDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
dateIntervalSinceCheck = wallTimeInterval;
|
||||
}
|
||||
} else {
|
||||
// Without using the current date, we assume a full update interval is needed
|
||||
dateIntervalSinceCheck = 0;
|
||||
minimumMonotonicEnforcedDelay = SUMinimumMonotonicUpdateCheckInterval;
|
||||
}
|
||||
|
||||
if (updateCheckInterval < SUMinimumUpdateCheckInterval) {
|
||||
updateCheckInterval = SUMinimumUpdateCheckInterval;
|
||||
}
|
||||
|
||||
// Now we want to figure out how long until we check again.
|
||||
if (updateCheckInterval < SUMinimumUpdateCheckInterval)
|
||||
updateCheckInterval = SUMinimumUpdateCheckInterval;
|
||||
if (intervalSinceCheck < updateCheckInterval) {
|
||||
NSTimeInterval delayUntilCheck = (updateCheckInterval - intervalSinceCheck); // It hasn't been long enough.
|
||||
if ([self.delegate respondsToSelector:@selector(updater:willScheduleUpdateCheckAfterDelay:)]) {
|
||||
[self.delegate updater:self willScheduleUpdateCheckAfterDelay:delayUntilCheck];
|
||||
}
|
||||
[self.updaterTimer startAndFireAfterDelay:delayUntilCheck];
|
||||
NSTimeInterval wallDelayUntilCheck;
|
||||
if (dateIntervalSinceCheck < updateCheckInterval) {
|
||||
// It hasn't been long enough.
|
||||
wallDelayUntilCheck = (updateCheckInterval - dateIntervalSinceCheck);
|
||||
} else {
|
||||
wallDelayUntilCheck = 0;
|
||||
}
|
||||
|
||||
// Now compute delay with enforced minimum delay requirement
|
||||
// The minimum delay (based on monotonic clock) is an extra layer of defense to prevent too frequent update checks
|
||||
// in case the wall clock is not working properly (eg from too many system wake events, system date changes, NTP..)
|
||||
NSTimeInterval finalDelayUntilCheck = MAX(wallDelayUntilCheck, minimumMonotonicEnforcedDelay);
|
||||
if (finalDelayUntilCheck <= 0) {
|
||||
// We're overdue! Run one now.
|
||||
[self checkForUpdatesInBackground];
|
||||
} else {
|
||||
if ([self.delegate respondsToSelector:@selector(updater:willScheduleUpdateCheckAfterDelay:)]) {
|
||||
[self.delegate updater:self willScheduleUpdateCheckAfterDelay:finalDelayUntilCheck];
|
||||
}
|
||||
[self.updaterTimer startTimerWithWallTimeDelay:wallDelayUntilCheck monotonicTimeDelay:minimumMonotonicEnforcedDelay];
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -673,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) {
|
||||
if (shouldScheduleNextUpdateCheck) {
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:NO];
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:NO usingCurrentDate:NO];
|
||||
} else {
|
||||
SULog(SULogLevelDefault, @"Disabling scheduled updates..");
|
||||
}
|
||||
@@ -724,7 +791,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 usingCurrentDate:NO];
|
||||
}
|
||||
}
|
||||
}];
|
||||
@@ -769,7 +836,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
if (!self.sessionInProgress) {
|
||||
[self cancelNextUpdateCycle];
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO];
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentDate:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -366,7 +366,7 @@ SU_EXPORT extern NSString *const SUSystemProfilerPreferredLanguageKey;
|
||||
|
||||
Automatic update checks need to be enabled for this to trigger.
|
||||
|
||||
@param delay The delay in seconds until the next scheduled update will occur.
|
||||
@param delay The delay in seconds until the next scheduled update will occur. This is an approximation and may vary due to system state.
|
||||
|
||||
@param updater The updater instance.
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)initWithDelegate:(id<SPUUpdaterTimerDelegate>)delegate;
|
||||
|
||||
- (void)startAndFireAfterDelay:(NSTimeInterval)delay;
|
||||
- (void)startTimerWithWallTimeDelay:(NSTimeInterval)wallDelayUntilCheck monotonicTimeDelay:(NSTimeInterval)minimumEnforcedDelay;
|
||||
|
||||
- (void)invalidate;
|
||||
|
||||
|
||||
Vendored
+67
-17
@@ -15,14 +15,16 @@
|
||||
@interface SPUUpdaterTimer ()
|
||||
|
||||
@property (nonatomic, readonly, weak) id<SPUUpdaterTimerDelegate> delegate;
|
||||
@property (nonatomic) dispatch_source_t source;
|
||||
@property (nonatomic) dispatch_source_t wallTimeSource;
|
||||
@property (nonatomic) dispatch_source_t monotonicTimeSource;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SPUUpdaterTimer
|
||||
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize source = _source;
|
||||
@synthesize wallTimeSource = _wallTimeSource;
|
||||
@synthesize monotonicTimeSource = _monotonicTimeSource;
|
||||
|
||||
- (instancetype)initWithDelegate:(id<SPUUpdaterTimerDelegate>)delegate
|
||||
{
|
||||
@@ -33,28 +35,76 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)startAndFireAfterDelay:(NSTimeInterval)delay
|
||||
- (void)startTimerWithWallTimeDelay:(NSTimeInterval)wallTimeDelay monotonicTimeDelay:(NSTimeInterval)monotonicTimeDelay
|
||||
{
|
||||
self.source = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
|
||||
|
||||
// We use the wall time instead of cpu time for our dispatch timer
|
||||
// So eg if the computer sleeps we want to include that time spent in our timer
|
||||
dispatch_time_t timeToFire = dispatch_walltime(NULL, (int64_t)(delay * NSEC_PER_SEC));
|
||||
dispatch_source_set_timer(self.source, timeToFire, DISPATCH_TIME_FOREVER, SULeewayUpdateCheckInterval * NSEC_PER_SEC);
|
||||
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
dispatch_source_set_event_handler(self.source, ^{
|
||||
[weakSelf.delegate updaterTimerDidFire];
|
||||
});
|
||||
// When timersFired reaches 2, both wall/monotonic timers have been fired, and the delegate is ready to receive the notification
|
||||
__block uint8_t timersFired = 0;
|
||||
|
||||
dispatch_resume(self.source);
|
||||
if (wallTimeDelay <= 0) {
|
||||
timersFired++;
|
||||
self.wallTimeSource = nil;
|
||||
} else {
|
||||
// We use the wall time instead of cpu time for a large date interval
|
||||
// So eg if the computer sleeps we want to include that time spent in our timer
|
||||
self.wallTimeSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
|
||||
|
||||
dispatch_time_t wallTime = dispatch_walltime(NULL, (int64_t)(wallTimeDelay * NSEC_PER_SEC));
|
||||
dispatch_source_set_timer(self.wallTimeSource, wallTime, DISPATCH_TIME_FOREVER, SULeewayWallUpdateCheckInterval * NSEC_PER_SEC);
|
||||
|
||||
dispatch_source_set_event_handler(self.wallTimeSource, ^{
|
||||
timersFired++;
|
||||
if (timersFired > 1) {
|
||||
[weakSelf.delegate updaterTimerDidFire];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (monotonicTimeDelay <= 0) {
|
||||
timersFired++;
|
||||
self.monotonicTimeSource = nil;
|
||||
} else {
|
||||
// We also use monotonic time to enforce a minimum delay interval
|
||||
// This ensures we don't fire the wall clock based timer too frequently if the real clock changes
|
||||
self.monotonicTimeSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
|
||||
|
||||
dispatch_time_t monotonicTime = dispatch_time(DISPATCH_TIME_NOW , (int64_t)(monotonicTimeDelay * NSEC_PER_SEC));
|
||||
dispatch_source_set_timer(self.monotonicTimeSource, monotonicTime, DISPATCH_TIME_FOREVER, SULeewayMonotonicUpdateCheckInterval * NSEC_PER_SEC);
|
||||
|
||||
dispatch_source_set_event_handler(self.monotonicTimeSource, ^{
|
||||
timersFired++;
|
||||
if (timersFired > 1) {
|
||||
[weakSelf.delegate updaterTimerDidFire];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Have both timers already ran? (this should be unlikely)
|
||||
if (timersFired > 1) {
|
||||
[self.delegate updaterTimerDidFire];
|
||||
} else {
|
||||
// Resume available timers
|
||||
|
||||
if (self.wallTimeSource != nil) {
|
||||
dispatch_resume(self.wallTimeSource);
|
||||
}
|
||||
|
||||
if (self.monotonicTimeSource != nil) {
|
||||
dispatch_resume(self.monotonicTimeSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
if (self.source != nil) {
|
||||
dispatch_source_cancel(self.source);
|
||||
self.source = nil;
|
||||
if (self.wallTimeSource != nil) {
|
||||
dispatch_source_cancel(self.wallTimeSource);
|
||||
self.wallTimeSource = nil;
|
||||
}
|
||||
|
||||
if (self.monotonicTimeSource != nil) {
|
||||
dispatch_source_cancel(self.monotonicTimeSource);
|
||||
self.monotonicTimeSource = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+11
@@ -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.
|
||||
|
||||
|
||||
Vendored
+50
-7
@@ -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) {
|
||||
|
||||
Vendored
+4
-1
@@ -19,7 +19,9 @@
|
||||
extern const NSTimeInterval SUDefaultUpdatePermissionPromptInterval;
|
||||
extern const NSTimeInterval SUMinimumUpdateCheckInterval;
|
||||
extern const NSTimeInterval SUDefaultUpdateCheckInterval;
|
||||
extern const uint64_t SULeewayUpdateCheckInterval;
|
||||
extern const NSTimeInterval SUMinimumMonotonicUpdateCheckInterval;
|
||||
extern const uint64_t SULeewayWallUpdateCheckInterval;
|
||||
extern const uint64_t SULeewayMonotonicUpdateCheckInterval;
|
||||
extern const NSTimeInterval SUImpatientUpdateCheckInterval;
|
||||
|
||||
extern NSString *const SUBundleIdentifier;
|
||||
@@ -89,6 +91,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;
|
||||
|
||||
Vendored
+5
-1
@@ -18,8 +18,11 @@
|
||||
// Define some minimum intervals to avoid DoS-like checking attacks
|
||||
const NSTimeInterval SUMinimumUpdateCheckInterval = DEBUG ? 60 : (60 * 60);
|
||||
const NSTimeInterval SUDefaultUpdateCheckInterval = DEBUG ? 60 : (60 * 60 * 24);
|
||||
const NSTimeInterval SUMinimumMonotonicUpdateCheckInterval = DEBUG ? 30 : (60 * 5);
|
||||
|
||||
// The amount of time the system can defer our update check (for improved performance)
|
||||
const uint64_t SULeewayUpdateCheckInterval = DEBUG ? 1 : 15;
|
||||
const uint64_t SULeewayWallUpdateCheckInterval = DEBUG ? 1 : 60;
|
||||
const uint64_t SULeewayMonotonicUpdateCheckInterval = DEBUG ? 1 : 5;
|
||||
|
||||
// If the update has already been automatically downloaded, we normally don't want to bug the user about the update
|
||||
// However if the user has gone a very long time without quitting an application, we will bug them
|
||||
@@ -86,6 +89,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";
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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)
|
||||
|
||||
@@ -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"];
|
||||
|
||||
@@ -26,6 +26,10 @@ class SUTestApplicationTest: XCTestCase
|
||||
func testRegularUpdate()
|
||||
{
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments = [
|
||||
"-AppleLanguages",
|
||||
"(en)"
|
||||
]
|
||||
app.launch()
|
||||
|
||||
XCTAssertFalse(app.dialogs["alert"].staticTexts["Update succeeded!"].exists, "Update is already installed; please do a clean build")
|
||||
|
||||
@@ -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!
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ func extractVersion(parent: XMLNode) -> String? {
|
||||
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) {
|
||||
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, fullReleaseNotesLink: String?, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
|
||||
let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent
|
||||
|
||||
let sparkleNS = "http://www.andymatuschak.org/xml-namespaces/sparkle"
|
||||
@@ -168,6 +168,12 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
|
||||
item.addChild(linkElement)
|
||||
}
|
||||
|
||||
if let fullReleaseNotesLink = fullReleaseNotesLink,
|
||||
let fullReleaseNotesElement = XMLElement.element(withName: SUAppcastElementFullReleaseNotesLink, uri: sparkleNS) as? XMLElement {
|
||||
fullReleaseNotesElement.setChildren([text(fullReleaseNotesLink)])
|
||||
item.addChild(fullReleaseNotesElement)
|
||||
}
|
||||
|
||||
// Set new channel name
|
||||
if let newChannelName = newChannel,
|
||||
let channelNameElement = XMLElement.element(withName: SUAppcastElementChannel, uri: sparkleNS) as? XMLElement {
|
||||
|
||||
@@ -72,6 +72,9 @@ struct GenerateAppcast: ParsableCommand {
|
||||
@Option(name: .customLong("release-notes-url-prefix"), help: ArgumentHelp("A URL that will be used as prefix for constructing URLs for release notes.", valueName: "url"), transform: { URL(string: $0) })
|
||||
var releaseNotesURLPrefix : URL?
|
||||
|
||||
@Option(name: .customLong("full-release-notes-url"), help: ArgumentHelp("A URL that will be used for the full release notes.", valueName: "url"))
|
||||
var fullReleaseNotesURL: String?
|
||||
|
||||
@Option(name: .long, help: ArgumentHelp("A URL to the application's website which Sparkle may use for directing users to if they cannot download a new update from within the application. This will be used for new generated update items. By default, no product link is used.", valueName: "link"))
|
||||
var link: String?
|
||||
|
||||
@@ -220,7 +223,7 @@ struct GenerateAppcast: ParsableCommand {
|
||||
relativeTo: archivesSourceDir)
|
||||
|
||||
// Write the appcast
|
||||
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
|
||||
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, fullReleaseNotesLink: fullReleaseNotesURL, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
|
||||
|
||||
// Inform the user, pluralizing "update" if necessary
|
||||
let pluralizeUpdates = { $0 == 1 ? "update" : "updates" }
|
||||
|
||||
Reference in new issue
Block a user