mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Add host name of bundle in potential user facing error messages
This commit is contained in:
1 parent
45581d5658
commit
e331afddb1
1 file changed
+11
-7
Vendored
+11
-7
@@ -168,9 +168,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
- (BOOL)checkIfConfiguredProperly:(NSError * __autoreleasing *)error
|
||||
{
|
||||
NSString *hostName = self.host.name;
|
||||
|
||||
if (self.sparkleBundle == nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidUpdaterError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"%@ can't find Sparkle.framework it belongs to.", NSStringFromClass([self class])] }];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidUpdaterError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"%@ can't find Sparkle.framework it belongs to in %@.", NSStringFromClass([self class]), hostName] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@@ -182,14 +184,14 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
if ([[self hostBundle] bundleIdentifier] == nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidHostBundleIdentifierError userInfo:@{ NSLocalizedDescriptionKey: @"Sparkle cannot target a bundle that does not have a valid bundle identifier." }];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidHostBundleIdentifierError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Sparkle cannot target a bundle that does not have a valid bundle identifier for %@.", hostName] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (!self.host.validVersion) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidHostVersionError userInfo:@{ NSLocalizedDescriptionKey: @"Sparkle cannot target a bundle that does not have a valid version." }];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidHostVersionError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Sparkle cannot target a bundle that does not have a valid version for %@.", hostName] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@@ -228,7 +230,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
NSString *publicDSAKeyFileKey = [self.host publicDSAKeyFileKey];
|
||||
if (publicDSAKeyFileKey != nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"The DSA public key '%@' could not be found.", publicDSAKeyFileKey] }];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"The DSA public key '%@' could not be found for %@.", publicDSAKeyFileKey, hostName] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@@ -237,7 +239,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
if (!hasPublicKey) {
|
||||
if (!servingOverHttps || ![SUCodeSigningVerifier bundleAtURLIsCodeSigned:[[self hostBundle] bundleURL]]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: @"For security reasons, updates need to be signed with an EdDSA key. See Sparkle's documentation for more information." }];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"For security reasons, updates need to be signed with an EdDSA key for %@. See Sparkle's documentation for more information.", hostName] }];
|
||||
}
|
||||
return NO;
|
||||
} else {
|
||||
@@ -652,10 +654,12 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
- (BOOL)retrieveFeedURL:(NSURL * __autoreleasing *)feedURL error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
NSString *hostName = self.host.name;
|
||||
|
||||
if (![NSThread isMainThread]) {
|
||||
SULog(SULogLevelError, @"Error: SPUUpdater -retrieveFeedURL:error: must be called on the main thread.");
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUIncorrectAPIUsageError userInfo:@{ NSLocalizedDescriptionKey: @"SUUpdater -retriveFeedURL:error: must be called on the main thread."}];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUIncorrectAPIUsageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"SUUpdater -retriveFeedURL:error: must be called on the main thread for %@", hostName]}];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@@ -671,7 +675,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
if (!appcastString) { // Can't find an appcast string!
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidFeedURLError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"You must specify the URL of the appcast as the %@ key in either the Info.plist or the user defaults!", SUFeedURLKey] }];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidFeedURLError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"You must specify the URL of the appcast as the %@ key in either the Info.plist or the user defaults of %@!", SUFeedURLKey, hostName] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user