diff --git a/CHANGELOG b/CHANGELOG index 058b3de3..1ab24e9d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +# 1.7.0 + +* Dropped support for Mac OS X 10.6. Sparkle now supports 10.7 and newer (including 10.10 Yosemite) on 64-bit Intel Macs (the last 32-bit Mac was released in 2006). +* Removed use of deprecated functions (Zachary Waldowski) +* Switched to modern Obj-C runtime and new literals syntax +* Removed pre-10.7 code. (C.W. Betts) +* Use more Blocks/libdispatch code. (C.W. Betts) +* Cleaned up and improved security of `generate_keys`/`sign_update` scripts # 1.6.1 @@ -36,3 +44,4 @@ * Prompts the user to update after a week (rather than a day) if he doesn't quit the app (Andy Matuschak) * Adding appcast item element, tag (Andy Matuschak) * We have this check box that says "Automatically download and install updates in the future." But we only download them automatically. We still ask permission again before installing them. (Andy Matuschak) + diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index 8f479c68..4a3d2f72 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -2,7 +2,7 @@ FINISH_INSTALL_TOOL_NAME = Autoupdate -CURRENT_PROJECT_VERSION = 1.6 +CURRENT_PROJECT_VERSION = 1.7.0 GCC_PRECOMPILE_PREFIX_HEADER = YES GCC_PREFIX_HEADER = $(SDKROOT)/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h ARCHS = x86_64 diff --git a/Configurations/ConfigFramework.xcconfig b/Configurations/ConfigFramework.xcconfig index 1e67b889..8cc1f884 100644 --- a/Configurations/ConfigFramework.xcconfig +++ b/Configurations/ConfigFramework.xcconfig @@ -2,7 +2,7 @@ INSTALL_PATH = @loader_path/../Frameworks DYLIB_COMPATIBILITY_VERSION = 1.6 -DYLIB_CURRENT_VERSION = 1.6 +DYLIB_CURRENT_VERSION = 1.7 PRODUCT_NAME = Sparkle WRAPPER_EXTENSION = framework FRAMEWORK_VERSION = A diff --git a/SUAutomaticUpdateAlert.h b/SUAutomaticUpdateAlert.h index 7a9022d9..5d1a91f5 100644 --- a/SUAutomaticUpdateAlert.h +++ b/SUAutomaticUpdateAlert.h @@ -11,7 +11,7 @@ #import "SUWindowController.h" -@protocol SUAutomaticUpdateAlertDelegateProtocol; +@protocol SUAutomaticUpdateAlertDelegate; typedef enum { @@ -23,14 +23,14 @@ typedef enum @class SUAppcastItem, SUHost; @interface SUAutomaticUpdateAlert : SUWindowController -- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle delegate:(id)delegate; +- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle delegate:(id)delegate; - (IBAction)installNow:sender; - (IBAction)installLater:sender; - (IBAction)doNotInstall:sender; @end -@protocol SUAutomaticUpdateAlertDelegateProtocol +@protocol SUAutomaticUpdateAlertDelegate - (void)automaticUpdateAlert:(SUAutomaticUpdateAlert *)aua finishedWithChoice:(SUAutomaticInstallationChoice)choice; @end diff --git a/SUAutomaticUpdateAlert.m b/SUAutomaticUpdateAlert.m index c1a3916f..00be78d6 100644 --- a/SUAutomaticUpdateAlert.m +++ b/SUAutomaticUpdateAlert.m @@ -12,7 +12,7 @@ @interface SUAutomaticUpdateAlert () @property (strong) SUAppcastItem *updateItem; -@property (weak) id delegate; +@property (weak) id delegate; @property (strong) SUHost *host; @end @@ -21,7 +21,7 @@ @synthesize host; @synthesize updateItem; -- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost delegate:(id)del +- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost delegate:(id)del { self = [super initWithHost:aHost windowNibName:@"SUAutomaticUpdateAlert"]; if (self) diff --git a/SUAutomaticUpdateDriver.h b/SUAutomaticUpdateDriver.h index bcc1276b..390be48d 100644 --- a/SUAutomaticUpdateDriver.h +++ b/SUAutomaticUpdateDriver.h @@ -13,7 +13,7 @@ #import "SUBasicUpdateDriver.h" #import "SUAutomaticUpdateAlert.h" -@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver +@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver { @private BOOL postponingInstallation, showErrors; diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index fb11eed1..54886a1c 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -279,20 +279,18 @@ - (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI { -#if !ENDANGER_USERS_WITH_INSECURE_UPDATES if (![self validateUpdateDownloadedToPath:downloadPath extractedToPath:tempDir DSASignature:[updateItem DSASignature] publicDSAKey:[host publicDSAKey]]) { [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUSignatureError userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedFailureReasonErrorKey: @"The update is improperly signed."}]]; return; } -#endif - + if (![updater mayUpdateAndRestart]) { [self abortUpdate]; return; } - + // Give the host app an opportunity to postpone the install and relaunch. static BOOL postponedOnce = NO; if (!postponedOnce && [[updater delegate] respondsToSelector:@selector(updater:shouldPostponeRelaunchForUpdate:untilInvoking:)]) diff --git a/SUConstants.h b/SUConstants.h index c6126a8b..854ce0cd 100644 --- a/SUConstants.h +++ b/SUConstants.h @@ -14,9 +14,6 @@ // Preprocessor flags: // ----------------------------------------------------------------------------- -// Turn off DSA signature check (practically invites man-in-the-middle attacks): -#define ENDANGER_USERS_WITH_INSECURE_UPDATES 0 - // Sparkle usually doesn't allow downgrades as they're usually accidental, but // if your app has a downgrade function or URL handler, turn this on: #define PERMIT_AUTOMATED_DOWNGRADES 0 diff --git a/SUInstaller.h b/SUInstaller.h index ebca441c..0277d792 100644 --- a/SUInstaller.h +++ b/SUInstaller.h @@ -12,15 +12,17 @@ #import #import "SUVersionComparisonProtocol.h" +@protocol SUInstallerDelegate; + @class SUHost; @interface SUInstaller : NSObject + (NSString *) appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host; -+ (void) installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; -+ (void) finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate; ++ (void) installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:(id)delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; ++ (void) finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:(id)delegate; + (NSString*) updateFolder; @end -@interface NSObject (SUInstallerDelegateInformalProtocol) +@protocol SUInstallerDelegate - (void)installerFinishedForHost:(SUHost *)host; - (void)installerForHost:(SUHost *)host failedWithError:(NSError *)error; @end diff --git a/SUInstaller.m b/SUInstaller.m index 4629130c..f8df2673 100644 --- a/SUInstaller.m +++ b/SUInstaller.m @@ -116,7 +116,7 @@ static NSString* sUpdateFolder = nil; return isPackage ? nil : path; } -+ (void)installFromUpdateFolder:(NSString *)inUpdateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator ++ (void)installFromUpdateFolder:(NSString *)inUpdateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:(id)delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator { BOOL isPackage = NO; NSString *newAppDownloadPath = [self installSourcePathInUpdateFolder:inUpdateFolder forHost:host isPackage:&isPackage]; @@ -157,7 +157,7 @@ static NSString* sUpdateFolder = nil; #define SUNotifyDictErrorKey @"SUNotifyDictError" #define SUNotifyDictDelegateKey @"SUNotifyDictDelegate" -+ (void)finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate ++ (void)finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:(id)delegate { if (result) { diff --git a/SUPlainInstaller.h b/SUPlainInstaller.h index 939d260d..414bbc5e 100644 --- a/SUPlainInstaller.h +++ b/SUPlainInstaller.h @@ -20,7 +20,7 @@ @class SUHost; @interface SUPlainInstaller : SUInstaller -+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; ++ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id)delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; @end #endif diff --git a/SUPlainInstaller.m b/SUPlainInstaller.m index 33223fe5..a8ef1141 100644 --- a/SUPlainInstaller.m +++ b/SUPlainInstaller.m @@ -58,7 +58,7 @@ static NSString * const SUInstallerInstallationPathKey = @"SUInstallerInstallati } } -+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator ++ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id)delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator { // Prevent malicious downgrades: #if !PERMIT_AUTOMATED_DOWNGRADES diff --git a/SUUpdatePermissionPrompt.h b/SUUpdatePermissionPrompt.h index d3882e85..d29f8876 100644 --- a/SUUpdatePermissionPrompt.h +++ b/SUUpdatePermissionPrompt.h @@ -16,24 +16,24 @@ typedef enum { SUDoNotAutomaticallyCheck } SUPermissionPromptResult; -@protocol SUUpdatePermissionPromptDelegateProtocol; +@protocol SUUpdatePermissionPromptDelegate; @class SUHost; @interface SUUpdatePermissionPrompt : SUWindowController { SUHost *host; NSArray *systemProfileInformationArray; - id delegate; + id delegate; IBOutlet NSTextField *descriptionTextField; IBOutlet NSView *moreInfoView; IBOutlet NSButton *moreInfoButton; IBOutlet NSTableView *profileTableView; } -+ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d; ++ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d; - (IBAction)toggleMoreInfo:(id)sender; - (IBAction)finishPrompt:(id)sender; @end -@protocol SUUpdatePermissionPromptDelegateProtocol +@protocol SUUpdatePermissionPromptDelegate - (void)updatePermissionPromptFinishedWithResult:(SUPermissionPromptResult)result; @end diff --git a/SUUpdatePermissionPrompt.m b/SUUpdatePermissionPrompt.m index d9a85c84..8311f263 100644 --- a/SUUpdatePermissionPrompt.m +++ b/SUUpdatePermissionPrompt.m @@ -22,7 +22,7 @@ return [[host objectForInfoDictionaryKey:SUEnableSystemProfilingKey] boolValue]; } -- (instancetype)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d +- (instancetype)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d { self = [super initWithHost:aHost windowNibName:@"SUUpdatePermissionPrompt"]; if (self) diff --git a/SUUpdater.h b/SUUpdater.h index f5e6048d..1a9b5c63 100644 --- a/SUUpdater.h +++ b/SUUpdater.h @@ -14,6 +14,8 @@ @class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast; +@protocol SUUpdaterDelegate; + @interface SUUpdater : NSObject { @private @@ -21,7 +23,7 @@ SUHost *host; } -@property (weak) IBOutlet id delegate; +@property (weak) IBOutlet id delegate; + (SUUpdater *)sharedUpdater; + (SUUpdater *)updaterForBundle:(NSBundle *)bundle; @@ -84,7 +86,8 @@ extern NSString *const SUUpdaterAppcastNotificationKey; // SUUpdater Delegate: // ----------------------------------------------------------------------------- -@interface NSObject (SUUpdaterDelegateInformalProtocol) +@protocol SUUpdaterDelegate +@optional // Use this to keep Sparkle from popping up e.g. while your setup assistant is showing: - (BOOL)updaterMayCheckForUpdates:(SUUpdater *)bundle; diff --git a/SUUpdater.m b/SUUpdater.m index ee9d80e3..b5f64a20 100644 --- a/SUUpdater.m +++ b/SUUpdater.m @@ -27,7 +27,7 @@ NSString *const SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotific NSString *const SUUpdaterAppcastItemNotificationKey = @"SUUpdaterAppcastItemNotificationKey"; NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotificationKey"; -@interface SUUpdater () +@interface SUUpdater () @property (strong) NSTimer *checkTimer; - (instancetype)initForBundle:(NSBundle *)bundle; - (void)startUpdateCycle; @@ -92,8 +92,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault } sharedUpdaters[[NSValue valueWithNonretainedObject:bundle]] = self; host = [[SUHost alloc] initWithBundle:bundle]; - -#if !ENDANGER_USERS_WITH_INSECURE_UPDATES + // Saving-the-developer-from-a-stupid-mistake-check: BOOL hasPublicDSAKey = [host publicDSAKey] != nil; BOOL isMainBundle = [bundle isEqualTo:[NSBundle mainBundle]]; @@ -107,7 +106,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information.", @"OK", nil, nil); [self notifyDidShowModalAlert]; } -#endif + // This runs the permission prompt if needed, but never before the app has finished launching because the runloop won't run before that [self performSelector:@selector(startUpdateCycle) withObject:nil afterDelay:0]; } diff --git a/Sample Appcast.xml b/Sample Appcast.xml index 04d25559..1073c1ca 100755 --- a/Sample Appcast.xml +++ b/Sample Appcast.xml @@ -12,6 +12,7 @@ Wed, 09 Jan 2006 19:20:11 +0000 + 10.7 @@ -21,6 +22,7 @@ Wed, 01 Jan 2006 12:20:11 +0000 + 10.7 @@ -31,6 +33,7 @@ Wed, 25 Dec 2005 12:20:11 +0000 + 10.7 - \ No newline at end of file + diff --git a/finish_installation.m b/finish_installation.m index 5a5b8e0b..0a2d48dc 100644 --- a/finish_installation.m +++ b/finish_installation.m @@ -12,7 +12,7 @@ #define LONG_INSTALLATION_TIME 5 // If the Installation takes longer than this time the Application Icon is shown in the Dock so that the user has some feedback. #define CHECK_FOR_PARENT_TO_QUIT_TIME .5 // Time this app uses to recheck if the parent has already died. -@interface TerminationListener : NSObject +@interface TerminationListener : NSObject { const char *hostpath; const char *executablepath;