Compare commits

..
Author SHA1 Message Date
Andy Matuschak 9eb4368d6f Updated sample appcast to be appropriate for DSA signatures being required. 2008-09-13 22:54:16 -05:00
Andy Matuschak 783fd4b475 Merging in new Dutch localization changes. 2008-09-13 22:53:53 -05:00
Andy Matuschak 00efab8ad2 generate_key.rb => generate_keys.rb 2008-09-11 22:08:32 -05:00
Andy Matuschak d73b3745bf Fixes 268756
When determining LSUIElement status, Sparkle now asks the process manager instead of checking Info.plist; this'll support apps that change their LSUIElement status at runtime.
2008-09-11 11:33:18 -05:00
Andy Matuschak ccd44c0cb2 Fixes 268723
Now forcing a DSA signature check if the client provides a public key with the app.
2008-09-10 17:48:57 -05:00
Andy Matuschak 9a0acca849 More security tidbits!
This patch prevents malicious downgrades, which are still possible with DSA validation: suppose there's some (signed) version with a security hole. A malicious attacker could serve an appcast with that version's URL and DSA signature, but a higher version number, forcing the user to "upgrade" to the version with the security hole.

While I was at it, I fixed a bug that should have completely stopped .pkg installation from working since 1.5b1. Why didn't I hear anything about that? Does anyone actually use .pkgs? It still needs testing to be sure it works.
2008-09-10 11:47:58 -05:00
Andy Matuschak 95f9658a7e Fixes 244692
Fixing a GC leak that would occur on non-64-bit machines.
2008-09-10 10:47:22 -05:00
Andy Matuschak 0fa24ce313 Restored the old default font size for release notes, now that we're doing webview preferences a different way. 2008-09-10 10:45:58 -05:00
Andy Matuschak 28ad466aa8 Fixes 268471
-- Removed obsolete configuration settings regarding 10.3 support.
-- Stopped a configuration file from getting added to the Resources folder.
2008-09-10 10:39:31 -05:00
Andy Matuschak 7e9fc0f20b Changed the security policy once more:
The user is defined as "safe" and exempt from DSA signatures if he downloaded both the appcast and the update over SSL.
2008-09-10 10:37:47 -05:00
Andy Matuschak 7f5689835b Fixed a small security hole: release notes specified with a file:// URL would be able to read files on your file system through Javascript (basically a cross-site scripting attack). file:// URLs are therefore no longer supported for release notes. 2008-09-09 23:39:00 -05:00
Andy Matuschak 478e0a53d0 Fixed a potential security vulnerability in which the download is transmitted over SSL but is from a malicious server. Now the download has to be transmitted over SSL *and* the download's host has to be the same as the appcast's. 2008-09-09 23:34:20 -05:00
Andy Matuschak 588cad8d91 Killed off SUExpectsDSASignatureKey. 2008-09-06 19:07:54 -05:00
Andy Matuschak 1d3ab8d6bb Alright, guys. No more Mr. Nice Sparklepants. Sparkle now requires either DSA-signed updates or SSL transport. If you want to put your users at risk, you're going to have to comment out some code and recompile.
I included some scripts to help you along, though. IANASG (I Am Not a Security Guy), though, so if you know your shit, feel free to do it on your own as before.
2008-09-06 18:59:50 -05:00
Andy Matuschak e086aa1660 Munged localizations so that unicode characters like em-dashes and ellipses are now in the values of the localization strings, not the keys; putting them in the latter made Sparkle unbuildable on Tiger. Thanks to Stuart Morgan for the patch. 2008-09-06 12:34:03 -05:00
Stuart Morgan 188a15a948 Fix a key in sv.lproj 2008-09-04 20:22:45 -07:00
Andy Matuschak 874660f52e Added a warning log message for bundles which don't have a CFBundleIdentifier key. 2008-09-04 10:51:46 -05:00
Stuart Morgan 29bd46d68d Don't use unicode in NSString literals 2008-09-04 07:57:17 -07:00
Andy Matuschak cb80e0ef51 No longer polluting the standard WebView preferences. Thanks to Christiaan Hofman for the patch. 2008-09-04 09:53:53 -05:00
Andy Matuschak ccef53a3d3 Fixes 259704
Fixed a memory leak in the update permission prompt.
2008-09-04 09:44:35 -05:00
Andy Matuschak d201803259 More fixes for 258060
Fixes a bug which could cause a crash when the update item is chosen by the delegate from the appcast. Thanks, Christiaan Hofman.
2008-09-03 22:34:25 -05:00
Andy Matuschak 74b206dc77 Fixes 259455
Fixes release notes stored raw in the <description> key. Thanks to Peter Speck for the patch.
2008-08-19 21:57:23 -07:00
Andy Matuschak 42cda2d2e0 Fixes 259062
Added a SUUpdater key for lastUpdateCheckDate. Thanks to Peter Speck for the patch!
2008-08-19 21:44:39 -07:00
Andy Matuschak c386b704b5 Partial fix for 245277: basic descriptions for some Sparkle classes. Thanks to Christiaan Hofman for the patch. 2008-08-19 21:24:26 -07:00
Andy Matuschak 84be00b29f Fixes 258991
The selector for the updaterWillRelaunchApplication delegate call had a typo in it, so it wasn't getting called. Oof.
2008-08-19 21:13:15 -07:00
Andy Matuschak d064b589ae Fixed the total failure of the SUProbingUpdateDriver to notify its delegate when an update is found. Sorry about that, guys! Wow. 2008-08-19 21:09:31 -07:00
Peter Speck 90edd12e43 No update-release notes displayed for when using <description> instead of <sparkle:releaseNotesLink> 2008-08-19 17:50:28 +02:00
Peter Speck c71bf3ccbe Provide getter for SULastCheckTimeKey 2008-08-18 15:11:05 +02:00
Andy Matuschak 724b4de07e Renamed SUAppcastItem's "description" key to "itemDescription" so as not to conflict with the standard Cocoa description method. 2008-08-17 15:23:50 -07:00
Andy Matuschak 444b0a928d Fixed a stupid mistake that prevented my fix for parameterized URLs from actually functioning. 2008-08-17 14:15:57 -07:00
Andy Matuschak ec8fcbc02f If an update's display version is the same as the host's display version, the internal version number will be presented in parentheticals. 2008-08-17 13:51:55 -07:00
Andy Matuschak 68e2cd67d1 Fixes 258492
Sparkle can now handle appending parameters to URLs which already have parameters (like http://foo.org/baz?bat=4)
2008-08-17 13:42:47 -07:00
Andy Matuschak c21e1aba35 Fixes 258529 and 257967
Added backwards compatibility support for Sparkle 1.1's behavior of disabling automatic updates when the check interval was 0.

Sparkle will now properly reset the update cycle when setAutomaticallyChecksForUpdates or setUpdateCheckInterval is called for non-.app bundles.
2008-08-17 13:25:49 -07:00
Andy Matuschak ec7f38d157 Fixes 258547
SUUpdater now implements two new keys: "automaticallyDownloadsUpdates" and "sendsSystemProfile".

Here's the current state of the setting keys, as documented by Christiaan Hofman:

* UserDefaults through SUUpdater accessors with default value in Info.plist:

SUFeedURL
SUScheduledCheckInterval
SUEnableAutomaticChecks
SUSendProfileInfo
SUAutomaticallyUpdate

* Info.plist only (app settings):

SUShowReleaseNotes
SUPublicDSAKey
SUPublicDSAKeyFile
SUExpectsDSASignature
SUEnableSystemProfiling

* UserDefaults only (private persistent state):

SUHasLaunchedBefore
SUSkippedVersion
SULastCheckTime
SULastProfileSubmitDate

This revision also corrects a compilation error from r285.
2008-08-17 13:06:33 -07:00
Andy Matuschak 5b38483981 Fixes 245723
Refactoring some code through new simplified "objectForKey" and "boolForKey" methods on SUHost which abstract the behavior of a user defaults preference defaulting to an info.plist setting. Thanks to Christiaan Hofman for the patch.
2008-08-17 12:35:41 -07:00
Andy Matuschak 46312a2d15 Fixes 258060
Fixed a couple memory leaks. Thanks to Christiaan Hofman for the patch.
2008-08-17 12:15:01 -07:00
Andy Matuschak 8a240f7c46 Fixes 258708
Returning the update alert's web view's default text size to 11. I swear I've done this like twice already!
2008-08-17 11:24:36 -07:00
Maarten Van Coile 17ca061cda Update Dutch to 1.5b5 2008-08-15 19:30:29 +02:00
67 changed files with 310 additions and 142 deletions

No files matched your search

+1 -2
View File
@@ -4,7 +4,7 @@ PREBINDING = NO
ZERO_LINK = NO
CURRENT_PROJECT_VERSION = 1.5
SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk
MACOSX_DEPLOYMENT_TARGET[arch=ppc] = 10.3
MACOSX_DEPLOYMENT_TARGET[arch=ppc] = 10.4
MACOSX_DEPLOYMENT_TARGET[arch=ppc64] = 10.5
MACOSX_DEPLOYMENT_TARGET[arch=i386] = 10.4
MACOSX_DEPLOYMENT_TARGET[arch=x86_64] = 10.5
@@ -14,7 +14,6 @@ GCC_DEBUGGING_SYMBOLS = full
GCC_PRECOMPILE_PREFIX_HEADER = YES
GCC_PREFIX_HEADER = $(SDKROOT)/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h
GCC_FAST_OBJC_DISPATCH = YES
GCC_FAST_OBJC_DISPATCH[arch=ppc] = NO // requires 10.4
// Enable warnings
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
+2
View File
@@ -19,6 +19,8 @@
- (void)dealloc
{
[items release];
[userAgentString release];
[incrementalData release];
[super dealloc];
}
+2 -2
View File
@@ -12,7 +12,7 @@
@interface SUAppcastItem : NSObject {
NSString *title;
NSDate *date;
NSString *description;
NSString *itemDescription;
NSURL *releaseNotesURL;
@@ -33,7 +33,7 @@
- (NSString *)versionString;
- (NSString *)displayVersionString;
- (NSDate *)date;
- (NSString *)description;
- (NSString *)itemDescription;
- (NSURL *)releaseNotesURL;
- (NSURL *)fileURL;
- (NSString *)DSASignature;
+9 -9
View File
@@ -33,13 +33,13 @@
}
- (NSString *)description { return [[description retain] autorelease]; }
- (NSString *)itemDescription { return [[itemDescription retain] autorelease]; }
- (void)setDescription:(NSString *)aDescription
- (void)setItemDescription:(NSString *)anItemDescription
{
if (description == aDescription) return;
[description release];
description = [aDescription copy];
if (itemDescription == anItemDescription) return;
[itemDescription release];
itemDescription = [anItemDescription copy];
}
@@ -136,7 +136,7 @@
propertiesDictionary = [[NSMutableDictionary alloc] initWithDictionary:dict];
[self setTitle:[dict objectForKey:@"title"]];
[self setDate:[dict objectForKey:@"pubDate"]];
[self setDescription:[dict objectForKey:@"description"]];
[self setItemDescription:[dict objectForKey:@"description"]];
[self setFileURL:[NSURL URLWithString:[[enclosure objectForKey:@"url"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
[self setDSASignature:[enclosure objectForKey:@"sparkle:dsaSignature"]];
@@ -153,8 +153,8 @@
// Find the appropriate release notes URL.
if ([dict objectForKey:@"sparkle:releaseNotesLink"])
[self setReleaseNotesURL:[NSURL URLWithString:[dict objectForKey:@"sparkle:releaseNotesLink"]]];
else if ([[self description] hasPrefix:@"http://"]) // if the description starts with http://, use that.
[self setReleaseNotesURL:[NSURL URLWithString:[self description]]];
else if ([[self itemDescription] hasPrefix:@"http://"]) // if the description starts with http://, use that.
[self setReleaseNotesURL:[NSURL URLWithString:[self itemDescription]]];
else
[self setReleaseNotesURL:nil];
}
@@ -166,7 +166,7 @@
{
[self setTitle:nil];
[self setDate:nil];
[self setDescription:nil];
[self setItemDescription:nil];
[self setReleaseNotesURL:nil];
[self setDSASignature:nil];
[self setFileURL:nil];
+1
View File
@@ -33,6 +33,7 @@
[super dealloc];
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; }
- (IBAction)installNow:sender
{
+1 -1
View File
@@ -22,7 +22,7 @@
NSString *relaunchPath;
}
- (void)checkForUpdatesAtURL:(NSURL *)appcastURL host:(SUHost *)host;
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host;
- (void)appcastDidFinishLoading:(SUAppcast *)ac;
- (void)appcast:(SUAppcast *)ac failedToLoadWithError:(NSError *)error;
+26 -24
View File
@@ -16,9 +16,9 @@
@implementation SUBasicUpdateDriver
- (void)checkForUpdatesAtURL:(NSURL *)appcastURL host:(SUHost *)aHost
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)aHost
{
[super checkForUpdatesAtURL:appcastURL host:aHost];
[super checkForUpdatesAtURL:URL host:aHost];
if ([aHost isRunningOnReadOnlyVolume])
{
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again.", nil), [aHost name]] forKey:NSLocalizedDescriptionKey]]];
@@ -34,8 +34,7 @@
NSData * cleanedAgent = [userAgent dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
userAgent = [NSString stringWithCString:[cleanedAgent bytes] length:[cleanedAgent length]];
[appcast setUserAgentString:userAgent];
[appcast fetchAppcastFromURL:appcastURL];
[host setObject:[NSDate date] forUserDefaultsKey:SULastCheckTimeKey];
[appcast fetchAppcastFromURL:URL];
}
- (id <SUVersionComparison>)_versionComparator
@@ -80,22 +79,24 @@
{
if ([[updater delegate] respondsToSelector:@selector(updater:didFinishLoadingAppcast:)])
[[updater delegate] updater:updater didFinishLoadingAppcast:ac];
SUAppcastItem *item = nil;
// Now we have to find the best valid update in the appcast.
if ([[updater delegate] respondsToSelector:@selector(bestValidUpdateInAppcast:forUpdater:)]) // Does the delegate want to handle it?
{
updateItem = [[updater delegate] bestValidUpdateInAppcast:ac forUpdater:updater];
item = [[updater delegate] bestValidUpdateInAppcast:ac forUpdater:updater];
}
else // If not, we'll take care of it ourselves.
{
// Find the first update we can actually use.
NSEnumerator *updateEnumerator = [[ac items] objectEnumerator];
do {
updateItem = [updateEnumerator nextObject];
} while (updateItem && ![self hostSupportsItem:updateItem]);
[updateItem retain];
item = [updateEnumerator nextObject];
} while (item && ![self hostSupportsItem:item]);
}
updateItem = [item retain];
CFRelease(ac); // Remember that we're explicitly managing the memory of the appcast.
if (updateItem == nil) { [self didNotFindUpdate]; return; }
@@ -157,6 +158,17 @@
- (void)downloadDidFinish:(NSURLDownload *)d
{
// New in Sparkle 1.5: we're now checking signatures on all non-secure downloads, where "secure" is defined as both the appcast and the download being transmitted over SSL.
NSURL *downloadURL = [[d request] URL];
if (![[downloadURL scheme] isEqualToString:@"https"] || ![[appcastURL scheme] isEqualToString:@"https"] || [host publicDSAKey])
{
if (![SUDSAVerifier validatePath:downloadPath withEncodedDSASignature:[updateItem DSASignature] withPublicDSAKey:[host publicDSAKey]])
{
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUSignatureError userInfo:[NSDictionary dictionaryWithObject:@"The update is improperly signed." forKey:NSLocalizedDescriptionKey]]];
return;
}
}
[self extractUpdate];
}
@@ -176,17 +188,7 @@
}
- (void)extractUpdate
{
// DSA verification, if activated by the developer
if ([[host objectForInfoDictionaryKey:SUExpectsDSASignatureKey] boolValue])
{
if (![SUDSAVerifier validatePath:downloadPath withEncodedDSASignature:[updateItem DSASignature] withPublicDSAKey:[host publicDSAKey]])
{
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUSignatureError userInfo:[NSDictionary dictionaryWithObject:@"The update is improperly signed." forKey:NSLocalizedDescriptionKey]]];
return;
}
}
{
SUUnarchiver *unarchiver = [SUUnarchiver unarchiverForPath:downloadPath];
if (!unarchiver)
{
@@ -225,7 +227,7 @@
if ([[NSFileManager defaultManager] copyPath:relaunchPathToCopy toPath:targetPath handler:nil])
relaunchPath = [targetPath retain];
[SUInstaller installFromUpdateFolder:[downloadPath stringByDeletingLastPathComponent] overHost:host delegate:self synchronously:[self shouldInstallSynchronously]];
[SUInstaller installFromUpdateFolder:[downloadPath stringByDeletingLastPathComponent] overHost:host delegate:self synchronously:[self shouldInstallSynchronously] versionComparator:[self _versionComparator]];
}
- (void)installerFinishedForHost:(SUHost *)aHost
@@ -251,7 +253,7 @@
[self cleanUp]; // Clean up the download and extracted files.
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterWillRestartNotification object:self];
if ([[updater delegate] respondsToSelector:@selector(updaterWillRelaunchApplication)])
if ([[updater delegate] respondsToSelector:@selector(updaterWillRelaunchApplication:)])
[[updater delegate] updaterWillRelaunchApplication:updater];
if(!relaunchPath || ![[NSFileManager defaultManager] fileExistsAtPath:relaunchPath])
@@ -301,7 +303,7 @@
- (void)dealloc
{
[host release];
[updateItem release];
[download release];
[downloadPath release];
[relaunchPath release];
+1 -1
View File
@@ -20,7 +20,6 @@ extern NSString *SUShowReleaseNotesKey;
extern NSString *SUSkippedVersionKey;
extern NSString *SUScheduledCheckIntervalKey;
extern NSString *SULastCheckTimeKey;
extern NSString *SUExpectsDSASignatureKey;
extern NSString *SUPublicDSAKeyKey;
extern NSString *SUPublicDSAKeyFileKey;
extern NSString *SUAutomaticallyUpdateKey;
@@ -52,6 +51,7 @@ extern OSStatus SUMissingUpdateError;
extern OSStatus SUMissingInstallerToolError;
extern OSStatus SURelaunchError;
extern OSStatus SUInstallationError;
extern OSStatus SUDowngradeError;
// NSInteger is a type that was added to Leopard.
// Here is some glue to ensure that NSInteger will work with pre-10.5 SDKs:
+1
View File
@@ -46,3 +46,4 @@ OSStatus SUMissingUpdateError = 4002;
OSStatus SUMissingInstallerToolError = 4003;
OSStatus SURelaunchError = 4004;
OSStatus SUInstallationError = 4005;
OSStatus SUDowngradeError = 4006;
+2
View File
@@ -32,4 +32,6 @@
- (void)setObject:(id)value forUserDefaultsKey:(NSString *)defaultName;
- (BOOL)boolForUserDefaultsKey:(NSString *)defaultName;
- (void)setBool:(BOOL)value forUserDefaultsKey:(NSString *)defaultName;
- (id)objectForKey:(NSString *)key;
- (BOOL)boolForKey:(NSString *)key;
@end
+20 -2
View File
@@ -18,6 +18,8 @@
if ((self = [super init]))
{
bundle = [aBundle retain];
if (![bundle bundleIdentifier])
NSLog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.");
}
return self;
}
@@ -28,6 +30,8 @@
[super dealloc];
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [self bundlePath]]; }
- (NSBundle *)bundle
{
return bundle;
@@ -89,7 +93,13 @@
- (BOOL)isBackgroundApplication
{
return [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"LSUIElement"] doubleValue];
ProcessSerialNumber PSN;
GetCurrentProcess(&PSN);
NSDictionary * processInfo = (NSDictionary *)ProcessInformationCopyDictionary(&PSN, kProcessDictionaryIncludeAllInformationMask);
BOOL isElement = [[processInfo objectForKey:@"LSUIElement"] boolValue];
if (processInfo)
CFRelease(processInfo);
return isElement;
}
- (NSString *)publicDSAKey
@@ -128,7 +138,7 @@
return [[NSUserDefaults standardUserDefaults] objectForKey:defaultName];
CFPropertyListRef obj = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)[bundle bundleIdentifier]);
#if MAC_OS_X_VERSION_MIN_REQUIRED > 1050
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1050
return [NSMakeCollectable(obj) autorelease];
#else
return [(id)obj autorelease];
@@ -180,6 +190,14 @@
}
}
- (id)objectForKey:(NSString *)key {
return [self objectForUserDefaultsKey:key] ?: [self objectForInfoDictionaryKey:key];
}
- (BOOL)boolForKey:(NSString *)key {
return [self objectForUserDefaultsKey:key] ? [self boolForUserDefaultsKey:key] : [self boolForInfoDictionaryKey:key];
}
+ (NSString *)systemVersionString
{
// This returns a version string of the form X.Y.Z
+2 -1
View File
@@ -10,10 +10,11 @@
#define SUINSTALLER_H
#import <Cocoa/Cocoa.h>
#import "SUVersionComparisonProtocol.h"
@class SUHost;
@interface SUInstaller : NSObject { }
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously;
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
+ (void)_finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate;
@end
+2 -6
View File
@@ -10,10 +10,6 @@
#import "SUPlainInstaller.h"
#import "SUPackageInstaller.h"
NSString *SUInstallerPathKey = @"SUInstallerPath";
NSString *SUInstallerHostKey = @"SUInstallerHost";
NSString *SUInstallerDelegateKey = @"SUInstallerDelegate";
@implementation SUInstaller
+ (BOOL)_isAliasFolderAtPath:(NSString *)path
@@ -36,7 +32,7 @@ NSString *SUInstallerDelegateKey = @"SUInstallerDelegate";
}
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator
{
// Search subdirectories for the application
NSString *currentFile, *newAppDownloadPath = nil, *bundleFileName = [[host bundlePath] lastPathComponent], *alternateBundleFileName = [[host name] stringByAppendingPathExtension:[[host bundlePath] pathExtension]];
@@ -76,7 +72,7 @@ NSString *SUInstallerDelegateKey = @"SUInstallerDelegate";
}
else
{
[(isPackage ? [SUPackageInstaller class] : [SUPlainInstaller class]) performInstallationWithPath:newAppDownloadPath host:host delegate:delegate synchronously:synchronously];
[(isPackage ? [SUPackageInstaller class] : [SUPlainInstaller class]) performInstallationWithPath:newAppDownloadPath host:host delegate:delegate synchronously:synchronously versionComparator:comparator];
}
}
-1
View File
@@ -13,7 +13,6 @@
#import "SUPlainInstaller.h"
@interface SUPackageInstaller : SUPlainInstaller { }
+ (void)installPath:(NSString *)path overHost:(SUHost *)bundle delegate:delegate;
@end
#endif
+2 -2
View File
@@ -11,7 +11,7 @@
@implementation SUPackageInstaller
+ (void)installPath:(NSString *)path overHost:(SUHost *)bundle delegate:delegate
+ (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
{
NSError *error = nil;
BOOL result = YES;
@@ -26,7 +26,7 @@
NSTask *installer = [NSTask launchedTaskWithLaunchPath:installerPath arguments:[NSArray arrayWithObjects:path, nil]];
[installer waitUntilExit];
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
[self _finishInstallationWithResult:result host:bundle error:error delegate:delegate];
[self _finishInstallationWithResult:result host:host error:error delegate:delegate];
}
@end
+2 -1
View File
@@ -11,9 +11,10 @@
#import "Sparkle.h"
#import "SUInstaller.h"
#import "SUVersionComparisonProtocol.h"
@interface SUPlainInstaller : SUInstaller { }
+ (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously;
+ (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
@end
#endif
+20 -8
View File
@@ -9,16 +9,28 @@
#import "SUPlainInstaller.h"
#import "SUPlainInstallerInternals.h"
extern NSString *SUInstallerPathKey;
extern NSString *SUInstallerHostKey;
extern NSString *SUInstallerDelegateKey;
NSString *SUInstallerPathKey = @"SUInstallerPath";
NSString *SUInstallerHostKey = @"SUInstallerHost";
NSString *SUInstallerDelegateKey = @"SUInstallerDelegate";
NSString *SUInstallerVersionComparatorKey = @"SUInstallerVersionComparator";
@implementation SUPlainInstaller
+ (void)installPath:(NSString *)path overHost:(SUHost *)bundle delegate:delegate
+ (void)installPath:(NSString *)path overHost:(SUHost *)bundle delegate:delegate versionComparator:(id <SUVersionComparison>)comparator
{
NSError *error;
BOOL result = [self copyPathWithAuthentication:path overPath:[bundle bundlePath] error:&error];
BOOL result = YES;
// Prevent malicious downgrades:
if ([comparator compareVersion:[bundle version] toVersion:[[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:@"CFBundleVersion"]] == NSOrderedDescending)
{
NSString * errorMessage = [NSString stringWithFormat:@"Sparkle Updater: Possible attack in progress! Attempting to \"upgrade\" from %@ to %@. Aborting update.", [bundle version], [[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:@"CFBundleVersion"]];
result = NO;
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
}
if (result)
result = [self copyPathWithAuthentication:path overPath:[bundle bundlePath] error:&error];
[self _finishInstallationWithResult:result host:bundle error:error delegate:delegate];
}
@@ -26,14 +38,14 @@ extern NSString *SUInstallerDelegateKey;
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self installPath:[info objectForKey:SUInstallerPathKey] overHost:[info objectForKey:SUInstallerHostKey] delegate:[info objectForKey:SUInstallerDelegateKey]];
[self installPath:[info objectForKey:SUInstallerPathKey] overHost:[info objectForKey:SUInstallerHostKey] delegate:[info objectForKey:SUInstallerDelegateKey] versionComparator:[info objectForKey:SUInstallerVersionComparatorKey]];
[pool drain];
}
+ (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously;
+ (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator
{
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:path, SUInstallerPathKey, host, SUInstallerHostKey, delegate, SUInstallerDelegateKey, nil];
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:path, SUInstallerPathKey, host, SUInstallerHostKey, delegate, SUInstallerDelegateKey, comparator, SUInstallerVersionComparatorKey, nil];
if (synchronously)
[self _performInstallationWithInfo:info];
else
+6 -2
View File
@@ -7,19 +7,23 @@
//
#import "SUProbingUpdateDriver.h"
#import "SUUpdater.h"
@implementation SUProbingUpdateDriver
// Stop as soon as we have an answer! The superclasses will already have taken care of notifying the delegate.
// Stop as soon as we have an answer! Since the superclass implementations are not called, we are responsible for notifying the delegate.
- (void)didFindValidUpdate
{
if ([[updater delegate] respondsToSelector:@selector(updater:didFindValidUpdate:)])
[[updater delegate] updater:updater didFindValidUpdate:updateItem];
[self abortUpdate];
}
- (void)didNotFindUpdate
{
if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)])
[[updater delegate] updaterDidNotFindUpdate:updater];
[self abortUpdate];
}
+2
View File
@@ -31,6 +31,8 @@
[super dealloc];
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; }
- (void)awakeFromNib
{
[[self window] center];
+3 -3
View File
@@ -61,7 +61,7 @@
{
case SUInstallUpdateChoice:
statusController = [[SUStatusController alloc] initWithHost:host];
[statusController beginActionWithTitle:SULocalizedString(@"Downloading update\u2026", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
[statusController beginActionWithTitle:SULocalizedString(@"Downloading update...", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
[statusController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelDownload:) isDefault:NO];
[statusController showWindow:self];
[self downloadUpdate];
@@ -113,7 +113,7 @@
- (void)extractUpdate
{
// Now we have to extract the downloaded archive.
[statusController beginActionWithTitle:SULocalizedString(@"Extracting update\u2026", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
[statusController beginActionWithTitle:SULocalizedString(@"Extracting update...", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
[statusController setButtonEnabled:NO];
[super extractUpdate];
}
@@ -139,7 +139,7 @@
- (void)installUpdate
{
[statusController beginActionWithTitle:SULocalizedString(@"Installing update\u2026", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
[statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
[statusController setButtonEnabled:NO];
[super installUpdate];
}
+2
View File
@@ -27,6 +27,8 @@ extern NSMutableArray *__unarchiverImplementations;
return nil;
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], archivePath]; }
- (void)setDelegate:del
{
delegate = del;
+26 -8
View File
@@ -25,6 +25,8 @@
return self;
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; }
- (void)dealloc
{
[updateItem release];
@@ -59,8 +61,11 @@
- (void)displayReleaseNotes
{
[[WebPreferences standardPreferences] setStandardFontFamily:[[NSFont systemFontOfSize:8] familyName]];
[releaseNotesView setPreferences:[WebPreferences standardPreferences]];
// Set the default font, but avoid polluting the standard preferences.
WebPreferences *preferences = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:[WebPreferences standardPreferences]]];
[preferences setStandardFontFamily:[[NSFont systemFontOfSize:8] familyName]];
[preferences setDefaultFontSize:(int)[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
[releaseNotesView setPreferences:preferences];
[releaseNotesView setFrameLoadDelegate:self];
[releaseNotesView setPolicyDelegate:self];
@@ -75,11 +80,18 @@
// If there's a release notes URL, load it; otherwise, just stick the contents of the description into the web view.
if ([updateItem releaseNotesURL])
{
[[releaseNotesView mainFrame] loadRequest:[NSURLRequest requestWithURL:[updateItem releaseNotesURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]];
if ([[updateItem releaseNotesURL] isFileURL])
{
[[releaseNotesView mainFrame] loadHTMLString:@"Release notes with file:// URLs are not supported for security reasons&mdash;Javascript would be able to read files on your file system." baseURL:nil];
}
else
{
[[releaseNotesView mainFrame] loadRequest:[NSURLRequest requestWithURL:[updateItem releaseNotesURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]];
}
}
else
{
[[releaseNotesView mainFrame] loadHTMLString:[updateItem description] baseURL:nil];
[[releaseNotesView mainFrame] loadHTMLString:[updateItem itemDescription] baseURL:nil];
}
}
@@ -94,11 +106,9 @@
- (BOOL)allowsAutomaticUpdates
{
if (![[host objectForInfoDictionaryKey:SUExpectsDSASignatureKey] boolValue])
return NO; // Automatic updating requires DSA-signed updates
if (![host objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey])
return YES; // defaults to YES
return [[host objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] boolValue];
return [host boolForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey];
}
- (void)awakeFromNib
@@ -150,7 +160,15 @@
- (NSString *)descriptionText
{
return [NSString stringWithFormat:SULocalizedString(@"%@ %@ is now available\u2014you have %@. Would you like to download it now?", nil), [host name], [updateItem displayVersionString], [host displayVersion]];
NSString *updateItemVersion = [updateItem displayVersionString];
NSString *hostVersion = [host displayVersion];
// Display more info if the version strings are the same; useful for betas.
if ([updateItemVersion isEqualToString:hostVersion])
{
updateItemVersion = [updateItemVersion stringByAppendingFormat:@" (%@)", [updateItem versionString]];
hostVersion = [hostVersion stringByAppendingFormat:@" (%@)", [host version]];
}
return [NSString stringWithFormat:SULocalizedString(@"%@ %@ is now available--you have %@. Would you like to download it now?", nil), [host name], updateItemVersion, hostVersion];
}
- (void)webView:(WebView *)sender didFinishLoadForFrame:frame
+2 -1
View File
@@ -18,12 +18,13 @@ extern NSString *SUUpdateDriverFinishedNotification;
{
SUHost *host;
SUUpdater *updater;
NSURL *appcastURL;
BOOL finished;
}
- initWithUpdater:(SUUpdater *)updater;
- (void)checkForUpdatesAtURL:(NSURL *)appcastURL host:(SUHost *)host;
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host;
- (void)abortUpdate;
- (BOOL)finished;
+12 -1
View File
@@ -18,8 +18,11 @@ NSString *SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
return self;
}
- (void)checkForUpdatesAtURL:(NSURL *)appcastURL host:(SUHost *)h
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; }
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)h
{
appcastURL = [URL copy];
host = [h retain];
}
@@ -30,4 +33,12 @@ NSString *SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
}
- (BOOL)finished { return finished; }
- (void)dealloc
{
[host release];
[appcastURL release];
[super dealloc];
}
@end
+3 -1
View File
@@ -23,7 +23,7 @@
if (self)
{
host = [aHost retain];
delegate = [d retain];
delegate = d;
isShowingMoreInfo = NO;
shouldSendProfile = [self shouldAskAboutProfile];
systemProfileInformationArray = [profile retain];
@@ -43,6 +43,8 @@
[NSApp runModalForWindow:[prompt window]];
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; }
- (void)awakeFromNib
{
if (![self shouldAskAboutProfile])
+10 -1
View File
@@ -36,6 +36,12 @@
- (void)setFeedURL:(NSURL *)feedURL;
- (NSURL *)feedURL;
- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile;
- (BOOL)sendsSystemProfile;
- (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates;
- (BOOL)automaticallyDownloadsUpdates;
// This IBAction is meant for a main menu item. Hook up any menu item to this action,
// and Sparkle will check for updates and report back its findings verbosely.
- (IBAction)checkForUpdates:sender;
@@ -45,11 +51,14 @@
// update is found, it will be downloaded and prepped for installation.
- (void)checkForUpdatesInBackground;
// Date of last update check. Returns null if no check has been performed.
- (NSDate*)lastUpdateCheckDate;
// This begins a "probing" check for updates which will not actually offer to update to that version. The delegate methods, though,
// (up to updater:didFindValidUpdate: and updaterDidNotFindUpdate:), are called, so you can use that information in your UI.
- (void)checkForUpdateInformation;
// Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks.
// Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks. This call does not change the date of the next check, but only the internal NSTimer.
- (void)resetUpdateCycle;
- (BOOL)updateInProgress;
+64 -44
View File
@@ -19,8 +19,7 @@
@interface SUUpdater (Private)
- initForBundle:(NSBundle *)bundle;
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver;
- (BOOL)_sendingSystemProfile;
- (BOOL)automaticallyUpdates;
- (BOOL)automaticallyDownloadsUpdates;
- (void)scheduleNextUpdateCheck;
- (void)registerAsObserver;
- (void)unregisterAsObserver;
@@ -79,6 +78,8 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
return [self initForBundle:[NSBundle mainBundle]];
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; }
- (void)applicationDidFinishLaunching:(NSNotification *)note
{
BOOL shouldPrompt = NO;
@@ -94,8 +95,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
shouldPrompt = [delegate updaterShouldPromptForPermissionToCheckForUpdates:self];
}
// Has he been asked already? And don't ask if the host has a default value set in its Info.plist.
else if ([host objectForUserDefaultsKey:SUEnableAutomaticChecksKey] == nil &&
[host objectForInfoDictionaryKey:SUEnableAutomaticChecksKey] == nil)
else if ([host objectForKey:SUEnableAutomaticChecksKey] == nil)
{
if ([host objectForUserDefaultsKey:SUEnableAutomaticChecksKeyOld])
[self setAutomaticallyChecksForUpdates:[host boolForUserDefaultsKey:SUEnableAutomaticChecksKeyOld]];
@@ -111,7 +111,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
{
NSArray *profileInfo = [host systemProfile];
if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)])
profileInfo = [profileInfo arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:[self _sendingSystemProfile]]];
profileInfo = [profileInfo arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:[self sendsSystemProfile]]];
[SUUpdatePermissionPrompt promptWithHost:host systemProfile:profileInfo delegate:self];
// We start the update checks and register as observer for changes after the prompt finishes
}
@@ -138,6 +138,11 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
}
}
- (NSDate *)lastUpdateCheckDate
{
return [host objectForUserDefaultsKey:SULastCheckTimeKey];
}
- (void)scheduleNextUpdateCheck
{
if (checkTimer)
@@ -148,14 +153,16 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
if (![self automaticallyChecksForUpdates]) return;
// How long has it been since last we checked for an update?
NSDate *lastCheckDate = [host objectForUserDefaultsKey:SULastCheckTimeKey];
NSDate *lastCheckDate = [self lastUpdateCheckDate];
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
NSTimeInterval intervalSinceCheck = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
// Now we want to figure out how long until we check again.
NSTimeInterval delayUntilCheck;
if (intervalSinceCheck < [self updateCheckInterval])
delayUntilCheck = ([self updateCheckInterval] - intervalSinceCheck); // It hasn't been long enough.
NSTimeInterval delayUntilCheck, updateCheckInterval = [self updateCheckInterval];
if (updateCheckInterval < SU_MIN_CHECK_INTERVAL)
updateCheckInterval = SU_MIN_CHECK_INTERVAL;
if (intervalSinceCheck < updateCheckInterval)
delayUntilCheck = (updateCheckInterval - intervalSinceCheck); // It hasn't been long enough.
else
delayUntilCheck = 0; // We're overdue! Run one now.
checkTimer = [NSTimer scheduledTimerWithTimeInterval:delayUntilCheck target:self selector:@selector(checkForUpdatesInBackground) userInfo:nil repeats:NO];
@@ -163,7 +170,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
- (void)checkForUpdatesInBackground
{
[self checkForUpdatesWithDriver:[[[([self automaticallyUpdates] ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class]) alloc] initWithUpdater:self] autorelease]];
[self checkForUpdatesWithDriver:[[[([self automaticallyDownloadsUpdates] ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class]) alloc] initWithUpdater:self] autorelease]];
}
- (IBAction)checkForUpdates:sender
@@ -181,6 +188,10 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
if ([self updateInProgress]) { return; }
if (checkTimer) { [checkTimer invalidate]; checkTimer = nil; }
[self willChangeValueForKey:@"lastUpdateCheckDate"];
[host setObject:[NSDate date] forUserDefaultsKey:SULastCheckTimeKey];
[self didChangeValueForKey:@"lastUpdateCheckDate"];
driver = [d retain];
[driver checkForUpdatesAtURL:[self parameterizedFeedURL] host:host];
}
@@ -231,35 +242,36 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyCheckForUpdates
{
[host setBool:automaticallyCheckForUpdates forUserDefaultsKey:SUEnableAutomaticChecksKey];
// Hack to support backwards compatibility with older Sparkle versions, which supported
// disabling updates by setting the check interval to 0.
if (automaticallyCheckForUpdates && [self updateCheckInterval] == 0)
[self setUpdateCheckInterval:SU_DEFAULT_CHECK_INTERVAL];
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
// Provide a small delay in case multiple preferences are being updated simultaneously.
[self performSelector:@selector(resetUpdateCycle) withObject:nil afterDelay:1];
}
- (BOOL)automaticallyChecksForUpdates
{
// Breaking this down for readability:
// If the user says he wants automatic update checks, let's do it.
if ([host boolForUserDefaultsKey:SUEnableAutomaticChecksKey] == YES)
return YES;
// If the user hasn't said anything, but the developer says we should do it, let's do it.
if ([host objectForUserDefaultsKey:SUEnableAutomaticChecksKey] == nil && [host boolForInfoDictionaryKey:SUEnableAutomaticChecksKey] == YES)
return YES;
return NO; // Otherwise, don't bother.
// Don't automatically update when the check interval is 0, to be compatible with 1.1 settings.
if ([self updateCheckInterval] == 0)
return NO;
return [host boolForKey:SUEnableAutomaticChecksKey];
}
- (BOOL)automaticallyUpdates
- (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyUpdates
{
[host setBool:automaticallyUpdates forUserDefaultsKey:SUAutomaticallyUpdateKey];
}
- (BOOL)automaticallyDownloadsUpdates
{
// If the SUAllowsAutomaticUpdatesKey exists and is set to NO, return NO.
if ([host objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] && [host boolForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] == NO)
return NO;
// If we're not using DSA signatures, we aren't going to trust any updates automatically.
if ([host boolForInfoDictionaryKey:SUExpectsDSASignatureKey] != YES)
return NO;
// If there's no setting, or it's set to no, we're not automatically updating.
if ([host boolForUserDefaultsKey:SUAutomaticallyUpdateKey] != YES)
return NO;
return YES; // Otherwise, we're good to go.
// Otherwise, automatically downloading updates is allowed. Does the user want it?
return [host boolForUserDefaultsKey:SUAutomaticallyUpdateKey];
}
- (void)setFeedURL:(NSURL *)feedURL
@@ -270,18 +282,21 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
- (NSURL *)feedURL
{
// A value in the user defaults overrides one in the Info.plist (so preferences panels can be created wherein users choose between beta / release feeds).
NSString *appcastString = [host objectForUserDefaultsKey:SUFeedURLKey];
if (!appcastString)
appcastString = [host objectForInfoDictionaryKey:SUFeedURLKey];
NSString *appcastString = [host objectForKey:SUFeedURLKey];
if (!appcastString) // Can't find an appcast string!
[NSException raise:@"SUNoFeedURL" format:@"You must specify the URL of the appcast as the SUFeedURLKey in either the Info.plist or the user defaults!"];
NSCharacterSet* quoteSet = [NSCharacterSet characterSetWithCharactersInString: @"\"\'"]; // Some feed publishers add quotes; strip 'em.
return [NSURL URLWithString:[appcastString stringByTrimmingCharactersInSet:quoteSet]];
}
- (BOOL)_sendingSystemProfile
- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile
{
return ([host boolForUserDefaultsKey:SUSendProfileInfoKey] == YES);
[host setBool:sendsSystemProfile forUserDefaultsKey:SUSendProfileInfoKey];
}
- (BOOL)sendsSystemProfile
{
return [host boolForUserDefaultsKey:SUSendProfileInfoKey];
}
- (NSURL *)parameterizedFeedURL
@@ -289,7 +304,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
NSURL *baseFeedURL = [self feedURL];
// Determine all the parameters we're attaching to the base feed URL.
BOOL sendingSystemProfile = [self _sendingSystemProfile];
BOOL sendingSystemProfile = [self sendsSystemProfile];
// Let's only send the system profiling information once per week at most, so we normalize daily-checkers vs. biweekly-checkers and the such.
NSDate *lastSubmitDate = [host objectForUserDefaultsKey:SULastProfileSubmitDateKey];
@@ -315,7 +330,10 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
while ((currentProfileInfo = [profileInfoEnumerator nextObject]))
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", [currentProfileInfo objectForKey:@"key"], [currentProfileInfo objectForKey:@"value"]]];
NSString *appcastStringWithProfile = [NSString stringWithFormat:@"%@?%@", [baseFeedURL absoluteString], [parameterStrings componentsJoinedByString:@"&"]];
NSString *separatorCharacter = @"?";
if ([baseFeedURL query])
separatorCharacter = @"&"; // In case the URL is already http://foo.org/baz.xml?bat=4
NSString *appcastStringWithProfile = [NSString stringWithFormat:@"%@%@%@", [baseFeedURL absoluteString], separatorCharacter, [parameterStrings componentsJoinedByString:@"&"]];
// Clean it up so it's a valid URL
return [NSURL URLWithString:[appcastStringWithProfile stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
@@ -324,20 +342,22 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
- (void)setUpdateCheckInterval:(NSTimeInterval)updateCheckInterval
{
[host setObject:[NSNumber numberWithDouble:updateCheckInterval] forUserDefaultsKey:SUScheduledCheckIntervalKey];
if (updateCheckInterval == 0) // For compatibility with 1.1's settings.
[self setAutomaticallyChecksForUpdates:NO];
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
// Provide a small delay in case multiple preferences are being updated simultaneously.
[self performSelector:@selector(resetUpdateCycle) withObject:nil afterDelay:1];
}
- (NSTimeInterval)updateCheckInterval
{
NSTimeInterval checkInterval = 0;
// Find the stored check interval. User defaults override Info.plist.
if ([host objectForUserDefaultsKey:SUScheduledCheckIntervalKey])
checkInterval = [[host objectForUserDefaultsKey:SUScheduledCheckIntervalKey] doubleValue];
else if ([host objectForInfoDictionaryKey:SUScheduledCheckIntervalKey])
checkInterval = [[host objectForInfoDictionaryKey:SUScheduledCheckIntervalKey] doubleValue];
if (checkInterval < SU_MIN_CHECK_INTERVAL) // This can also mean one that isn't set.
checkInterval = SU_DEFAULT_CHECK_INTERVAL;
return checkInterval;
NSNumber *intervalValue = [host objectForKey:SUScheduledCheckIntervalKey];
if (intervalValue)
return [intervalValue doubleValue];
else
return SU_DEFAULT_CHECK_INTERVAL;
}
- (void)dealloc
+3 -3
View File
@@ -13,14 +13,14 @@
@implementation SUUserInitiatedUpdateDriver
- (void)checkForUpdatesAtURL:(NSURL *)appcastURL host:(SUHost *)aHost
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)aHost
{
checkingController = [[SUStatusController alloc] initWithHost:aHost];
[[checkingController window] center]; // Force the checking controller to load its window.
[checkingController beginActionWithTitle:SULocalizedString(@"Checking for updates\u2026", nil) maxProgressValue:0 statusText:nil];
[checkingController beginActionWithTitle:SULocalizedString(@"Checking for updates...", nil) maxProgressValue:0 statusText:nil];
[checkingController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelCheckForUpdates:) isDefault:NO];
[checkingController showWindow:self];
[super checkForUpdatesAtURL:appcastURL host:aHost];
[super checkForUpdatesAtURL:URL host:aHost];
// For background applications, obtain focus.
// Useful if the update check is requested from another app like System Preferences.
+4 -4
View File
@@ -11,7 +11,7 @@
http://you.com/app/2.0.html
</sparkle:releaseNotesLink>
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
<enclosure url="http://you.com/app/Your Great App 2.0.zip" sparkle:version="2.0" length="1623481" type="application/octet-stream"/>
<enclosure url="http://you.com/app/Your Great App 2.0.zip" sparkle:version="2.0" length="1623481" type="application/octet-stream" sparkle:dsaSignature="BAFJW4B6B1K1JyW30nbkBwainOzrN6EQuAh" />
</item>
<item>
@@ -20,17 +20,17 @@
http://you.com/app/1.5.html
</sparkle:releaseNotesLink>
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
<enclosure url="http://you.com/app/Your Great App 1.5.zip" sparkle:version="1.5" length="1472893" type="application/octet-stream"/>
<enclosure url="http://you.com/app/Your Great App 1.5.zip" sparkle:version="1.5" length="1472893" type="application/octet-stream" sparkle:dsaSignature="234818feCa1JyW30nbkBwainOzrN6EQuAh" />
</item>
<!-- Now here's an example of a version with a weird internal version number (like an SVN revision) but a human-readable external one. This version also has a DSA signature. Note that normally, if any item has a DSA signature, all of them need to. -->
<!-- Now here's an example of a version with a weird internal version number (like an SVN revision) but a human-readable external one. -->
<item>
<title>Version 1.4 (5 bugs fixed; 2 new features)</title>
<sparkle:releaseNotesLink>
http://you.com/app/1.4.html
</sparkle:releaseNotesLink>
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
<enclosure url="http://you.com/app/Your Great App 1.4.zip" sparkle:version="241" sparkle:shortVersionString="1.4" sparkle:dsaSignature="MC0CFBfeCa1JyW30nbkBwainOzrN6EQuAh=" length="1472349" type="application/octet-stream"/>
<enclosure url="http://you.com/app/Your Great App 1.4.zip" sparkle:version="241" sparkle:shortVersionString="1.4" sparkle:dsaSignature="MC0CFBfeCa1JyW30nbkBwainOzrN6EQuAh=" length="1472349" type="application/octet-stream" />
</item>
</channel>
</rss>
+7 -2
View File
@@ -16,7 +16,6 @@
6102FE4B0E07803800F85D09 /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6102FE490E07803800F85D09 /* SUDiskImageUnarchiver.m */; };
6102FE5B0E08C7EC00F85D09 /* SUUnarchiver_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6102FE590E08C7EC00F85D09 /* SUUnarchiver_Private.h */; settings = {ATTRIBUTES = (); }; };
6102FE5C0E08C7EC00F85D09 /* SUUnarchiver_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 6102FE5A0E08C7EC00F85D09 /* SUUnarchiver_Private.m */; };
61072EB30DF2640C008FE88B /* ConfigFrameworkReleaseGCSupport.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 61072EB20DF2640C008FE88B /* ConfigFrameworkReleaseGCSupport.xcconfig */; };
610D5A1A0A1661B8004AAD9C /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; };
610D5A750A1670A4004AAD9C /* SUStatus.nib in Resources */ = {isa = PBXBuildFile; fileRef = 610D5A740A1670A4004AAD9C /* SUStatus.nib */; };
610EC1E00CF3A5FE00AE239E /* NTSynchronousTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 610EC1BF0CF3914D00AE239E /* NTSynchronousTask.m */; };
@@ -40,6 +39,7 @@
615AE3D00D64DC40001CA7BD /* SUModelTranslation.plist in Resources */ = {isa = PBXBuildFile; fileRef = 615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */; };
6160E7E10D3B4A8800E9CD71 /* NTSynchronousTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 610EC1C00CF3914D00AE239E /* NTSynchronousTask.h */; settings = {ATTRIBUTES = (); }; };
61699BCC0DDB92BD005878A4 /* SUVersionComparisonTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 61227A140DB548B800AB99EA /* SUVersionComparisonTest.h */; settings = {ATTRIBUTES = (); }; };
618E9CFD0E7328F1004646D8 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 618E9CFC0E7328F1004646D8 /* dsa_pub.pem */; };
618FA5010DAE88B40026945C /* SUInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 618FA4FF0DAE88B40026945C /* SUInstaller.h */; settings = {ATTRIBUTES = (); }; };
618FA5020DAE88B40026945C /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5000DAE88B40026945C /* SUInstaller.m */; };
618FA5050DAE8AB80026945C /* SUPlainInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 618FA5030DAE8AB80026945C /* SUPlainInstaller.h */; settings = {ATTRIBUTES = (); }; };
@@ -184,6 +184,7 @@
618915710E35937600B5E981 /* sv */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sv; path = sv.lproj/SUUpdateAlert.nib; sourceTree = "<group>"; };
618915720E35937600B5E981 /* sv */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sv; path = sv.lproj/SUAutomaticUpdateAlert.nib; sourceTree = "<group>"; };
618915730E35937600B5E981 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Sparkle.strings; sourceTree = "<group>"; };
618E9CFC0E7328F1004646D8 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = dsa_pub.pem; path = "Test Application/dsa_pub.pem"; sourceTree = "<group>"; };
618FA4FF0DAE88B40026945C /* SUInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUInstaller.h; sourceTree = "<group>"; };
618FA5000DAE88B40026945C /* SUInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUInstaller.m; sourceTree = "<group>"; };
618FA5030DAE8AB80026945C /* SUPlainInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPlainInstaller.h; sourceTree = "<group>"; };
@@ -479,6 +480,7 @@
61B5F92C09C4CFD800B25A18 /* MainMenu.nib */,
61B5F92409C4CFC900B25A18 /* main.m */,
61B5F90409C4CEE200B25A18 /* Test Application-Info.plist */,
618E9CFC0E7328F1004646D8 /* dsa_pub.pem */,
);
name = "Test Application Sources";
sourceTree = "<group>";
@@ -737,7 +739,7 @@
61B5F92E09C4CFD800B25A18 /* InfoPlist.strings in Resources */,
61B5F92F09C4CFD800B25A18 /* MainMenu.nib in Resources */,
61BBDF820A49220C00378739 /* Sparkle.icns in Resources */,
61072EB30DF2640C008FE88B /* ConfigFrameworkReleaseGCSupport.xcconfig in Resources */,
618E9CFD0E7328F1004646D8 /* dsa_pub.pem in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -988,12 +990,14 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
WARNING_CFLAGS = "-Wundeclared-selector";
};
name = Debug;
};
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
WARNING_CFLAGS = "-Wundeclared-selector";
};
name = Release;
};
@@ -1001,6 +1005,7 @@
isa = XCBuildConfiguration;
buildSettings = {
GCC_VERSION = "";
WARNING_CFLAGS = "-Wundeclared-selector";
};
name = "Release (GC dual-mode; 10.5-only)";
};
@@ -28,5 +28,7 @@
<string>http://www.andymatuschak.org/files/sparkletestcast.xml</string>
<key>SUEnableSystemProfiling</key>
<true/>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
</dict>
</plist>
+20
View File
@@ -0,0 +1,20 @@
-----BEGIN DSA PRIVATE KEY-----
MIIDPgIBAAKCAQEA9lmy8fAXdW9b6fBXQ6Us5B2dLZV+cR685tFlhPSKJDpicP1F
pNRkGESZwPFJbnxUyVeHWVS9yLeMcKqllhcjd+i1oEFKX7LPXk5+zO745OwVWHIe
0DLOIxhJ0mJHm7mH1YVGZYOVVYkPt+0Y/hDbQVK5DycSGAhgDiCZ+Obl+aDSD2xJ
RZGnVOpu83dYJ/CoUYCHqWtpN4gW5Bbgm8Uz0/2qiyPjFvJEeI1yE04AZA3sOg1y
1S/UrCbqeC3gBIs0xsskwWOW3zCWjvDWgfPrj65At0mVfq/yyGgXJlN71X5sONxR
swZSbRn5T2i/BJPZUStWks5Nxq+7T3WmnaPbTwIVAJp+BByoy95V3x8wZg0q66eR
ufiJAoIBABbxkX6C9Lt8zeDvvIpk8X4kmHBVIwVJcuICJTVzOAIBZsvFhPnYmUYe
v93oPgjtAdYqPrYZlNrExQG1e7B1bhmgaT8hbXL6whxhqRHKlsJsboVHNQs3qAbx
sOLvJnwgb3FD4xX4ZZSSRXSIGk62FxcaoLG+mSlirGM/SY4yZDpURSJUX6MHdUZa
qHWWGL3b31pz3d9h6SPYv6H4T3ZReVtn+dXYh/41SWkQqEyhAsHGBvqpDwuYJCCI
Mwuvwz0U/KcwiydDaFo900MC9S33zEpk/YUxgA9YsiY5+UvWSy5M/yvkKBkvkb+I
G6DAMWtApWu0fDcLV6jA9JKXmcAwAIECggEBAPC0OJEnLkOwU1Ehop7o2XJbWDKN
giFt44IO3l9gx1fu05HrieDbwAJTkRK7qNEA0yk1iMT2hMHHbwLRNddEsOJuUd7o
iyKwqwkmCQ2Q1zYPBR09wag9NEr8xLSTQJCw9CpxTRSH+9hc1DeuwkwAnTEn7JiW
WbcxVCRtmtaUlN7+dTozxqGJHpYF6WsqHMeuG7Ixnyf6he8Fz8mjxnrc7/l73gFL
Q+IZvUSjzh2zqtqaejtcmlNcT+fGmEFKxpcLB3JP3uu8PN8MbS/R6j191f1ovuM9
U4MO3RuT4xJF0OlwyWAnOEik1S1p+tNQciQ/Ipv8Ff3DDBct9YZPPlNGi+ICFHHD
tP5yX7hMTJIykGaMuM44KJMM
-----END DSA PRIVATE KEY-----
+20
View File
@@ -0,0 +1,20 @@
-----BEGIN PUBLIC KEY-----
MIIDOzCCAi0GByqGSM44BAEwggIgAoIBAQD2WbLx8Bd1b1vp8FdDpSzkHZ0tlX5x
Hrzm0WWE9IokOmJw/UWk1GQYRJnA8UlufFTJV4dZVL3It4xwqqWWFyN36LWgQUpf
ss9eTn7M7vjk7BVYch7QMs4jGEnSYkebuYfVhUZlg5VViQ+37Rj+ENtBUrkPJxIY
CGAOIJn45uX5oNIPbElFkadU6m7zd1gn8KhRgIepa2k3iBbkFuCbxTPT/aqLI+MW
8kR4jXITTgBkDew6DXLVL9SsJup4LeAEizTGyyTBY5bfMJaO8NaB8+uPrkC3SZV+
r/LIaBcmU3vVfmw43FGzBlJtGflPaL8Ek9lRK1aSzk3Gr7tPdaado9tPAhUAmn4E
HKjL3lXfHzBmDSrrp5G5+IkCggEAFvGRfoL0u3zN4O+8imTxfiSYcFUjBUly4gIl
NXM4AgFmy8WE+diZRh6/3eg+CO0B1io+thmU2sTFAbV7sHVuGaBpPyFtcvrCHGGp
EcqWwmxuhUc1CzeoBvGw4u8mfCBvcUPjFfhllJJFdIgaTrYXFxqgsb6ZKWKsYz9J
jjJkOlRFIlRfowd1RlqodZYYvdvfWnPd32HpI9i/ofhPdlF5W2f51diH/jVJaRCo
TKECwcYG+qkPC5gkIIgzC6/DPRT8pzCLJ0NoWj3TQwL1LffMSmT9hTGAD1iyJjn5
S9ZLLkz/K+QoGS+Rv4gboMAxa0Cla7R8NwtXqMD0kpeZwDAAgQOCAQYAAoIBAQDw
tDiRJy5DsFNRIaKe6NlyW1gyjYIhbeOCDt5fYMdX7tOR64ng28ACU5ESu6jRANMp
NYjE9oTBx28C0TXXRLDiblHe6IsisKsJJgkNkNc2DwUdPcGoPTRK/MS0k0CQsPQq
cU0Uh/vYXNQ3rsJMAJ0xJ+yYllm3MVQkbZrWlJTe/nU6M8ahiR6WBelrKhzHrhuy
MZ8n+oXvBc/Jo8Z63O/5e94BS0PiGb1Eo84ds6ramno7XJpTXE/nxphBSsaXCwdy
T97rvDzfDG0v0eo9fdX9aL7jPVODDt0bk+MSRdDpcMlgJzhIpNUtafrTUHIkPyKb
/BX9wwwXLfWGTz5TRovi
-----END PUBLIC KEY-----
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3 -3
View File
@@ -3,17 +3,17 @@
<plist version="1.0">
<dict>
<key>IBFramework Version</key>
<string>667</string>
<string>670</string>
<key>IBLastKnownRelativeProjectPath</key>
<string>../Sparkle.xcodeproj</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>89</integer>
<integer>18</integer>
</array>
<key>IBSystem Version</key>
<string>9D34</string>
<string>10A96</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/ruby
["dsaparam.pem", "dsa_priv.pem", "dsa_pub.pem"].each do |file|
if File.exist? file
puts "There's already a #{file} here! Move it aside or be more careful!"
end
end
`openssl dsaparam 2048 < /dev/urandom > dsaparam.pem`
`openssl gendsa dsaparam.pem -out dsa_priv.pem`
`openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem`
`rm dsaparam.pem`
puts "\nGenerated private and public keys: dsa_priv.pem and dsa_pub.pem.\n
BACK UP YOUR PRIVATE KEY AND KEEP IT SAFE!\n
If you lose it, your users will be unable to upgrade!\n"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -4
View File
@@ -7,11 +7,9 @@
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>6</integer>
</array>
<array/>
<key>IBSystem Version</key>
<string>9D34</string>
<string>9E17</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
Binary file not shown.
+1 -1
View File
@@ -9,7 +9,7 @@
<key>IBOpenObjects</key>
<array/>
<key>IBSystem Version</key>
<string>9D34</string>
<string>9E17</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/ruby
if ARGV.length < 2
puts "Usage: ruby sign_update.rb update_archive private_key"
exit
end
puts `openssl dgst -sha1 -binary < "#{ARGV[0]}" | openssl dgst -dss1 -sign "#{ARGV[1]}" | openssl enc -base64`
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4 -4
View File
@@ -41,16 +41,16 @@
"Check for updates on startup?" = "啟動時檢查更新項目?";
/* No comment provided by engineer. */
"Downloading update…" = "正在下載更新項目⋯";
"Downloading update..." = "正在下載更新項目⋯";
/* No comment provided by engineer. */
"Extracting update…" = "正在解壓縮更新項目⋯";
"Extracting update..." = "正在解壓縮更新項目⋯";
/* No comment provided by engineer. */
"Install and Relaunch" = "安裝與重新啟動";
/* No comment provided by engineer. */
"Installing update…" = "安裝更新…";
"Installing update..." = "安裝更新…";
/* No comment provided by engineer. */
"No" = "否";
@@ -74,4 +74,4 @@
"Yes" = "是";
/* No comment provided by engineer. */
"You're up to date!" = "你已有最新版本!";
"You're up to date!" = "你已有最新版本!";