-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.xm
executable file
·28 lines (24 loc) · 1014 Bytes
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Cephei/HBPreferences.h>
#include <mach-o/dyld.h>
#include "headers.h"
HBPreferences *preferences;
BOOL tweakEnabled;
NSString *fosscordURL;
%hook NSURLRequest
+(NSURLRequest *) requestWithURL: (NSURL *)url {
if(tweakEnabled){
NSString *newURL = url.absoluteString;
newURL = [newURL stringByReplacingOccurrencesOfString:@"discord.com" withString:fosscordURL];
newURL = [newURL stringByReplacingOccurrencesOfString:@"gateway.discord.gg" withString:fosscordURL];
newURL = [newURL stringByReplacingOccurrencesOfString:@"cdn.discordapp.com" withString:fosscordURL];
newURL = [newURL stringByReplacingOccurrencesOfString:@"media.discordapp.com" withString:fosscordURL];
url = [NSURL URLWithString:newURL];
}
return %orig;
}
%end
%ctor {
preferences = [[HBPreferences alloc] initWithIdentifier:@"com.jakecrowley.fosscordtweakprefs"];
[preferences registerBool:&tweakEnabled default:NO forKey:@"tweakEnabled"];
[preferences registerObject:&fosscordURL default:@"" forKey:@"fosscordURL"];
}