Last active
May 6, 2024 13:31
-
-
Save BandarHL/492d50de46875f9ac7a056aad084ac10 to your computer and use it in GitHub Desktop.
Fix YouTube keychain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
// For new versions of YouTube from 17.33.2 and higher | |
%hook SSOKeychainCore | |
+ (NSString *)accessGroup { | |
return accessGroupID(); | |
} | |
+ (NSString *)sharedAccessGroup { | |
return accessGroupID(); | |
} | |
%end | |
// For versions of YouTube below 17.33.2 | |
%hook SSOKeychain | |
+ (NSString *)accessGroup { | |
return accessGroupID(); | |
} | |
+ (NSString *)sharedAccessGroup { | |
return accessGroupID(); | |
} | |
%end | |
// Fix appGroup path | |
%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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
YouTube 17.33.2 works for me, thanks