Compare commits

..
5 Commits
Author SHA1 Message Date
Kelvin Sherlock 405e802176 version bump 2021-11-24 13:04:36 -05:00
Kelvin Sherlock d352e7c45d Download manager - support for password protected web sites (basic authorization).
Since there's no UI for the username/password, these need to be managed within keychain.

Add a new keychain item with the porotocol + server (ie, https://romz.example.com) as the keychain item name, account name, and password.
2021-11-20 09:43:22 -05:00
Kelvin Sherlock 5af5e2e300 move first responder resignation code to a function. 2021-11-16 22:44:38 -05:00
Kelvin Sherlock afc3ac608a Downloader: resign first responder before downloading so the URL will update (if it's being edited). 2021-11-16 20:44:11 -05:00
Kelvin Sherlock c200672650 sparkle update. 2021-11-16 19:15:17 -05:00
5 changed files with 92 additions and 11 deletions

No files matched your search

+4 -4
View File
@@ -1518,7 +1518,7 @@
CODE_SIGN_ENTITLEMENTS = Ample/Ample.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 23;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -1529,7 +1529,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 0.237;
MARKETING_VERSION = 0.238;
PRODUCT_BUNDLE_IDENTIFIER = com.ksherlock.ample;
PRODUCT_NAME = "$(TARGET_NAME)";
};
@@ -1542,7 +1542,7 @@
CODE_SIGN_ENTITLEMENTS = Ample/Ample.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 23;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -1553,7 +1553,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 0.237;
MARKETING_VERSION = 0.238;
PRODUCT_BUNDLE_IDENTIFIER = com.ksherlock.ample;
PRODUCT_NAME = "$(TARGET_NAME)";
};
+2 -2
View File
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>MameComponentsDate</key>
<date>2021-10-27T16:00:00Z</date>
<date>2021-11-23T16:00:00Z</date>
<key>UseCustomMame</key>
<false/>
<key>AutoCloseLogWindow</key>
@@ -15,7 +15,7 @@
<key>NSQuitAlwaysKeepsWindows</key>
<true/>
<key>DefaultDownloadURL</key>
<string>https://archive.org/download/mame-0.236-romset</string>
<string>https://archive.org/download/mame-0.231-merged</string>
<key>DefaultDownloadExtension</key>
<string>7z</string>
</dict>
+77
View File
@@ -373,6 +373,10 @@ enum {
#endif
}
-(void) defocus {
[[self window] makeFirstResponder: nil];
}
#pragma mark - IBActions
-(IBAction)cancelAll:(id)sender {
@@ -390,6 +394,7 @@ enum {
- (IBAction)downloadMissing:(id)sender {
[self defocus];
BOOL delta = NO;
for (DownloadItem *item in _items) {
NSURL *url = [item localURL];
@@ -452,6 +457,8 @@ enum {
DownloadItem *item = [self clickedItem];
if (!item) return;
[self defocus];
[self downloadItem: item];
[self setActive: YES];
}
@@ -586,6 +593,76 @@ static NSInteger TaskStatusCode(NSURLSessionTask *task) {
NSLog(@"%@", src);
}
-(NSURLCredential *)credentialForChallenge: (NSURLAuthenticationChallenge *)challenge {
//if ([challenge previousFailureCount]) return nil;
NSURLCredential *credential = nil;
NSURLProtectionSpace *space = [challenge protectionSpace];
OSStatus status;
NSDictionary *query;
CFTypeRef item = nil;
query = @{
(id)kSecClass: (id)kSecClassInternetPassword,
(id)kSecReturnData: (id)kCFBooleanTrue,
(id)kSecReturnAttributes: (id)kCFBooleanTrue,
(id)kSecAttrServer: [space host],
//(id)kSecAttrProtocol: [space protocol],
(id)kSecMatchLimit: (id)kSecMatchLimitOne,
};
status = SecItemCopyMatching((CFDictionaryRef)query, &item);
NSLog(@"%@", query);
if (status != 0) return nil;
NSDictionary *d = (__bridge NSDictionary *)item;
NSLog(@"%@", d);
NSString *account = [d objectForKey: (id)kSecAttrAccount];
NSData *passwordData = [d objectForKey: (id)kSecValueData];
NSString *password = [[NSString alloc] initWithData: passwordData encoding: NSUTF8StringEncoding];
credential = [NSURLCredential credentialWithUser: account password: password persistence: NSURLCredentialPersistenceForSession];
return credential;
}
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
NSLog(@"challenge: %@", challenge);
if ([challenge previousFailureCount]) {
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
return;
}
NSURLProtectionSpace *space = [challenge protectionSpace];
NSString *method = [space authenticationMethod];
if ([NSURLAuthenticationMethodHTTPBasic isEqualToString: method] ||
[NSURLAuthenticationMethodNTLM isEqualToString: method] ||
[NSURLAuthenticationMethodHTTPDigest isEqualToString: method]) {
NSURLCredential *credential = [self credentialForChallenge: challenge];
if (credential) {
completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
return;
}
}
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
}
@end
+8 -4
View File
@@ -594,11 +594,15 @@ static NSString *ShellQuote(NSString *s) {
//return [super validateMenuItem: menuItem]; // not implemented?
}
-(void)defocus {
[[self window] makeFirstResponder: nil]; // in case text is being edited...
}
# pragma mark - IBActions
- (IBAction)launchAction:(id)sender {
[[self window] makeFirstResponder: nil]; // in case text is being edited...
[self defocus];
if (![_args count]) return;
[LogWindowController controllerForArgs: _args];
@@ -608,7 +612,7 @@ static NSString *ShellQuote(NSString *s) {
- (IBAction)listMedia:(id)sender {
[[self window] makeFirstResponder: nil]; // in case text is being edited...
[self defocus];
if (!_machine) return;
NSMutableArray *argv = [NSMutableArray new];
@@ -635,7 +639,7 @@ static NSString *ShellQuote(NSString *s) {
- (IBAction)listSlots:(id)sender {
[[self window] makeFirstResponder: nil]; // in case text is being edited...
[self defocus];
if (!_machine) return;
NSMutableArray *argv = [NSMutableArray new];
@@ -935,7 +939,7 @@ static NSString *ShellQuote(NSString *s) {
-(NSDictionary *)makeBookmark {
[[self window] makeFirstResponder: nil];
[self defocus];
NSMutableDictionary *dict = [NSMutableDictionary new];
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
VERSION=1.26.0
VERSION=1.27.1
TAR=Sparkle-${VERSION}.tar.xz
URL=https://github.com/sparkle-project/Sparkle/releases/download/${VERSION}/Sparkle-${VERSION}.tar.xz
FRAMEWORK=Sparkle.framework