Skip to content

Commit

Permalink
Merge branch 'qnblackcat:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
arichornlover authored Aug 26, 2022
2 parents 245a98b + 26e97de commit 1651c8c
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 9 deletions.
65 changes: 65 additions & 0 deletions CercubePlus.xm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ NSBundle *CercubePlusBundle() {
}
NSBundle *tweakBundle = CercubePlusBundle();

// 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;
}

BOOL hideHUD() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"];
}
Expand Down Expand Up @@ -98,6 +117,11 @@ BOOL ytDisableHighContrastIcons () {
- (BOOL)canReorder { return YES; }
%end

// Skips content warning before playing *some videos - @PoomSmart
%hook YTPlayabilityResolutionUserActionUIController
- (void)showConfirmAlert { [self confirmAlertDidPressConfirm]; }
%end

// YTMiniPlayerEnabler: https://github.com/level3tjg/YTMiniplayerEnabler/
%hook YTWatchMiniBarViewController
- (void)updateMiniBarPlayerStateFromRenderer {
Expand Down Expand Up @@ -340,6 +364,47 @@ BOOL ytDisableHighContrastIcons () {
}
%end

// Fix "You can't sign in to this app because Google can't confirm that it's safe" warning when signing in. by julioverne & PoomSmart
// https://gist.github.com/PoomSmart/ef5b172fd4c5371764e027bea2613f93
// https://github.com/qnblackcat/uYouPlus/pull/398
%hook SSOService
+ (id)fetcherWithRequest:(NSMutableURLRequest *)request configuration:(id)configuration {
if ([request isKindOfClass:[NSMutableURLRequest class]] && request.HTTPBody) {
NSError *error = nil;
NSMutableDictionary *body = [NSJSONSerialization JSONObjectWithData:request.HTTPBody options:NSJSONReadingMutableContainers error:&error];
if (!error && [body isKindOfClass:[NSMutableDictionary class]]) {
[body removeObjectForKey:@"device_challenge_request"];
request.HTTPBody = [NSJSONSerialization dataWithJSONObject:body options:kNilOptions error:&error];
}
}
return %orig;
}
%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

# pragma mark - OLED dark mode by BandarHL
UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:1.0];
%group gOLED
Expand Down
4 changes: 4 additions & 0 deletions Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#define YT_NAME @"YouTube"

// CercubePlus
@interface YTPlayabilityResolutionUserActionUIController : NSObject // Skips content warning before playing *some videos - @PoomSmart
- (void)confirmAlertDidPressConfirm;
@end

@interface YTMainAppControlsOverlayView: UIView
@end

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CercubePlus_INJECT_DYLIBS = Tweaks/Cercube/Library/MobileSubstrate/DynamicLibrar
CercubePlus_FILES = CercubePlus.xm Settings.xm
CercubePlus_IPA = ./tmp/Payload/YouTube.app
CercubePlus_CFLAGS = -fobjc-arc
CercubePlus_FRAMEWORKS = UIKit
CercubePlus_FRAMEWORKS = UIKit Security

include $(THEOS)/makefiles/common.mk
include $(THEOS_MAKE_PATH)/tweak.mk
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

- [BandarHL](https://twitter.com/bandarhl) for a bunch of improvements.

- [Julioverne](https://twitter.com/ijulioverne) for the solution to skip Google's safety warning when logging in.

- [MiRO92](https://twitter.com/miro92) for [YTNoShorts](https://github.com/MiRO92/YTNoShorts/blob/main/Tweak.h).

- [YouTube Extensions](https://github.com/CokePokes/YoutubeExtensions) by [CokePokes](https://github.com/CokePokes/).
Expand Down Expand Up @@ -91,16 +93,16 @@ any many more...

- **CercubePlus** (or you can call it Cercube+) requires iOS & iPadOS 13.0 and later. The latest version of **CercubePlus** can be found in the [Release tab](https://github.com/qnblackcat/CercubePlus/releases).

- For AltStore user: [Open in AltStore (v17.31.4-5.3.10)](https://tinyurl.com/ycyje6yw) - It will take a while to install because AltStore needs to download the IPA first.
- For AltStore user: [Open in AltStore (v17.33.2-5.3.10)](https://tinyurl.com/2p8k7fzw) - It will take a while to install because AltStore needs to download the IPA first.

- Version info: _(Aug 12)_
- Version info: _(Aug 26)_

<details>
<summary>Expand!</summary>

| **Tweaks/App** | **Developer** | **Version** | **Open source** |
| - | - | :-: | :-: |
| **YouTube** | Google Inc | 17.31.4 | ✖︎ |
| **YouTube** | Google Inc | 17.33.2 | ✖︎ |
| **Cercube** | [Majd Alfhaily](https://twitter.com/freemanrepo) | 5.3.10 | ✖︎ |
| **Open in YouTube** | [CokePokes](https://github.com/CokePokes/) | 1.2 | ✖︎ |
| **YTNoShorts** | [MiRO92](https://twitter.com/miro92) | 1.0.2 | [✔︎](https://github.com/MiRO92/YTNoShorts) |
Expand Down Expand Up @@ -146,9 +148,7 @@ any many more...
<details>
<summary>MiRO92</summary>

- CashApp: https://cash.app/$MiRO92M

- Other payment methods are available in uYou's settings.
- https://github.com/MiRO92/uYou-for-YouTube#support
</details>

# Building (optional)
Expand Down
2 changes: 1 addition & 1 deletion Tweaks/YouPiP
2 changes: 1 addition & 1 deletion Tweaks/YouTubeHeader

0 comments on commit 1651c8c

Please sign in to comment.