diff --git a/Sparkle.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Sparkle.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 00000000..18d98100
--- /dev/null
+++ b/Sparkle.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/Sparkle/SPUURLRequest.m b/Sparkle/SPUURLRequest.m
index b4866797..d707e42f 100644
--- a/Sparkle/SPUURLRequest.m
+++ b/Sparkle/SPUURLRequest.m
@@ -62,9 +62,9 @@ static NSString *SPUURLRequestNetworkServiceTypeKey = @"SPUURLRequestNetworkServ
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:self.url forKey:SPUURLRequestURLKey];
- [coder encodeInteger:self.cachePolicy forKey:SPUURLRequestCachePolicyKey];
+ [coder encodeInteger:(NSInteger)self.cachePolicy forKey:SPUURLRequestCachePolicyKey];
[coder encodeDouble:self.timeoutInterval forKey:SPUURLRequestTimeoutIntervalKey];
- [coder encodeInteger:self.networkServiceType forKey:SPUURLRequestNetworkServiceTypeKey];
+ [coder encodeInteger:(NSInteger)self.networkServiceType forKey:SPUURLRequestNetworkServiceTypeKey];
if (self.httpHeaderFields != nil) {
[coder encodeObject:self.httpHeaderFields forKey:SPUURLRequestHttpHeaderFieldsKey];
diff --git a/Sparkle/SUInstaller.m b/Sparkle/SUInstaller.m
index 23d8c6e8..67e90417 100644
--- a/Sparkle/SUInstaller.m
+++ b/Sparkle/SUInstaller.m
@@ -152,8 +152,14 @@
{
NSBundle *bundle = host.bundle;
assert(bundle != nil);
-
- NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey], [[bundle bundlePath] pathExtension]]];
+
+ NSString * baseBundleName = [host objectForInfoDictionaryKey:@"SUBundleName"];
+
+ if (baseBundleName == nil) {
+ baseBundleName = [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey];
+ }
+
+ NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", baseBundleName, [[bundle bundlePath] pathExtension]]];
// Roundtrip string through fileSystemRepresentation to ensure it uses filesystem's Unicode normalization
// rather than arbitrary Unicode form from Info.plist - #1017
diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m
index 6fa6e6b9..d2d0cbe1 100644
--- a/Sparkle/SUUIBasedUpdateDriver.m
+++ b/Sparkle/SUUIBasedUpdateDriver.m
@@ -126,7 +126,7 @@
alert.messageText = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
if (self.latestAppcastItemComparisonResult == NSOrderedDescending ) { // this means the user is a 'newer than latest' version. give a slight hint to the user instead of wrongly claiming this version is identical to the latest feed version.
- alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.\n(You are currently running version %@.)", nil), [self.host name], self.latestAppcastItem.versionString, [self.host displayVersion]];
+ alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.\n(You are currently running version %@.)", nil), [self.host name], self.latestAppcastItem.displayVersionString, [self.host displayVersion]];
}
else {
alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
@@ -165,6 +165,7 @@
{
self.updateAlert = nil;
[self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey];
+ id updater = self.updater;
switch (choice) {
case SUInstallUpdateChoice:
[self didDismissAlertPermanently:NO forItem:item];
@@ -178,6 +179,9 @@
break;
case SUSkipThisVersionChoice:
+ if ([[updater delegate] respondsToSelector:@selector(updater:userDidSkipThisVersion:)]) {
+ [[updater delegate] updater:self.updater userDidSkipThisVersion:self.updateItem];
+ }
[self didDismissAlertPermanently:YES forItem:item];
[self.host setObject:[self.updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey];
[self abortUpdate];
diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m
index e1c7b1f8..9ba5ec15 100644
--- a/Sparkle/SUUpdater.m
+++ b/Sparkle/SUUpdater.m
@@ -37,6 +37,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@interface SUUpdater ()
@property (strong) NSTimer *checkTimer;
+@property (assign) BOOL shouldRescheduleOnWake;
@property (strong) NSBundle *sparkleBundle;
- (instancetype)initForBundle:(NSBundle *)bundle;
@@ -59,6 +60,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@synthesize delegate;
@synthesize checkTimer;
+@synthesize shouldRescheduleOnWake;
@synthesize userAgentString = customUserAgentString;
@synthesize httpHeaders;
@synthesize driver;
@@ -113,6 +115,9 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
if (self) {
[self registerAsObserver];
}
+
+ [NSWorkspace.sharedWorkspace.notificationCenter addObserver:self selector:@selector(receiveSleepNote) name:NSWorkspaceWillSleepNotification object:NULL];
+ [NSWorkspace.sharedWorkspace.notificationCenter addObserver:self selector:@selector(receiveWakeNote) name:NSWorkspaceDidWakeNotification object:NULL];
id updater = [sharedUpdaters objectForKey:[NSValue valueWithNonretainedObject:bundle]];
if (updater)
@@ -294,6 +299,24 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
self.checkTimer = [NSTimer scheduledTimerWithTimeInterval:delayUntilCheck target:self selector:@selector(checkForUpdatesInBackground) userInfo:nil repeats:NO]; // Timer is non-repeating, may have invalidated itself, so we had to retain it.
}
+- (void)receiveSleepNote
+{
+ if (self.checkTimer)
+ {
+ [self.checkTimer invalidate];
+ self.checkTimer = nil;
+ self.shouldRescheduleOnWake = YES;
+ }
+ else
+ self.shouldRescheduleOnWake = NO;
+}
+
+- (void)receiveWakeNote
+{
+ if (self.shouldRescheduleOnWake) // the reason for rescheduling the update-check timer is that NSTimer does behave as if the time the Mac spends asleep did not exist at all, which can significantly prolong the time between update checks
+ [self scheduleNextUpdateCheck];
+}
+
- (void)checkForUpdatesInBackground
{
BOOL automatic = [self automaticallyDownloadsUpdates];
diff --git a/Sparkle/SUUpdaterDelegate.h b/Sparkle/SUUpdaterDelegate.h
index b86debe3..ea8197b5 100644
--- a/Sparkle/SUUpdaterDelegate.h
+++ b/Sparkle/SUUpdaterDelegate.h
@@ -141,6 +141,13 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
*/
- (void)updaterDidNotFindUpdate:(SUUpdater *)updater;
+/*!
+ Called when the user clicks the Skip This Version button.
+
+ \param updater The SUUpdater instance.
+ */
+- (void)updater:(SUUpdater *)updater userDidSkipThisVersion:(SUAppcastItem *)item;
+
/*!
Called immediately before downloading the specified update.
diff --git a/Sparkle/fr.lproj/Sparkle.strings b/Sparkle/fr.lproj/Sparkle.strings
index a1068855..49ee03f3 100644
--- a/Sparkle/fr.lproj/Sparkle.strings
+++ b/Sparkle/fr.lproj/Sparkle.strings
@@ -8,7 +8,7 @@
"%@ %@ is currently the newest version available." = "%1$@ %2$@ est la version la plus récente disponible.";
-"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ est la version la plus récente disponible.\n(You are currently running version %3$@.)";
+"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ est la version la plus récente disponible.\n(vous utilisez actuellement la version %3$@)";
/* Description text for SUUpdateAlert when the update is downloadable. */
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ est disponible ; vous utilisez la version %3$@. Voulez-vous le télécharger maintenant ?";
diff --git a/Sparkle/ja.lproj/Sparkle.strings b/Sparkle/ja.lproj/Sparkle.strings
index 3bb4d030..f65de104 100644
--- a/Sparkle/ja.lproj/Sparkle.strings
+++ b/Sparkle/ja.lproj/Sparkle.strings
@@ -8,7 +8,7 @@
"%@ %@ is currently the newest version available." = "%1$@ %2$@は現在入手できる最新バージョンです。";
-"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@は現在入手できる最新バージョンです。\n(You are currently running version %3$@.)";
+"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@は現在入手できる最新バージョンです。\n(現在使用中のバージョンは%3$@です。)";
/* Description text for SUUpdateAlert when the update is downloadable. */
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@が入手できます(使用中のバージョンは%3$@です)。今すぐダウンロードしますか?";
diff --git a/generate_appcast/ArchiveItem.swift b/generate_appcast/ArchiveItem.swift
index 32b276f9..c2f63f77 100644
--- a/generate_appcast/ArchiveItem.swift
+++ b/generate_appcast/ArchiveItem.swift
@@ -93,7 +93,11 @@ class ArchiveItem: CustomStringConvertible {
var feedURL:URL? = nil;
if let feedURLStr = infoPlist["SUFeedURL"] as? String {
- feedURL = URL(string: feedURLStr);
+ feedURL = URL(string: feedURLStr)
+ if feedURL?.pathExtension == "php" {
+ feedURL = feedURL!.deletingLastPathComponent()
+ feedURL = feedURL!.appendingPathComponent("appcast.xml")
+ }
}
try self.init(version: version,
diff --git a/generate_appcast/main.swift b/generate_appcast/main.swift
index ac7a1309..2fc7a3ce 100644
--- a/generate_appcast/main.swift
+++ b/generate_appcast/main.swift
@@ -25,22 +25,39 @@ func printUsage() {
)
}
-func loadPrivateKeys(_ privateDSAKey: SecKey?) -> PrivateKeys {
+func loadPrivateKeys(_ privateDSAKey: SecKey?, _ privateEdString: String?) -> PrivateKeys {
var privateEdKey: Data?;
var publicEdKey: Data?;
var item: CFTypeRef?;
- let res = SecItemCopyMatching([
- kSecClass as String: kSecClassGenericPassword,
- kSecAttrService as String: "https://sparkle-project.org",
- kSecAttrAccount as String: "ed25519",
- kSecAttrProtocol as String: kSecAttrProtocolSSH,
- kSecReturnData as String: kCFBooleanTrue,
- ] as CFDictionary, &item);
- if res == errSecSuccess, let encoded = item as? Data, let keys = Data(base64Encoded: encoded) {
+ var keys: Data?
+
+ // private + public key is provided as argument
+ if let privateEdString = privateEdString {
+ if privateEdString.count == 128, let data = Data(base64Encoded: privateEdString) {
+ keys = data
+ } else {
+ print("Warning: Private key not found in the argument. Please provide a valid key.");
+ }
+ }
+ // get keys from kechain instead
+ else {
+ let res = SecItemCopyMatching([
+ kSecClass as String: kSecClassGenericPassword,
+ kSecAttrService as String: "https://sparkle-project.org",
+ kSecAttrAccount as String: "ed25519",
+ kSecAttrProtocol as String: kSecAttrProtocolSSH,
+ kSecReturnData as String: kCFBooleanTrue,
+ ] as CFDictionary, &item);
+ if res == errSecSuccess, let encoded = item as? Data, let data = Data(base64Encoded: encoded) {
+ keys = data
+ } else {
+ print("Warning: Private key not found in the Keychain (\(res)). Please run the generate_keys tool");
+ }
+ }
+
+ if let keys = keys {
privateEdKey = keys[0..<64];
publicEdKey = keys[64...];
- } else {
- print("Warning: Private key not found in the Keychain (\(res)). Please run the generate_keys tool");
}
return PrivateKeys(privateDSAKey: privateDSAKey, privateEdKey: privateEdKey, publicEdKey: publicEdKey);
}
@@ -53,6 +70,7 @@ func main() {
}
var privateDSAKey: SecKey? = nil;
+ var privateEdString: String? = nil;
// this was typical usage for DSA keys
if args.count == 3 || (args.count == 4 && args[1] == "-f") {
@@ -98,13 +116,17 @@ func main() {
exit(1)
}
}
+ // private + public EdDSA keys are provided via command line argument
+ else if args.count == 4 && args[1] == "-s" {
+ privateEdString = args[2]
+ }
else if args.count != 2 {
printUsage()
exit(1)
}
let archivesSourceDir = URL(fileURLWithPath: args.last!, isDirectory: true)
- let keys = loadPrivateKeys(privateDSAKey)
+ let keys = loadPrivateKeys(privateDSAKey, privateEdString)
do {
let allUpdates = try makeAppcast(archivesSourceDir: archivesSourceDir, keys: keys, verbose:verbose);