X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/f4f6714a329bf399840b3f9991b310bd17f7bed6..35cd98c0a5a9e685cfb7589acc7cdecbd58b4b61:/MobileCydia.mm diff --git a/MobileCydia.mm b/MobileCydia.mm index e927ab3e..1b3ba02c 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -641,9 +641,6 @@ static _H Font18_; static _H Font18Bold_; static _H Font22Bold_; -static NSString *SerialNumber_ = nil; -static NSString *ChipID_ = nil; -static NSString *BBSNum_ = nil; static _H UniqueID_; static _H CollationLocale_; @@ -711,12 +708,10 @@ _H Sources_; static _transient NSNumber *Version_; static time_t now_; -static NSString *Idiom_; static _H Firmware_; static NSString *Major_; static _H SessionData_; -static _H HostConfig_; static _H BridgedHosts_; static _H InsecureHosts_; @@ -4332,7 +4327,7 @@ class CydiaLogCleaner : } - (NSString *) idiom { - return (id) Idiom_ ?: [NSNull null]; + return IsWildcat_ ? @"ipad" : @"iphone"; } - (NSArray *) cells { @@ -4377,15 +4372,15 @@ class CydiaLogCleaner : } - (NSString *) bbsnum { - return (id) BBSNum_ ?: [NSNull null]; + return (id) CYHex((NSData *) CYIOGetValue("IOService:/AppleARMPE/baseband", @"snum"), false) ?: [NSNull null]; } - (NSString *) ecid { - return (id) ChipID_ ?: [NSNull null]; + return (id) [CYHex((NSData *) CYIOGetValue("IODeviceTree:/chosen", @"unique-chip-id"), true) uppercaseString] ?: [NSNull null]; } - (NSString *) serial { - return SerialNumber_; + return (NSString *) CYIOGetValue("IOService:/", @"IOPlatformSerialNumber"); } - (NSString *) role { @@ -4627,12 +4622,12 @@ class CydiaLogCleaner : } } - (void) addBridgedHost:(NSString *)host { -@synchronized (HostConfig_) { +@synchronized (BridgedHosts_) { [BridgedHosts_ addObject:host]; } } - (void) addInsecureHost:(NSString *)host { -@synchronized (HostConfig_) { +@synchronized (InsecureHosts_) { [InsecureHosts_ addObject:host]; } } @@ -4853,7 +4848,7 @@ class CydiaLogCleaner : if ([[[self scheme] lowercaseString] isEqualToString:@"https"]) return true; - @synchronized (HostConfig_) { + @synchronized (InsecureHosts_) { if ([InsecureHosts_ containsObject:[self host]]) return true; } @@ -4886,7 +4881,7 @@ class CydiaLogCleaner : bool bridged(false); - @synchronized (HostConfig_) { + @synchronized (BridgedHosts_) { if ([scheme isEqualToString:@"file"]) bridged = true; else if ([scheme isEqualToString:@"https"]) @@ -4938,7 +4933,7 @@ class CydiaLogCleaner : if (Machine_ != NULL && [copy valueForHTTPHeaderField:@"X-Machine"] == nil) [copy setValue:[NSString stringWithUTF8String:Machine_] forHTTPHeaderField:@"X-Machine"]; - bool bridged; @synchronized (HostConfig_) { + bool bridged; @synchronized (BridgedHosts_) { bridged = [BridgedHosts_ containsObject:host]; } @@ -9579,7 +9574,7 @@ _end [super applicationDidFinishLaunching:unused]; _trace(); - @synchronized (HostConfig_) { + @synchronized (BridgedHosts_) { [BridgedHosts_ addObject:[[NSURL URLWithString:CydiaURL(@"")] host]]; } @@ -9845,8 +9840,6 @@ int main(int argc, char *argv[]) { CyteInitialize(@"Cydia", Cydia_); UpdateExternalStatus(0); - Idiom_ = IsWildcat_ ? @"ipad" : @"iphone"; - RegEx pattern("([0-9]+\\.[0-9]+).*"); UIDevice *device([UIDevice currentDevice]); @@ -9857,19 +9850,10 @@ int main(int argc, char *argv[]) { Major_ = pattern[1]; SessionData_ = [NSMutableDictionary dictionaryWithCapacity:4]; + BridgedHosts_ = [NSMutableSet setWithCapacity:4]; + InsecureHosts_ = [NSMutableSet setWithCapacity:4]; - HostConfig_ = [[[NSObject alloc] init] autorelease]; - @synchronized (HostConfig_) { - BridgedHosts_ = [NSMutableSet setWithCapacity:4]; - InsecureHosts_ = [NSMutableSet setWithCapacity:4]; - } - - NSString *ui(@"ui/ios"); - if (Idiom_ != nil) - ui = [ui stringByAppendingString:[NSString stringWithFormat:@"~%@", Idiom_]]; - ui = [ui stringByAppendingString:[NSString stringWithFormat:@"/%@", Major_]]; - UI_ = CydiaURL(ui); - + UI_ = CydiaURL([NSString stringWithFormat:@"ui/ios~%@/%@", IsWildcat_ ? @"ipad" : @"iphone", Major_]); PackageName = reinterpret_cast(method_getImplementation(class_getInstanceMethod([Package class], @selector(cyname)))); /* Set Locale {{{ */ @@ -9971,6 +9955,7 @@ int main(int argc, char *argv[]) { void *gestalt(dlopen("/usr/lib/libMobileGestalt.dylib", RTLD_GLOBAL | RTLD_LAZY)); $MGCopyAnswer = reinterpret_cast(dlsym(gestalt, "MGCopyAnswer")); + UniqueID_ = UniqueIdentifier(device); /* System Information {{{ */ size_t size; @@ -9984,12 +9969,6 @@ int main(int argc, char *argv[]) { if (sysctlbyname("kern.maxproc", NULL, NULL, &maxproc, sizeof(maxproc)) == -1) perror("sysctlbyname(\"kern.maxproc\", #)"); } - - SerialNumber_ = (NSString *) CYIOGetValue("IOService:/", @"IOPlatformSerialNumber"); - ChipID_ = [CYHex((NSData *) CYIOGetValue("IODeviceTree:/chosen", @"unique-chip-id"), true) uppercaseString]; - BBSNum_ = CYHex((NSData *) CYIOGetValue("IOService:/AppleARMPE/baseband", @"snum"), false); - - UniqueID_ = UniqueIdentifier(device); /* }}} */ /* Load Database {{{ */ SectionMap_ = [[[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Sections" ofType:@"plist"]] autorelease];