Update uYouPlus.xm
Improve Julioverne's code by specifying YouTube SSOService because "device_challenge_request" can be used in other thinks with the App like Apple Push Service.
This commit is contained in:
+12
-12
@@ -374,20 +374,20 @@ BOOL hidePaidPromotionCard() {
|
|||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
||||||
%hook NSJSONSerialization
|
// 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
|
||||||
+ (id)dataWithJSONObject:(id)arg1 options:(unsigned long long)arg2 error:(id*)arg3
|
// https://gist.github.com/PoomSmart/ef5b172fd4c5371764e027bea2613f93
|
||||||
{
|
// https://github.com/qnblackcat/uYouPlus/pull/398
|
||||||
@try {
|
%hook SSOService
|
||||||
if(arg1 && ([arg1 isKindOfClass:[NSDictionary class]] || [arg1 isKindOfClass:[NSMutableDictionary class]]) ) {
|
+ (id)fetcherWithRequest:(NSMutableURLRequest *)request configuration:(id)configuration {
|
||||||
if(arg1[@"device_challenge_request"] != nil) {
|
if ([request isKindOfClass:[NSMutableURLRequest class]] && request.HTTPBody) {
|
||||||
NSMutableDictionary *MutRet = [arg1 mutableCopy];
|
NSError *error = nil;
|
||||||
[MutRet removeObjectForKey:@"device_challenge_request"];
|
NSMutableDictionary *body = [NSJSONSerialization JSONObjectWithData:request.HTTPBody options:NSJSONReadingMutableContainers error:&error];
|
||||||
arg1 = MutRet;
|
if (!error && [body isKindOfClass:[NSMutableDictionary class]]) {
|
||||||
|
[body removeObjectForKey:@"device_challenge_request"];
|
||||||
|
request.HTTPBody = [NSJSONSerialization dataWithJSONObject:body options:kNilOptions error:&error];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}@catch(NSException*e){
|
return %orig;
|
||||||
}
|
|
||||||
return %orig(arg1, arg2, arg3);
|
|
||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user