BTHLABS-66: Prepping for public release: Take five

AKA "Using Apple reviewers as QA for your project". Thanks, y'all! :)
This commit is contained in:
2025-11-27 17:51:19 +01:00
parent cca49f2292
commit 55126f4af6
26 changed files with 386 additions and 97 deletions

View File

@@ -10,6 +10,7 @@
#import "HPAPI.h"
#import "HPCredentialsHelper.h"
#import "HPRPCClient.h"
#import "NSBundle+HotPocketExtensions.h"
#import "NSURL+HotPocketExtensions.h"
@implementation HPAuthParams
@@ -77,18 +78,19 @@
return nil;
}
NSDictionary *postAuthenticateURLParams = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"HPAuthFlowPostAuthenticateURLParts"];
if (postAuthenticateURLParams == nil) {
NSString *expectedScheme = [NSBundle postAuthenticateURLScheme];
NSString *expectedHost = [NSBundle postAuthenticateURLHost];
if (expectedScheme == nil || expectedHost == nil) {
return nil;
}
NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
if ([urlComponents.scheme isEqualToString:[postAuthenticateURLParams valueForKey:@"scheme"]] == NO) {
if ([urlComponents.scheme isEqualToString:expectedScheme] == NO) {
return nil;
}
if ([urlComponents.host isEqualToString:[postAuthenticateURLParams valueForKey:@"host"]] == NO) {
if ([urlComponents.host isEqualToString:expectedHost] == NO) {
return nil;
}

View File

@@ -12,6 +12,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface NSBundle (HotPocketExtensions)
+(NSString *)uname;
+(NSDictionary *)postAuthenticateURLParams;
+(NSString *)postAuthenticateURLScheme;
+(NSString *)postAuthenticateURLHost;
@end

View File

@@ -14,4 +14,23 @@
return [NSString stringWithFormat:@"HotPocket v%@ (%@)", [mainBundle.infoDictionary valueForKey:@"CFBundleShortVersionString"], [mainBundle.infoDictionary valueForKey:@"CFBundleVersion"]];
}
+(NSDictionary *)postAuthenticateURLParams {
NSDictionary *result = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"HPAuthFlowPostAuthenticateURLParts"];
if (result == nil) {
return [NSDictionary dictionary];
}
return result;
}
+(NSString *)postAuthenticateURLScheme {
NSDictionary *params = [self postAuthenticateURLParams];
return [params valueForKey:@"scheme"];
}
+(NSString *)postAuthenticateURLHost {
NSDictionary *params = [self postAuthenticateURLParams];
return [params valueForKey:@"host"];
}
@end