use portcheck.transmissionbt.com instead of a third-party site

This commit is contained in:
Mitchell Livingston
2008-07-19 14:32:11 +00:00
parent 3a2fa85fa9
commit 6071e2da89
6 changed files with 12 additions and 30 deletions

1
NEWS
View File

@@ -19,6 +19,7 @@ http://trac.transmissionbt.com/query?group=component&milestone=1.30
+ Option to only show the add window when manually adding transfers
+ Status strings are toggled from the action button (they are no longer clickable)
+ Colors in pieces bar and pieces box more accurately reflect their corresponding values
+ The port checker now uses our own portcheck.transmissionbt.com
- GTK+
+ Add options to inhibit hibernation and to toggle the tray icon

View File

@@ -29,7 +29,6 @@ typedef enum
PORT_STATUS_CHECKING,
PORT_STATUS_OPEN,
PORT_STATUS_CLOSED,
PORT_STATUS_STEALTH,
PORT_STATUS_ERROR
} port_status_t;

View File

@@ -25,7 +25,7 @@
#import "PortChecker.h"
#import "NSApplicationAdditions.h"
#define CHECKER_URL @"https://www.grc.com/x/portprobe=%d"
#define CHECKER_URL @"http://portcheck.transmissionbt.com/%d"
#define CHECK_FIRE 3.0
@implementation PortChecker
@@ -114,40 +114,26 @@
- (void) connectionDidFinishLoading: (NSURLConnection *) connection
{
NSXMLDocument * shieldsUpProbe = [[NSXMLDocument alloc] initWithData: fPortProbeData options: NSXMLDocumentTidyHTML error: nil];
NSString * probeString = [[NSString alloc] initWithData: fPortProbeData encoding: NSUTF8StringEncoding];
[fPortProbeData release];
fPortProbeData = nil;
if (shieldsUpProbe)
if (probeString)
{
NSArray * nodes = [shieldsUpProbe nodesForXPath: @"/html/body/center/table[3]/tr/td[2]" error: nil];
if ([nodes count] == 1)
{
NSString * portStatus = [[[[nodes objectAtIndex: 0] stringValue] stringByTrimmingCharactersInSet:
[[NSCharacterSet letterCharacterSet] invertedSet]] lowercaseString];
if ([portStatus isEqualToString: @"open"])
[self callBackWithStatus: PORT_STATUS_OPEN];
else if ([portStatus isEqualToString: @"stealth"])
[self callBackWithStatus: PORT_STATUS_STEALTH];
else if ([portStatus isEqualToString: @"closed"])
[self callBackWithStatus: PORT_STATUS_CLOSED];
else
{
NSLog(@"Unable to get port status: unknown port state");
[self callBackWithStatus: PORT_STATUS_ERROR];
}
}
if ([probeString isEqualToString: @"1"])
[self callBackWithStatus: PORT_STATUS_OPEN];
else if ([probeString isEqualToString: @"0"])
[self callBackWithStatus: PORT_STATUS_CLOSED];
else
{
NSLog(@"Unable to get port status: invalid response");
[self callBackWithStatus: PORT_STATUS_ERROR];
}
[shieldsUpProbe release];
[probeString release];
}
else
{
NSLog(@"Unable to get port status: failed to create xml document");
NSLog(@"Unable to get port status: invalid data received");
[self callBackWithStatus: PORT_STATUS_ERROR];
}
}

View File

@@ -56,7 +56,7 @@
#define RPC_KEYCHAIN_SERVICE "Transmission:Remote"
#define RPC_KEYCHAIN_NAME "Remote"
#define WEBUI_URL @"http://localhost:%d/transmission/clutch/"
#define WEBUI_URL @"http://localhost:%d/transmission/web/"
@interface PrefsController (Private)
@@ -379,10 +379,6 @@
[fPortStatusField setStringValue: NSLocalizedString(@"Port is closed", "Preferences -> Network -> port status")];
[fPortStatusImage setImage: [NSImage imageNamed: @"RedDot.png"]];
break;
case PORT_STATUS_STEALTH:
[fPortStatusField setStringValue: NSLocalizedString(@"Port is stealth", "Preferences -> Network -> port status")];
[fPortStatusImage setImage: [NSImage imageNamed: @"RedDot.png"]];
break;
case PORT_STATUS_ERROR:
[fPortStatusField setStringValue: NSLocalizedString(@"Port check website is down", "Preferences -> Network -> port status")];
[fPortStatusImage setImage: [NSImage imageNamed: @"YellowDot.png"]];

View File

@@ -1 +1 @@
<html>
<html>