Compare commits

..
23 Commits
Author SHA1 Message Date
Kornel Lesiński c0d45952a9 Removed unimportant changelog entry 2017-01-23 01:21:31 +00:00
Kornel 34179edd6d Merge pull request #1001 from zorgiepoo/appkit-prevention
Add AppKit prevention guards to modules that shouldn't import it
2017-01-17 13:09:38 +00:00
Zorg 530f3a4a63 Explain why I'm not relying on the compiler to throw linkage errors 2017-01-17 07:17:14 -05:00
Zorg 135d05b8b8 Add AppKitPrevention header to reduce redundancy.
Note this header should be included last in implementation files, which is why I added extra padding.
2017-01-17 07:08:29 -05:00
Zorg c56694382e Add AppKit prevention guards to modules that shouldn't import it 2017-01-16 21:17:25 -05:00
Kornel a39023e95b Merge pull request #1000 from zorgiepoo/generics
Add Obj-C generics where applicable
2017-01-17 00:58:20 +00:00
Zorg 282f0ae58e Add Obj-C generics where applicable
In headers that are exported, we test to see if generic support is available.
2017-01-16 18:09:04 -05:00
Thomas Tempelmann c1488b0515 Adds test cases for "sparkle:criticalUpdate" tag. (#999)
* Adds a test case for the "criticalUpdate" appcast tag (not as a XCTest but simply as an assert inside the test app, because I was lazy and am working on an older Xcode version that does not support the currently needed swift version for the XCTest in SUAppcastTest.swift).

* Tests the "criticalUpdate" appcast tag, using the proper XCTest swift class. I haven't tested this, though, due to the lack of the needed Xcode version.

* Test case for Appcast now checks all 4 items for the correct "criticalUpdate" state.

* Adds a test case for the "criticalUpdate" appcast tag (not as a XCTest but simply as an assert inside the test app, because I was lazy and am working on an older Xcode version that does not support the currently needed swift version for the XCTest in SUAppcastTest.swift). (reverted from commit 3ce1c9790b)
2017-01-16 00:02:32 +00:00
Kornel Lesiński 27c560b7d5 Proper fix for #995 2017-01-13 01:02:55 +00:00
Kornel Lesiński fbb040926e Fix URL/path confusion
Fixes #995
2017-01-13 00:44:41 +00:00
Kornel 548908628f Merge pull request #991 from zorgiepoo/upgrade-ci
Add 10.12 as SDK to run in Makefile and use Xcode 8.2 for Travis
2017-01-10 13:07:39 +00:00
Zorg d40bdb615a Add 10.12 as SDK to run in Makefile and use Xcode 8.2 for Travis 2017-01-10 06:40:35 -05:00
Kornel f43b9f7f02 Merge pull request #982 from sparkle-project/genapp
Workaround for bugs in NSXMLDocument prefix handling
2017-01-07 22:07:56 +00:00
Kornel Lesiński eafbb2cfad Copy debug symbols for generate_appcast 2017-01-07 21:57:39 +00:00
Kornel 5c408f5019 Merge pull request #984 from zorgiepoo/appcast-nonnil
The SUAppcast * is not going to be nil here; fixes analyzer warning
2017-01-07 17:43:46 +00:00
Zorg 9d35c819fd The SUAppcast * is not going to be nil here; fixes analyzer warning 2017-01-07 11:26:53 -05:00
Kornel Lesiński ee80a66896 Don't try to preserve namespace prefixes, because Apple's serializer is buggy
filed as rdar 29901669
2017-01-06 16:29:29 +00:00
Kornel Lesiński 187ae4fe57 Verify that the XML is serialized properly 2017-01-06 16:29:29 +00:00
Kornel Lesiński ca4d51561e Silence too-verbose delta 2017-01-06 16:29:29 +00:00
Kornel Lesiński 915c2047bf Fix accuracy of error message 2017-01-06 16:29:29 +00:00
Kornel f172cd32a8 Merge pull request #980 from sparkle-project/features
Updated README
2017-01-06 10:31:49 +00:00
Kornel Lesiński 8481035fb9 No server-side logic is a plus 2017-01-05 22:50:26 +00:00
Kornel Lesiński 7238c2aeb6 Updated README 2017-01-05 22:35:20 +00:00
48 changed files with 167 additions and 39 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode8
osx_image: xcode8.2
before_install:
- brew update
script: make ci
-1
View File
@@ -7,7 +7,6 @@
* Made manual check resume pending automatic updates instead of starting a new update (Kornel Lesiński)
* Started using `length` value from RSS if HTTP doesn't give one (Zorg)
* Hidden automatic updates checkbox for information only updates (Bi11)
* Fixed UI update scheduler not prompting for install & relaunch (Zorg)
* Added progressbar for DMG and binary delta extraction (Kornel Lesiński)
* Fixed showing of download status if we attempt a 2nd download (Zorg)
* Refactorings to sync with upcoming 2.0
+1
View File
@@ -24,6 +24,7 @@ if [ "$ACTION" = "" ] ; then
# because missing dSYMs in a release build SHOULD trigger a build failure
if [ "$CONFIGURATION" = "Release" ] ; then
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/generate_appcast.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
fi
+1 -1
View File
@@ -31,7 +31,7 @@ ci:
( rm -rf build && xcodebuild -sdk "macosx10.$$i" -scheme Distribution -configuration Coverage -derivedDataPath build ) || exit 1 ; \
fi ; \
done
for i in {10..11} ; do \
for i in {10..12} ; do \
if xcrun --sdk "macosx10.$$i" --show-sdk-path 2> /dev/null ; then \
( rm -rf build && xcodebuild -sdk "macosx10.$$i" -scheme Distribution -configuration Coverage -derivedDataPath build test ) || exit 1 ; \
fi ; \
+13 -18
View File
@@ -1,9 +1,21 @@
# Sparkle [![Build Status](https://travis-ci.org/sparkle-project/Sparkle.svg?branch=master)](https://travis-ci.org/sparkle-project/Sparkle) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![CocoaPods](https://img.shields.io/cocoapods/v/Sparkle.svg?maxAge=2592000)]() <a href="https://www.stackpath.com/?utm_source=sparkle-github&amp;utm_medium=badge&amp;utm_campaign=readme"><img src="https://img.shields.io/badge/sponsored%20by-StackPath-orange.svg" alt="sponsored by: StackPath"></a>
An easy-to-use software update framework for Cocoa developers.
Secure and reliable software update framework for Cocoa developers.
<img src="Resources/Screenshot.png" width="732" alt="Sparkle shows familiar update window with release notes">
## Features
* Seamless. There's no mention of Sparkle; your icons and app name are used.
* Secure. Updates are verified using DSA signatures and Apple Code Signing.
* Fast. Supports delta updates which only patch files that have changed.
* 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.
* Uses RSS-based appcasts for release information. Appcasts are a de-facto standard supported by 3rd party update-tracking programs and websites.
* Sparkle 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.
## Changes since 1.5b
* Compatibilty with macOS Sierra.
@@ -14,23 +26,6 @@ An easy-to-use software update framework for Cocoa developers.
* Upgraded and more reliable binary delta and code signing verification.
* Ability to mark updates as critical.
* Progress and status notifications for the host app.
* Name of finish_installation.app can be configured to match your app's name.
## Features
* Seamless integration—there's no mention of Sparkle; your icons and app name are used.
* True self-updating—the user can choose to automatically download and install all updates.
* Displays a detailed progress window to the user.
* Supports authentication for installing in secure locations.
* Supports Apple Code Signing and DSA signatures for ultra-secure updates.
* Easy to install. Sparkle requires no code in your app, so it's trivial to upgrade or remove the framework.
* Uses RSS-based appcasts for release information. Appcasts are supported by 3rd party update-tracking programs and websites.
* Displays release notes to the user via WebKit.
* Sparkle doesn't bug the user until second launch for better first impressions.
* Deep delegate support to make Sparkle work exactly as you need.
* Optionally sends system information to the server when checking for updates.
* Supports bundles, preference panes, plugins, and other non-.app software. Can install .pkg files for more complicated products.
* Supports branches due to minimum OS version requirements.
## Requirements
+2
View File
@@ -732,6 +732,7 @@
7205C4331E12C23C00E370AE /* ConfigGenerateAppcast.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcast.xcconfig; sourceTree = "<group>"; };
7205C4341E12C66D00E370AE /* ConfigGenerateAppcastRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastRelease.xcconfig; sourceTree = "<group>"; };
7205C4351E12CA7000E370AE /* ConfigGenerateAppcastDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastDebug.xcconfig; sourceTree = "<group>"; };
720767D01E2E3DD300F9A850 /* AppKitPrevention.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitPrevention.h; sourceTree = "<group>"; };
720B16421C66433D006985FB /* UITests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "UITests-Info.plist"; path = "UITests/UITests-Info.plist"; sourceTree = SOURCE_ROOT; };
720B16431C66433D006985FB /* SUTestApplicationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SUTestApplicationTest.swift; path = UITests/SUTestApplicationTest.swift; sourceTree = SOURCE_ROOT; };
7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = "<group>"; };
@@ -1036,6 +1037,7 @@
1495006D195FBBBD00BC5B5B /* Sparkle */ = {
isa = PBXGroup;
children = (
720767D01E2E3DD300F9A850 /* AppKitPrevention.h */,
61299B3909CB055000B7442F /* Appcast Support */,
55C14BD5136EEFD000649790 /* Autoupdate */,
089C1665FE841158C02AAC07 /* Framework Resources */,
+20
View File
@@ -0,0 +1,20 @@
//
// AppKitPrevention.h
// Sparkle
//
// Created by Mayur Pawashe on 1/17/17.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
// #include (not #import) this header to prevent AppKit from being imported
// Note this should be your LAST #include in your implementation file
// If this error is triggered, you can have Xcode indicate to you which source file including this header caused the issue
// One may wonder for certain targets where AppKit is banned completely, why just not link AppKit instead.
// Well, Xcode has thing called auto-linking that I don't trust very much.
// Even after trying to disable the setting, I've had targets able to link to AppKit without AppKit being specified in the list of linked libraries.
#ifdef _APPKITDEFINES_H
#error This is a core or daemon-safe module and should NOT import AppKit
#endif
+5
View File
@@ -22,7 +22,12 @@ NS_ASSUME_NONNULL_BEGIN
SU_EXPORT @interface SUAppcast : NSObject<NSURLDownloadDelegate>
@property (copy, nullable) NSString *userAgentString;
#if __has_feature(objc_generics)
@property (copy, nullable) NSDictionary<NSString *, NSString *> *httpHeaders;
#else
@property (copy, nullable) NSDictionary *httpHeaders;
#endif
- (void)fetchAppcastFromURL:(NSURL *)url completionBlock:(void (^)(NSError *_Nullable))err;
- (SUAppcast *)copyWithoutDeltaUpdates;
+4 -1
View File
@@ -12,6 +12,9 @@
#import "SULocalizations.h"
#import "SUErrors.h"
#include "AppKitPrevention.h"
@interface NSXMLElement (SUAppcastExtensions)
@property (readonly, copy) NSDictionary *attributesAsDictionary;
@end
@@ -65,7 +68,7 @@
if (self.httpHeaders) {
for (NSString *key in self.httpHeaders) {
id value = [self.httpHeaders objectForKey:key];
NSString *value = [self.httpHeaders objectForKey:key];
[request setValue:value forHTTPHeaderField:key];
}
}
+3
View File
@@ -10,6 +10,9 @@
#import "SULog.h"
#import "SUConstants.h"
#include "AppKitPrevention.h"
@interface SUAppcastItem ()
@property (copy, readwrite) NSString *title;
@property (copy, readwrite) NSString *dateString;
+1 -1
View File
@@ -158,7 +158,7 @@
[[updater delegate] updater:self.updater didFinishLoadingAppcast:ac];
}
NSDictionary *userInfo = (ac != nil) ? @{ SUUpdaterAppcastNotificationKey: ac } : nil;
NSDictionary *userInfo = @{ SUUpdaterAppcastNotificationKey: ac };
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFinishLoadingAppCastNotification object:self.updater userInfo:userInfo];
SUAppcastItem *item = nil;
+3
View File
@@ -15,6 +15,9 @@
#include <stdlib.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
{
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
+3
View File
@@ -18,6 +18,9 @@
#include <sys/stat.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
int compareFiles(const FTSENT **a, const FTSENT **b)
{
return strcoll((*a)->fts_name, (*b)->fts_name);
+3
View File
@@ -21,6 +21,9 @@
#include <sys/xattr.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
extern int bsdiff(int argc, const char **argv);
@interface CreateBinaryDeltaOperation : NSOperation
+2
View File
@@ -20,6 +20,8 @@
#define VERSION_COMMAND @"version"
#define VERSION_ALTERNATE_COMMAND @"--version"
#include "AppKitPrevention.h"
static void printUsage(NSString *programName)
{
fprintf(stderr, "Usage:\n");
+3
View File
@@ -13,6 +13,9 @@
#import "SULog.h"
#import "SUFileManager.h"
#include "AppKitPrevention.h"
@interface SUBinaryDeltaUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
+3
View File
@@ -8,6 +8,9 @@
#import "SUBundleIcon.h"
#include "AppKitPrevention.h"
@implementation SUBundleIcon
+ (NSURL *)iconURLForBundle:(NSBundle *)bundle
+3
View File
@@ -11,6 +11,9 @@
#import "SUCodeSigningVerifier.h"
#import "SULog.h"
#include "AppKitPrevention.h"
@implementation SUCodeSigningVerifier
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError *__autoreleasing *)error
+2
View File
@@ -13,6 +13,8 @@
#define DEBUG 0
#endif
#include "AppKitPrevention.h"
// 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);
+3
View File
@@ -16,6 +16,9 @@
#import "SULog.h"
#include <CommonCrypto/CommonDigest.h>
#include "AppKitPrevention.h"
@implementation SUDSAVerifier {
SecKeyRef _secKey;
}
+3
View File
@@ -10,6 +10,9 @@
#import "SUUnarchiverNotifier.h"
#import "SULog.h"
#include "AppKitPrevention.h"
@interface SUDiskImageUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
+3
View File
@@ -15,6 +15,9 @@
#include <sys/errno.h>
#include <sys/time.h>
#include "AppKitPrevention.h"
static char SUAppleQuarantineIdentifier[] = "com.apple.quarantine";
static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
+3
View File
@@ -9,6 +9,9 @@
#import "SUGuidedPackageInstaller.h"
#import "SUFileManager.h"
#include "AppKitPrevention.h"
@interface SUGuidedPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
+3
View File
@@ -11,6 +11,9 @@
#include <sys/mount.h> // For statfs for isRunningOnReadOnlyVolume
#import "SULog.h"
#include "AppKitPrevention.h"
// This class should not rely on AppKit and should also be process independent
// For example, it should not have code that tests writabilty to somewhere on disk,
// as that may depend on the privileges of the process owner. Or code that depends on
+3
View File
@@ -15,6 +15,9 @@
#import "SULog.h"
#import "SUErrors.h"
#include "AppKitPrevention.h"
@implementation SUInstaller
+ (BOOL)isAliasFolderAtPath:(NSString *)path
+2
View File
@@ -14,6 +14,8 @@
#include "SULog.h"
#include "AppKitPrevention.h"
// -----------------------------------------------------------------------------
// Constants:
// -----------------------------------------------------------------------------
+3
View File
@@ -7,6 +7,9 @@
#import "SUOperatingSystem.h"
#include "AppKitPrevention.h"
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000
@interface NSProcessInfo ()
- (NSOperatingSystemVersion)operatingSystemVersion;
+3
View File
@@ -11,6 +11,9 @@
#import "SUErrors.h"
#import "SULog.h"
#include "AppKitPrevention.h"
@interface SUPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
+3
View File
@@ -11,6 +11,9 @@
#import "SULog.h"
#import "SUErrors.h"
#include "AppKitPrevention.h"
@interface SUPipedUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
+3
View File
@@ -14,6 +14,9 @@
#import "SULog.h"
#import "SUErrors.h"
#include "AppKitPrevention.h"
@interface SUPlainInstaller ()
@property (nonatomic, readonly) SUHost *host;
+3
View File
@@ -9,6 +9,9 @@
#import "SUVersionComparisonProtocol.h"
#import "SUStandardVersionComparator.h"
#include "AppKitPrevention.h"
@implementation SUStandardVersionComparator
- (instancetype)init
+1 -1
View File
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
@class SUHost;
@interface SUSystemProfiler : NSObject
+ (NSArray *)systemProfileArrayForHost:(SUHost *)host;
+ (NSArray<NSDictionary<NSString *, NSString *> *> *)systemProfileArrayForHost:(SUHost *)host;
@end
+7 -5
View File
@@ -9,11 +9,13 @@
#import <Foundation/Foundation.h>
#import "SUSystemProfiler.h"
#import "SUHost.h"
#import "SUOperatingSystem.h"
#include <sys/sysctl.h>
#include "AppKitPrevention.h"
static NSString *const SUSystemProfilerApplicationNameKey = @"appName";
static NSString *const SUSystemProfilerApplicationVersionKey = @"appVersion";
static NSString *const SUSystemProfilerCPU64bitKey = @"cpu64bit";
@@ -28,19 +30,19 @@ static NSString *const SUSystemProfilerPreferredLanguageKey = @"lang";
@implementation SUSystemProfiler
+ (NSDictionary *)modelTranslationTable
+ (NSDictionary<NSString *, NSString *> *)modelTranslationTable
{
// Use explicit class to use the correct bundle even when subclassed
NSString *path = [[NSBundle bundleForClass:[SUSystemProfiler class]] pathForResource:@"SUModelTranslation" ofType:@"plist"];
return [[NSDictionary alloc] initWithContentsOfFile:path];
}
+ (NSArray *)systemProfileArrayForHost:(SUHost *)host
+ (NSArray<NSDictionary<NSString *, NSString *> *> *)systemProfileArrayForHost:(SUHost *)host
{
NSDictionary *modelTranslation = [self modelTranslationTable];
NSDictionary<NSString *, NSString *> *modelTranslation = [self modelTranslationTable];
// Gather profile information and append it to the URL.
NSMutableArray *profileArray = [NSMutableArray array];
NSMutableArray<NSDictionary<NSString *, NSString *> *> *profileArray = [NSMutableArray array];
NSArray *profileDictKeys = @[@"key", @"displayKey", @"value", @"displayValue"];
int error = 0;
int value = 0;
+3
View File
@@ -11,6 +11,9 @@
#import "SUConstants.h"
#import "SUFileManager.h"
#include "AppKitPrevention.h"
@implementation SUSystemUpdateInfo
+ (BOOL)systemAllowsAutomaticUpdatesForHost:(SUHost *)host
+3
View File
@@ -12,6 +12,9 @@
#import "SUDiskImageUnarchiver.h"
#import "SUBinaryDeltaUnarchiver.h"
#include "AppKitPrevention.h"
@implementation SUUnarchiver
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword
+3
View File
@@ -10,6 +10,9 @@
#import "SULocalizations.h"
#import "SUErrors.h"
#include "AppKitPrevention.h"
@interface SUUnarchiverNotifier ()
@property (nonatomic, readonly, copy) void (^completionBlock)(NSError * _Nullable);
+3
View File
@@ -8,6 +8,9 @@
#import "SUUpdatePermissionResponse.h"
#include "AppKitPrevention.h"
@implementation SUUpdatePermissionResponse
@synthesize automaticUpdateChecks = _automaticUpdateChecks;
+3
View File
@@ -13,6 +13,9 @@
#import "SUHost.h"
#import "SULog.h"
#include "AppKitPrevention.h"
@interface SUUpdateValidator ()
@property (nonatomic, readonly) SUHost *host;
+4
View File
@@ -160,7 +160,11 @@ SU_EXPORT @interface SUUpdater : NSObject
The keys of this dictionary are HTTP header fields (NSString) and values are corresponding values (NSString)
*/
#if __has_feature(objc_generics)
@property (copy) NSDictionary<NSString *, NSString *> *httpHeaders;
#else
@property (copy) NSDictionary *httpHeaders;
#endif
/*!
A property indicating whether or not the user's system profile information is sent when checking for updates.
+1 -1
View File
@@ -210,7 +210,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
}
if (shouldPrompt) {
NSArray *profileInfo = [SUSystemProfiler systemProfileArrayForHost:self.host];
NSArray<NSDictionary<NSString *, NSString *> *> *profileInfo = [SUSystemProfiler systemProfileArrayForHost:self.host];
// Always say we're sending the system profile here so that the delegate displays the parameters it would send.
if ([self.delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) {
profileInfo = [profileInfo arrayByAddingObjectsFromArray:[self.delegate feedParametersForUpdater:self sendingSystemProfile:YES]];
+4
View File
@@ -64,7 +64,11 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
\return An array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user.
*/
#if __has_feature(objc_generics)
- (NSArray<NSDictionary<NSString *, NSString *> *> *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
#else
- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
#endif
/*!
Returns a custom appcast URL.
+1
View File
@@ -7,6 +7,7 @@
<description>desc</description>
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="2.0" />
<sparkle:tags> <sparkle:criticalUpdate /> </sparkle:tags>
</item>
<!-- The best chosen release -->
<item>
+4
View File
@@ -25,19 +25,23 @@ class SUAppcastTest: XCTestCase {
XCTAssertEqual("Version 2.0", items[0].title);
XCTAssertEqual("desc", items[0].itemDescription);
XCTAssertEqual("Sat, 26 Jul 2014 15:20:11 +0000", items[0].dateString)
XCTAssertTrue(items[0].isCriticalUpdate);
// This is the best release matching our system version
XCTAssertEqual("Version 3.0", items[1].title);
XCTAssertNil(items[1].itemDescription);
XCTAssertNil(items[1].dateString)
XCTAssertFalse(items[1].isCriticalUpdate);
XCTAssertEqual("Version 4.0", items[2].title);
XCTAssertNil(items[2].itemDescription);
XCTAssertEqual("Sat, 26 Jul 2014 15:20:13 +0000", items[2].dateString)
XCTAssertFalse(items[2].isCriticalUpdate);
XCTAssertEqual("Version 5.0", items[3].title);
XCTAssertNil(items[3].itemDescription);
XCTAssertNil(items[3].dateString)
XCTAssertFalse(items[3].isCriticalUpdate);
// Test best appcast item & a delta update item
var deltaItem: SUAppcastItem? = nil
+3
View File
@@ -8,6 +8,9 @@
#import "SUFileOperationConstants.h"
#include "AppKitPrevention.h"
char * const SUFileOpRemoveQuarantineCommand = "xattr-d-apple-quarantine";
char * const SUFileOpCopyCommand = "cp";
char * const SUFileOpMoveCommand = "mv";
+3
View File
@@ -10,6 +10,9 @@
#import "SUFileManager.h"
#import "SUFileOperationConstants.h"
#include "AppKitPrevention.h"
// If we fail, we exit with a unique status code
// We don't try to NSLog because the logs can't be seen anywhere,
// and we don't want to log to a file irresponsibly (especially as root),
+8 -5
View File
@@ -23,7 +23,7 @@ class DeltaUpdate {
class func create(from: ArchiveItem, to: ArchiveItem, archivePath: URL) throws -> DeltaUpdate {
var applyDiffError: NSError? = nil;
if (!createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .beigeMajorVersion, true, &applyDiffError)) {
if (!createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .beigeMajorVersion, false, &applyDiffError)) {
throw applyDiffError!;
}
@@ -98,11 +98,14 @@ class ArchiveItem: CustomStringConvertible {
return "\(self.archivePath) \(self.version)"
}
var archiveURL: URL {
if let relative = self.feedURL {
return URL(string: self.archivePath.lastPathComponent, relativeTo: relative)!
var archiveURL: URL? {
guard let escapedFilename = self.archivePath.lastPathComponent.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else {
return nil;
}
return URL(string: self.archivePath.lastPathComponent)!
if let relative = self.feedURL {
return URL(string: escapedFilename, relativeTo: relative)
}
return URL(string: escapedFilename)
}
var pubDate : String {
+7 -3
View File
@@ -47,7 +47,6 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
XMLNode.Options.nodeLoadExternalEntitiesNever,
XMLNode.Options.nodePreserveCDATA,
XMLNode.Options.nodePreserveWhitespace,
XMLNode.Options.nodePreservePrefixes,
];
doc = try XMLDocument(contentsOf: appcastDestPath, options: Int(options.rawValue));
} catch {
@@ -118,8 +117,11 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
item.addChild(enclosure!);
}
guard let archiveURL = update.archiveURL?.absoluteString else {
throw makeError(code: .appcastError, "Bad archive name or feed URL");
};
var attributes = [
XMLNode.attribute(withName: "url", stringValue: update.archiveURL.absoluteString) as! XMLNode,
XMLNode.attribute(withName: "url", stringValue: archiveURL) as! XMLNode,
XMLNode.attribute(withName: "sparkle:version", uri: sparkleNS, stringValue: update.version) as! XMLNode,
XMLNode.attribute(withName: "length", stringValue: String(update.fileSize)) as! XMLNode,
XMLNode.attribute(withName: "type", stringValue: update.mimeType) as! XMLNode,
@@ -160,5 +162,7 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
}
let options = XMLNode.Options.nodeCompactEmptyElement;
try doc.xmlData(withOptions:Int(options.rawValue)).write(to: appcastDestPath);
let docData = doc.xmlData(withOptions:Int(options.rawValue));
let _ = try XMLDocument(data: docData, options:0); // Verify that it was generated correctly, which does not always happen!
try docData.write(to: appcastDestPath);
}
+1 -1
View File
@@ -31,7 +31,7 @@ func unarchive(itemPath:URL, archiveDestDir: URL, callback: @escaping (Error?) -
}, progressBlock: nil)
} else {
_ = try? fileManager.removeItem(at: itemCopy);
callback(makeError(code: .unarchivingError, "Can't create a hardlink to \(itemCopy)"));
callback(makeError(code: .unarchivingError, "Not a supported archive format: \(itemCopy)"));
}
} catch {
_ = try? fileManager.removeItem(at: tempDir);