Skip to content

Commit

Permalink
Merge pull request #51 from leonklingele/https-support
Browse files Browse the repository at this point in the history
HTTPS support for Feed URLs
  • Loading branch information
Giorgio Calderolla committed Jan 12, 2015
2 parents cb22ef5 + 6d3cee7 commit 4057936
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CTCDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern NSString * const kCTCDefaultsApplicationBugReportURL;
extern NSString * const kCTCDefaultsApplicationFeatureRequestURL;
extern NSString * const kCTCDefaultsApplicationHelpURL;
extern NSString * const kCTCDefaultsServiceURL;
extern NSString * const kCTCDefaultsServiceFeedURLPrefix;
extern NSString * const kCTCDefaultsServiceFeedURLRegex;


@interface CTCDefaults : NSObject
Expand Down
12 changes: 7 additions & 5 deletions CTCDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
NSString * const kCTCDefaultsApplicationBugReportURL = @"https://github.com/mipstian/catch/issues/new?labels=bug";
NSString * const kCTCDefaultsApplicationFeatureRequestURL = @"https://github.com/mipstian/catch/issues/new?labels=enhancement";
NSString * const kCTCDefaultsApplicationHelpURL = @"https://github.com/mipstian/catch/wiki/Configuration";
NSString * const kCTCDefaultsServiceURL = @"http://showrss.info/";
NSString * const kCTCDefaultsServiceFeedURLPrefix = @"http://showrss.info/rss.php?";
NSString * const kCTCDefaultsServiceURL = @"https://showrss.info/";
NSString * const kCTCDefaultsServiceFeedURLRegex = @"^https?://showrss.info/rss.php\\?(.*)$";

// NSUserDefaults keys
NSString * const kCTCDefaultsFeedURLKey = @"feedURL";
Expand Down Expand Up @@ -91,9 +91,11 @@ + (void)refreshLoginItemStatus {

+ (BOOL)isFeedURLValid {
NSString *feedURL = CTCDefaults.feedURL;
if (![feedURL hasPrefix:kCTCDefaultsServiceFeedURLPrefix]) {
// The URL should start with the prefix!
NSLog(@"Feed URL (%@) does not start with expected prefix (%@)", feedURL, kCTCDefaultsServiceFeedURLPrefix);
NSRegularExpression *feedURLRegex = [NSRegularExpression regularExpressionWithPattern:kCTCDefaultsServiceFeedURLRegex options:0 error:nil];
NSTextCheckingResult *feedURLMatches = [feedURLRegex firstMatchInString:feedURL options:0 range:NSMakeRange(0, [feedURL length])];
if (!feedURLMatches) {
// The URL should match the prefix regex!
NSLog(@"Feed URL (%@) does not match Regex (%@)", feedURL, kCTCDefaultsServiceFeedURLRegex);
return NO;
}
if ([feedURL rangeOfString:@"namespaces"].location == NSNotFound) {
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Features:

* ShowRSS client
* Magnet support
* HTTPS support
* Very low Processor/Memory usage
* Only check your feed at night or in whatever period you choose
* Organize torrents in folders based on show name
Expand Down

0 comments on commit 4057936

Please sign in to comment.