Skip to content

Commit

Permalink
[NEW] version 2.1.4: El Capitan Support
Browse files Browse the repository at this point in the history
  • Loading branch information
goooseman committed Nov 15, 2015
1 parent 5feae9a commit 0418421
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 65 deletions.
Binary file added .DS_Store
Binary file not shown.
7 changes: 6 additions & 1 deletion Torrent Updater.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = GS;
LastUpgradeCheck = 0630;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "Alexander Gusev";
TargetAttributes = {
DF6B53EA18D81F76009EA59E = {
Expand Down Expand Up @@ -607,6 +607,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
Expand Down Expand Up @@ -681,6 +682,7 @@
"${SRCROOT}/Torrent\\ Updater/External",
);
OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "goooseman.ru.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
WRAPPER_EXTENSION = app;
Expand Down Expand Up @@ -708,6 +710,7 @@
"${SRCROOT}/Torrent\\ Updater/External",
);
OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "goooseman.ru.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
WRAPPER_EXTENSION = app;
Expand All @@ -732,6 +735,7 @@
"$(inherited)",
);
INFOPLIST_FILE = "Torrent UpdaterTests/Torrent UpdaterTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "goooseman.ru.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
Expand All @@ -752,6 +756,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Torrent Updater/Torrent Updater-Prefix.pch";
INFOPLIST_FILE = "Torrent UpdaterTests/Torrent UpdaterTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "goooseman.ru.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
Expand Down
Binary file added Torrent Updater/.DS_Store
Binary file not shown.
Binary file added Torrent Updater/External/.DS_Store
Binary file not shown.
Binary file not shown.
3 changes: 1 addition & 2 deletions Torrent Updater/GSAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ -(id)init {
return self;
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[GSSettings setDefaults];
[[[GSShowDockController alloc] init] setShowDock:[[[GSSettings alloc] init]._showDock boolValue]];
[[GSStatusItemController sharedInstance] setMenuItem:[[[GSSettings alloc] init]._menuItem boolValue] withMenu:_statusMenu];
Expand All @@ -42,7 +42,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[_appLink setHyperlinkTextFieldWithText:@"http://torrent-updater.goooseman.ru" andLink:@"http://torrent-updater.goooseman.ru"];
[_contactAuthor setHyperlinkTextFieldWithText:NSLocalizedString(@"Contact Author", nil) andLink:@"mailto:rutrackerupd@goooseman.ru"];
[_olenyev setHyperlinkTextFieldWithText:@"olenyev" andLink:@"https://twitter.com/olenyevtweet"];

}

-(void)applicationShouldTerminateAfterLastWindowClosed {
Expand Down
12 changes: 8 additions & 4 deletions Torrent Updater/Models/Common/GSExtra.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,25 @@ -(NSOperationQueue *)sharedOperationQueue {
}

+(BOOL)checkInternet {
NSString *dataString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://ya.ru"] encoding:NSWindowsCP1251StringEncoding error:nil];
NSString *dataString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://google.com"] encoding:NSWindowsCP1251StringEncoding error:nil];

if (dataString && [dataString containsString:@"yandex"])
if (dataString && [dataString containsString:@"google"])
return YES;
else {

return NO;
}

}

-(BOOL)checkInternetAndShowError {
NSString *dataString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://ya.ru"] encoding:NSWindowsCP1251StringEncoding error:nil];
if (dataString && [dataString containsString:@"yandex"]) {
NSLog(@"Checking Internet");
NSString *dataString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://google.com"] encoding:NSWindowsCP1251StringEncoding error:nil];

if (dataString && [dataString containsString:@"google"]) {
return YES;
} else {

[[[NSApplication sharedApplication] delegate] performSelector:@selector(stopLoadingIndicatorWithMessage:) withObject:NSLocalizedString(@"No Internet Connection", nil)];
return NO;
}
Expand Down
20 changes: 19 additions & 1 deletion Torrent Updater/Models/Torrent/GSTorrCheck.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,35 @@
@implementation GSTorrCheck

+(BOOL)loginCorrectAtTracker: (NSString *)tracker {
// In El Capitain everything is fucked up. Apps uses their own cookie storage instead of using Safari ones. I'm not a Cocoa developer, so I developed this dirty hack. If the system is El Capitain or highier is copies Safari's cookies to app's ones.
if (NSAppKitVersionNumber > NSAppKitVersionNumber10_10_Max) {
NSLog(@"El Capitain!");

NSArray* cookies = [[NSHTTPCookieStorage sharedCookieStorageForGroupContainerIdentifier:@"Cookies"] cookiesForURL:[NSURL URLWithString:@"http://rutracker.org/forum/index.php"]];
for (NSHTTPCookie* cookie in cookies) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
}

cookies = [[NSHTTPCookieStorage sharedCookieStorageForGroupContainerIdentifier:@"Cookies"] cookiesForURL:[NSURL URLWithString:@"http://kinozal.tv"]];
for (NSHTTPCookie* cookie in cookies) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
}
}


NSMutableDictionary *trackerSettDict = [GSSettings getSettingsForTracker:tracker];
if ([[trackerSettDict objectForKey:@"needLogin"] isEqualTo:@(NO)])
return YES;
NSError *error;
NSString *html;

[NSHTTPCookieStorage sharedCookieStorageForGroupContainerIdentifier:@"Cookies"];

if ([[trackerSettDict objectForKey:@"encoding"] isEqual: @"UTF8"])
html = [NSString stringWithContentsOfURL:[NSURL URLWithString: [trackerSettDict objectForKey:@"loginCheckURL"]] encoding: NSUTF8StringEncoding error:&error];
else
html = [NSString stringWithContentsOfURL:[NSURL URLWithString: [trackerSettDict objectForKey:@"loginCheckURL"]] encoding: NSWindowsCP1251StringEncoding error:&error];

if (error) {
NSLog(@"%@", error);
return YES;
Expand Down
68 changes: 65 additions & 3 deletions Torrent Updater/Torrent Updater-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,85 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>goooseman.ru.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1.3</string>
<string>2.1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.1.3</string>
<string>2.1.4</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>free-rutor.org</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>kinozal.tv</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>rutracker.org</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>rutracker.org - 5</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>rutrackerupd.goooseman.ru</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>torrent-updater.goooseman.ru</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 Alexander Gusev. All rights reserved.</string>
<key>NSMainNibFile</key>
Expand Down

0 comments on commit 0418421

Please sign in to comment.