From 3a47f46a24299074feb0925d65d6029071709b6c Mon Sep 17 00:00:00 2001 From: Balackburn Date: Sun, 26 Nov 2023 19:41:39 +0100 Subject: [PATCH] Added sideloading fix #14 --- YTLitePlus.xm | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/YTLitePlus.xm b/YTLitePlus.xm index a34424c..0a7d346 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -14,6 +14,25 @@ NSBundle *YTLitePlusBundle() { } NSBundle *tweakBundle = YTLitePlusBundle(); +// Keychain fix +static NSString *accessGroupID() { + NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: + (__bridge NSString *)kSecClassGenericPassword, (__bridge NSString *)kSecClass, + @"bundleSeedID", kSecAttrAccount, + @"", kSecAttrService, + (id)kCFBooleanTrue, kSecReturnAttributes, + nil]; + CFDictionaryRef result = nil; + OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *)&result); + if (status == errSecItemNotFound) + status = SecItemAdd((__bridge CFDictionaryRef)query, (CFTypeRef *)&result); + if (status != errSecSuccess) + return nil; + NSString *accessGroup = [(__bridge NSDictionary *)result objectForKey:(__bridge NSString *)kSecAttrAccessGroup]; + + return accessGroup; +} + // static BOOL IsEnabled(NSString *key) { return [[NSUserDefaults standardUserDefaults] boolForKey:key]; @@ -258,6 +277,39 @@ static BOOL IsEnabled(NSString *key) { %hook YTYouThereController - (BOOL)shouldShowYouTherePrompt { return NO; } %end +// Fix login for YouTube 18.13.2 and higher +%hook SSOKeychainHelper ++ (NSString *)accessGroup { + return accessGroupID(); +} ++ (NSString *)sharedAccessGroup { + return accessGroupID(); +} +%end + +// Fix login for YouTube 17.33.2 and higher - @BandarHL +// https://gist.github.com/BandarHL/492d50de46875f9ac7a056aad084ac10 +%hook SSOKeychainCore ++ (NSString *)accessGroup { + return accessGroupID(); +} + ++ (NSString *)sharedAccessGroup { + return accessGroupID(); +} +%end + +// Fix App Group Directory by move it to document directory +%hook NSFileManager +- (NSURL *)containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier { + if (groupIdentifier != nil) { + NSArray *paths = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]; + NSURL *documentsURL = [paths lastObject]; + return [documentsURL URLByAppendingPathComponent:@"AppGroup"]; + } + return %orig(groupIdentifier); +} +%end // YTNOCheckLocalNetWork - https://poomsmart.github.io/repo/depictions/ytnochecklocalnetwork.html %hook YTHotConfig