Compare commits

..
16 Commits
Author SHA1 Message Date
Kornel fc48e5e4df 1.18.0 2017-05-18 21:54:56 +01:00
Kornel bfada07a2c Log more errors 2017-05-18 21:48:51 +01:00
Kornel 4f965660f3 Merge pull request #1072 from sparkle-project/autoerror
Unify handling of aborted updates
2017-05-03 16:51:06 +01:00
Kornel a2764158d6 Unify handling of aborted updates 2017-05-03 12:34:28 +01:00
Kornel 60727bffa5 Log key read failure 2017-04-24 18:05:13 +01:00
Kornel 715163fe0d Formatting 2017-04-24 18:05:13 +01:00
Kornel 629c42d62d Merge pull request #1050 from sparkle-project/genapp
generate_appcast improvements
2017-04-14 21:28:07 +02:00
Kornel 3e45211bbe Escape + as well 2017-03-31 15:15:22 +01:00
Kornel 89acca1318 Escape profile URLs better
Fixes #1059
2017-03-31 11:08:03 +01:00
Kornel Lesiński 4bc2e6e891 %s is deliberate in this format string
Fixes #1053
2017-03-24 12:00:12 +00:00
Kornel Lesiński 405c9fd9a1 Unused 2017-03-24 12:00:12 +00:00
Kornel 9232316b19 Merge pull request #1052 from sparkle-project/scheme
Make generate_appcast available as a shared scheme
2017-03-24 11:05:33 +00:00
Kornel Lesiński ac042821d8 Special case for .tar.gz extension 2017-03-15 18:42:08 +00:00
Kornel Lesiński 662e84400a Inline release notes if they don't look like a standalone HTML document 2017-03-15 18:42:08 +00:00
Kornel Lesiński 1683d2de34 Simplify release notes link check 2017-03-15 18:42:08 +00:00
Kornel Lesiński 615a08bc32 Feed formatting 2017-03-15 18:42:08 +00:00
16 changed files with 112 additions and 67 deletions

No files matched your search

+10
View File
@@ -1,3 +1,13 @@
# 1.18.0
* More detailed progress bar for package installers (Kornel Lesiński)
* Disabled the keyboard shortcut for the install button for scheduled updates to avoid accidental installs. (George Nachman)
* generate_appcast tool adds release notes if there's an .html file with the same base name as the archive (Brett Walker)
* Added `sparkle:shortVersionString` to the enclosure, #1032 (Brett Walker)
* Fixed Japanese localization (1024jp)
* Fixed escaping of system profile URLs
* Added more logging in various failure cases (Kornel Lesiński)
# 1.17.0
* Added Touch Bar support (Bi11)
+1 -1
View File
@@ -16,7 +16,7 @@ SPARKLE_AUTOMATED_DOWNGRADES = 0
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
SPARKLE_VERSION_MAJOR = 1
SPARKLE_VERSION_MINOR = 17
SPARKLE_VERSION_MINOR = 18
SPARKLE_VERSION_PATCH = 0
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Sparkle"
s.version = "1.17.0"
s.version = "1.18.0"
s.summary = "A software update framework for macOS"
s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers."
s.homepage = "http://sparkle-project.org"
-20
View File
@@ -29,7 +29,6 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
@interface SUAutomaticUpdateDriver ()
@property (assign) BOOL postponingInstallation;
@property (assign) BOOL showErrors;
@property (assign) BOOL willUpdateOnTermination;
@property (assign) BOOL isTerminating;
@property (strong) SUAutomaticUpdateAlert *alert;
@@ -40,7 +39,6 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
@implementation SUAutomaticUpdateDriver
@synthesize postponingInstallation;
@synthesize showErrors;
@synthesize willUpdateOnTermination;
@synthesize isTerminating;
@synthesize alert;
@@ -202,7 +200,6 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
[self stopUpdatingOnTermination];
}
self.showErrors = YES;
[super installWithToolAndRelaunch:relaunch displayingUserInterface:showUI];
}
@@ -231,21 +228,4 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
}
}
- (void)abortUpdateWithError:(NSError *)error
{
if (self.showErrors) {
[super abortUpdateWithError:error];
} else {
// Call delegate separately here because otherwise it won't know we stopped.
// Normally this gets called by the superclass
id<SUUpdaterPrivate> updater = self.updater;
id<SUUpdaterDelegate> updaterDelegate = [updater delegate];
if ([updaterDelegate respondsToSelector:@selector(updater:didAbortWithError:)]) {
[updaterDelegate updater:self.updater didAbortWithError:error];
}
[self abortUpdate];
}
}
@end
+12
View File
@@ -492,6 +492,10 @@
}
NSBundle *sparkleBundle = updater.sparkleBundle;
if (!sparkleBundle) {
SULog(SULogLevelError, @"Sparkle bundle is gone?");
return;
}
// Copy the relauncher into a temporary directory so we can get to it after the new version's installed.
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
@@ -501,6 +505,14 @@
NSError *error = nil;
BOOL copiedRelaunchPath = NO;
if (!relaunchToolName) {
SULog(SULogLevelError, @"SPARKLE_RELAUNCH_TOOL_NAME not configued");
}
if (!relaunchToolSourcePath) {
SULog(SULogLevelError, @"Sparkle.framework is damaged. %@ is missing", relaunchToolName);
}
if (relaunchToolSourcePath) {
relaunchCopyTargetPath = [[self appCachePath] stringByAppendingPathComponent:[relaunchToolSourcePath lastPathComponent]];
-1
View File
@@ -47,7 +47,6 @@ extern NSString *const SUEnableSystemProfilingKey;
extern NSString *const SUSendProfileInfoKey;
extern NSString *const SULastProfileSubmitDateKey;
extern NSString *const SUPromptUserOnFirstLaunchKey;
extern NSString *const SUKeepDownloadOnFailedInstallKey;
extern NSString *const SUDefaultsDomainKey;
extern NSString *const SUEnableJavaScriptKey;
extern NSString *const SUFixedHTMLDisplaySizeKey __attribute__((deprecated("This key is obsolete and has no effect.")));
-1
View File
@@ -41,7 +41,6 @@ NSString *const SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate";
NSString *const SUPromptUserOnFirstLaunchKey = @"SUPromptUserOnFirstLaunch";
NSString *const SUEnableJavaScriptKey = @"SUEnableJavaScript";
NSString *const SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize";
NSString *const SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall";
NSString *const SUDefaultsDomainKey = @"SUDefaultsDomain";
NSString *const SUSparkleErrorDomain = @"SUSparkleErrorDomain";
+3
View File
@@ -174,7 +174,10 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
if (runStatus != errAuthorizationSuccess) {
#pragma clang diagnostic pop
if (error != NULL) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcstring-format-directive"
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Failed to run authorization tool %s (%d).", toolPath, (int)runStatus] }];
#pragma clang diagnostic pop
}
return NO;
}
+6 -1
View File
@@ -127,7 +127,12 @@
if (!keyPath) {
return nil;
}
return [NSString stringWithContentsOfFile:keyPath encoding:NSASCIIStringEncoding error:nil];
NSError *error = nil;
key = [NSString stringWithContentsOfFile:keyPath encoding:NSASCIIStringEncoding error:&error];
if (error) {
SULog(SULogLevelError, @"Error loading %@: %@", keyPath, error);
}
return key;
}
- (NSString * __nullable)publicDSAKeyFileKey
+4 -4
View File
@@ -43,8 +43,8 @@ void SULog(SULogLevel level, NSString *format, ...)
// Act the same way os_log() does; don't log to stderr if a terminal device is attached
if (!isatty(STDERR_FILENO)) {
options |= ASL_OPT_STDERR;
}
}
NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath];
client = asl_open([displayName stringByAppendingString:@" [Sparkle]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options);
queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
@@ -77,10 +77,10 @@ void SULog(SULogLevel level, NSString *format, ...)
// See docs for OS_LOG_TYPE_ERROR
os_log_error(logger, "%{public}@", logMessage);
break;
}
}
#pragma clang diagnostic pop
return;
}
}
// Otherwise use ASL
// Make sure we do not async, because if we async, the log may not be delivered deterministically
+8 -21
View File
@@ -12,13 +12,17 @@
@interface SUScheduledUpdateDriver ()
@property (assign) BOOL showErrors;
@end
@implementation SUScheduledUpdateDriver
@synthesize showErrors;
- (instancetype)initWithUpdater:(id<SUUpdaterPrivate>)anUpdater
{
if ((self = [super initWithUpdater:anUpdater])) {
self.showErrors = NO;
}
return self;
}
- (void)didFindValidUpdate
{
@@ -39,25 +43,8 @@
[self abortUpdate]; // Don't tell the user that no update was found; this was a scheduled update.
}
- (void)abortUpdateWithError:(NSError *)error
{
if (self.showErrors) {
[super abortUpdateWithError:error];
} else {
// Call delegate separately here because otherwise it won't know we stopped.
// Normally this gets called by the superclass
id<SUUpdaterPrivate> updater = self.updater;
id<SUUpdaterDelegate> updaterDelegate = [updater delegate];
if ([updaterDelegate respondsToSelector:@selector(updater:didAbortWithError:)]) {
[updaterDelegate updater:self.updater didAbortWithError:error];
}
[self abortUpdate];
}
}
- (BOOL)shouldDisableKeyboardShortcutForInstallButton {
return YES;
}
@end
+1
View File
@@ -15,6 +15,7 @@
@class SUStatusController;
@interface SUUIBasedUpdateDriver : SUBasicUpdateDriver
@property (assign) BOOL showErrors;
- (void)showAlert:(NSAlert *)alert;
- (IBAction)cancelDownload:(id)sender;
+9 -5
View File
@@ -45,11 +45,13 @@
@synthesize statusController;
@synthesize updateAlert;
@synthesize showErrors;
- (instancetype)initWithUpdater:(id<SUUpdaterPrivate>)anUpdater
{
if ((self = [super initWithUpdater:anUpdater])) {
self.automaticallyInstallUpdates = NO;
self.showErrors = YES;
}
return self;
}
@@ -293,11 +295,13 @@
- (void)abortUpdateWithError:(NSError *)error
{
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = SULocalizedString(@"Update Error!", nil);
alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]];
[alert addButtonWithTitle:SULocalizedString(@"Cancel Update", nil)];
[self showAlert:alert];
if (self.showErrors) {
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = SULocalizedString(@"Update Error!", nil);
alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]];
[alert addButtonWithTitle:SULocalizedString(@"Cancel Update", nil)];
[self showAlert:alert];
}
[super abortUpdateWithError:error];
}
+8 -1
View File
@@ -483,6 +483,13 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
return [self.host boolForKey:SUSendProfileInfoKey];
}
static NSString *escapeURLComponent(NSString *str) {
return [[[[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
stringByReplacingOccurrencesOfString:@"=" withString:@"%3d"]
stringByReplacingOccurrencesOfString:@"&" withString:@"%26"]
stringByReplacingOccurrencesOfString:@"+" withString:@"%2b"];
}
- (NSURL *)parameterizedFeedURL
{
NSURL *baseFeedURL = [self feedURL];
@@ -512,7 +519,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
// Build up the parameterized URL.
NSMutableArray *parameterStrings = [NSMutableArray array];
for (NSDictionary *currentProfileInfo in parameters) {
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", [[[currentProfileInfo objectForKey:@"key"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[[currentProfileInfo objectForKey:@"value"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", escapeURLComponent([[currentProfileInfo objectForKey:@"key"] description]), escapeURLComponent([[currentProfileInfo objectForKey:@"value"] description])]];
}
NSString *separatorCharacter = @"?";
+34 -3
View File
@@ -119,14 +119,45 @@ class ArchiveItem: CustomStringConvertible {
return (self.archiveFileAttributes[.size] as! NSNumber).int64Value;
}
var releaseNotesPath : URL {
let basename = self.archivePath.deletingPathExtension();
private var releaseNotesPath : URL? {
var basename = self.archivePath.deletingPathExtension();
if basename.pathExtension == "tar" { // tar.gz
basename = basename.deletingPathExtension();
}
let releaseNotes = basename.appendingPathExtension("html");
if !FileManager.default.fileExists(atPath: releaseNotes.path) {
return nil;
}
return releaseNotes;
}
private func getReleaseNotesAsHTMLFragment(_ path: URL) -> String? {
if let html = try? String(contentsOf: path) {
if html.utf8.count < 1000 &&
!html.localizedCaseInsensitiveContains("<!DOCTYPE") &&
!html.localizedCaseInsensitiveContains("<body") {
return html;
}
}
return nil;
}
var releaseNotesHTML : String? {
if let path = self.releaseNotesPath {
return self.getReleaseNotesAsHTMLFragment(path);
}
return nil;
}
var releaseNotesURL : URL? {
guard let escapedFilename = self.releaseNotesPath.lastPathComponent.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else {
guard let path = self.releaseNotesPath else {
return nil;
}
// The file is already used as inline description
if self.getReleaseNotesAsHTMLFragment(path) != nil {
return nil;
}
guard let escapedFilename = path.lastPathComponent.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else {
return nil;
}
if let relative = self.feedURL {
+15 -8
View File
@@ -23,6 +23,7 @@ func findOrCreateElement(name: String, parent: XMLElement) -> XMLElement {
return element;
}
let element = XMLElement(name: name);
linebreak(parent);
parent.addChild(element);
return element;
}
@@ -69,7 +70,9 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
channel = channelNodes[0] as! XMLElement;
} else {
channel = XMLElement(name: "channel");
linebreak(channel);
channel.addChild(XMLElement.element(withName: "title", stringValue: appBaseName) as! XMLElement);
linebreak(root);
root.addChild(channel);
}
@@ -102,6 +105,13 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
item.addChild(XMLElement.element(withName: "pubDate", stringValue: update.pubDate) as! XMLElement);
}
if let html = update.releaseNotesHTML {
let descElement = findOrCreateElement(name: "description", parent: item);
let cdata = XMLNode(kind:.text, options:.nodeIsCDATA);
cdata.stringValue = html;
descElement.setChildren([cdata]);
}
var minVer = findElement(name: "sparkle:minimumSystemVersion", parent: item);
if nil == minVer {
minVer = XMLElement.element(withName: "sparkle:minimumSystemVersion", uri: sparkleNS) as? XMLElement;
@@ -111,16 +121,13 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
minVer?.setChildren([text(update.minimumSystemVersion)]);
let relElement = findElement(name: "sparkle:releaseNotesLink", parent: item);
if nil == relElement {
if FileManager.default.fileExists(atPath: update.releaseNotesPath.path) {
if let url = update.releaseNotesURL {
if nil == relElement {
linebreak(item);
item.addChild(XMLElement.element(withName:"sparkle:releaseNotesLink", stringValue: (update.releaseNotesURL?.absoluteString)!) as! XMLElement);
}
} else {
if !FileManager.default.fileExists(atPath: update.releaseNotesPath.path) {
let childIndex = relElement?.index;
item.removeChild(at: childIndex!);
item.addChild(XMLElement.element(withName:"sparkle:releaseNotesLink", stringValue: url.absoluteString) as! XMLElement);
}
} else if let childIndex = relElement?.index {
item.removeChild(at: childIndex);
}
var enclosure = findElement(name: "enclosure", parent: item);