Port to Mavericks

This commit is contained in:
Alter Step
2014-04-18 00:19:18 -07:00
parent 830396921d
commit 09df20a910
12 changed files with 512 additions and 2442 deletions
+20 -22
View File
@@ -52,7 +52,6 @@ typedef enum {
NSTextField *_statusText;
WebView *_previewNotesWebView;
WebView *_releaseNotesWebView;
WebView *_feedbackWebView;
WebView *_aboutWebView;
NSTextFieldCell *_staticResolversTextField;
NSTextField *_blacklistIPsTextField;
@@ -62,29 +61,28 @@ typedef enum {
NSButton *_viewLogButton;
NSButton *_queryLoggingButton;
}
@property (nonatomic, retain) IBOutlet NSTabView *tabView;
@property (nonatomic, retain) IBOutlet NSTabViewItem *aboutTabViewItem;
@property (nonatomic, retain) IBOutlet NSTabViewItem *releaseNotesTabViewItem;
@property (nonatomic, strong) IBOutlet NSTabView *tabView;
@property (nonatomic, strong) IBOutlet NSTabViewItem *aboutTabViewItem;
@property (nonatomic, strong) IBOutlet NSTabViewItem *releaseNotesTabViewItem;
@property (nonatomic, retain) IBOutlet NSButton *dnscryptButton;
@property (nonatomic, retain) IBOutlet NSButton *opendnsButton;
@property (nonatomic, retain) IBOutlet NSButton *familyShieldButton;
@property (nonatomic, retain) IBOutlet NSButton *fallbackButton;
@property (nonatomic, strong) IBOutlet NSButton *dnscryptButton;
@property (nonatomic, strong) IBOutlet NSButton *opendnsButton;
@property (nonatomic, strong) IBOutlet NSButton *familyShieldButton;
@property (nonatomic, strong) IBOutlet NSButton *fallbackButton;
@property (nonatomic, retain) IBOutlet NSTextField *currentResolverTextField;
@property (nonatomic, retain) IBOutlet NSImageView *statusImageView;
@property (nonatomic, retain) IBOutlet NSTextField *statusText;
@property (nonatomic, retain) IBOutlet WebView *previewNotesWebView;
@property (nonatomic, retain) IBOutlet WebView *releaseNotesWebView;
@property (nonatomic, retain) IBOutlet WebView *feedbackWebView;
@property (nonatomic, retain) IBOutlet WebView *aboutWebView;
@property (nonatomic, retain) IBOutlet NSTextFieldCell *staticResolversTextField;
@property (nonatomic, retain) IBOutlet NSTextField *blacklistIPsTextField;
@property (nonatomic, retain) IBOutlet NSTextField *blacklistDomainsTextField;
@property (nonatomic, retain) IBOutlet NSTextField *exceptionsTextField;
@property (nonatomic, retain) IBOutlet WebView *helpWebView;
@property (nonatomic, retain) IBOutlet NSButton *viewLogButton;
@property (nonatomic, retain) IBOutlet NSButton *queryLoggingButton;
@property (nonatomic, strong) IBOutlet NSTextField *currentResolverTextField;
@property (nonatomic, strong) IBOutlet NSImageView *statusImageView;
@property (nonatomic, strong) IBOutlet NSTextField *statusText;
@property (nonatomic, strong) IBOutlet WebView *previewNotesWebView;
@property (nonatomic, strong) IBOutlet WebView *releaseNotesWebView;
@property (nonatomic, strong) IBOutlet WebView *aboutWebView;
@property (nonatomic, strong) IBOutlet NSTextFieldCell *staticResolversTextField;
@property (nonatomic, strong) IBOutlet NSTextField *blacklistIPsTextField;
@property (nonatomic, strong) IBOutlet NSTextField *blacklistDomainsTextField;
@property (nonatomic, strong) IBOutlet NSTextField *exceptionsTextField;
@property (nonatomic, strong) IBOutlet WebView *helpWebView;
@property (nonatomic, strong) IBOutlet NSButton *viewLogButton;
@property (nonatomic, strong) IBOutlet NSButton *queryLoggingButton;
- (void) mainViewDidLoad;
+6 -32
View File
@@ -14,7 +14,6 @@
@synthesize releaseNotesTabViewItem = _releaseNotesTabViewItem;
@synthesize previewNotesWebView = _previewNotesWebView;
@synthesize releaseNotesWebView = _releaseNotesWebView;
@synthesize feedbackWebView = _feedbackWebView;
@synthesize aboutWebView = _aboutWebView;
@synthesize staticResolversTextField = _staticResolversTextField;
@synthesize blacklistIPsTextField = _blacklistIPsTextField;
@@ -53,9 +52,7 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN;
[task launch];
data = [[pipe fileHandleForReading] readDataToEndOfFile];
[task waitUntilExit];
[task release];
[pipe release];
result = [[[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding] autorelease];
result = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
if ([result hasSuffix: @"\n"]) {
result = [result substringToIndex: result.length - 1];
}
@@ -114,19 +111,19 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN;
switch (currentState) {
case kDNS_CONFIGURATION_UNKNOWN:
_statusText.stringValue = NSLocalizedString(@"No network", @"Status");
_statusImageView.image = [[[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"shield_red.png"]] autorelease];
_statusImageView.image = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"shield_red.png"]];
break;
case kDNS_CONFIGURATION_VANILLA:
_statusText.stringValue = NSLocalizedString(@"Unprotected", @"Status");
_statusImageView.image = [[[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"shield_red.png"]] autorelease];
_statusImageView.image = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"shield_red.png"]];
break;
case kDNS_CONFIGURATION_OPENDNS:
_statusText.stringValue = NSLocalizedString(@"Unencrypted", @"Status");
_statusImageView.image = [[[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"shield_yellow.png"]] autorelease];
_statusImageView.image = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"shield_yellow.png"]];
break;
case kDNS_CONFIGURATION_LOCALHOST:
_statusText.stringValue = NSLocalizedString(@"Protected", @"Status");
_statusImageView.image = [[[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"shield_green.png"]] autorelease];
_statusImageView.image = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"shield_green.png"]];
break;
default:
return;
@@ -175,7 +172,7 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN;
[self setCheckBoxesEnabled: FALSE];
_statusText.stringValue = NSLocalizedString(@"Updating", @"Updating network configuraiton");
_statusImageView.image = [[[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"ajax-loader.gif"]] autorelease];
_statusImageView.image = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"ajax-loader.gif"]];
_currentResolverTextField.stringValue = @"";
[self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-c", @"cd '" kDNSCRIPT_SCRIPTS_BASE_DIR @"' && exec ./gui-push-conf-change.sh menubar", nil]];
@@ -292,18 +289,6 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN;
[self performSelector: @selector(waitForUpdate) withObject: self afterDelay:kREFRESH_DELAY];
}
- (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
if (sender != _feedbackWebView) {
return;
}
NSString *res;
res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-c", @"/usr/local/sbin/dnscrypt-proxy --version | head -n 1", nil]];
NSCharacterSet *charset = [NSCharacterSet characterSetWithCharactersInString: @"\r\n<>'"];
res = [[res componentsSeparatedByCharactersInSet: charset] componentsJoinedByString: @" "];
NSString *script = [NSString stringWithFormat: @"document.querySelector('textarea[name=feedback]').value='\\n\\n\\n--\\nOpenDNS user interface for OSX " kDNSCRYPT_PACKAGE_VERSION "\\n%@'", res];
[sender stringByEvaluatingJavaScriptFromString: script];
}
- (void) mainViewDidLoad
{
currentState = kDNS_CONFIGURATION_UNKNOWN;
@@ -314,7 +299,6 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN;
NSString *version = kDNSCRYPT_PACKAGE_VERSION;
NSString *softwareBlurbFormat = NSLocalizedString(@"This software (v: %@) encrypts and authenticates DNS packets between your computer and OpenDNS. This prevents man-in-the-middle attacks and snooping of DNS traffic by ISPs or others.", @"Description of what the package does - %@ is replaced by the version number");
NSString *provideFeedback = NSLocalizedString(@"Please help by providing feedback!", @"Ask for feedback");
NSString *describePorts = NSLocalizedString(@"DNSCrypt can use UDP and TCP ports 53 and 443.", @"Describe what ports DNSCrypt uses");
NSString *describeFallback = NSLocalizedString(@"If you prefer reliability over security, enable fallback to insecure DNS.", @"Describe what the 'fallback to insecure mode' checkbox does");
@@ -322,9 +306,6 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN;
[htmlString appendFormat: softwareBlurbFormat, version];
[htmlString appendString: @"<br/><br/>"];
[htmlString appendString: @"<strong>"];
[htmlString appendString: provideFeedback];
[htmlString appendString: @"</strong>"];
[htmlString appendString: @"<ul style=\"list-style-position: inside; list-style-type: square; padding-left: 0px; margin-top: 0; margin-bottom: 0; \">"];
[htmlString appendFormat: @"<li>%@</li>", describePorts];
[htmlString appendFormat: @"<li>%@</li>", describeFallback];
@@ -332,13 +313,6 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN;
[htmlString appendString: @"</body></html>"];
[[_previewNotesWebView mainFrame] loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"file:///"]];
[_feedbackWebView setDrawsBackground:false];
[_feedbackWebView setShouldUpdateWhileOffscreen:true];
[_feedbackWebView setUIDelegate:self];
[_feedbackWebView setFrameLoadDelegate: self];
NSString *feedbackURLText = @"http://dnscrypt.opendns.com/feedback.php";
[[_feedbackWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:feedbackURLText]]];
SInt32 OSXversionMajor, OSXversionMinor;
if (Gestalt(gestaltSystemVersionMajor, &OSXversionMajor) != noErr || Gestalt(gestaltSystemVersionMinor, &OSXversionMinor) != noErr || OSXversionMajor < 10 || OSXversionMinor < 6) {
return;
File diff suppressed because it is too large Load Diff
@@ -21,6 +21,13 @@
%body
%h1 Release Notes for the user interface
%article
%h2 Version 0.21 by AlterStep
%time Thu, 17 Apr 2014
%ul
%li Mavericks support
%li dnscrypt-proxy 1.4.0
%article
%h2 Version 0.19
%time Wed, 10 Oct 2012
@@ -1,28 +1,38 @@
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<meta charset='utf-8'>
<title>Release notes for the user interface</title>
<style type='text/css'>
body {
font-family: arial, helvetica, sans-serif;
margin: 0; }
h1, h2 {
margin: 0; }
h1 {
border-bottom: 1px solid grey; }
article {
padding-left: 1em; }
time {
font-style: italic; }
<style>
body {
font-family: arial, helvetica, sans-serif;
margin: 0; }
h1, h2 {
margin: 0; }
h1 {
border-bottom: 1px solid grey; }
article {
padding-left: 1em; }
time {
font-style: italic; }
</style>
</style>
</head>
<body>
<h1>Release Notes for the user interface</h1>
<article>
<h2>Version 0.21 by AlterStep</h2>
<time>Thu, 17 Apr 2014</time>
<ul>
<li>Mavericks support</li>
<li>dnscrypt-proxy 1.4.0</li>
</ul>
</article>
<article>
<h2>Version 0.19</h2>
<time>Wed, 10 Oct 2012</time>
Binary file not shown.
@@ -37,6 +37,9 @@ INTERFACE_PROXY_MASK="24"
INTERFACE_PROBES="127.0.0.55"
INTERFACE_PROBES_MASK="24"
PROVIDER_NAME='2.dnscrypt-cert.opendns.com'
PROVIDER_KEY='B735:1140:206F:225D:3E2B:D822:D7FD:691E:A1C3:3CC8:D666:8D0C:BE04:BFAB:CA43:FB79'
DOMAINS_EXCEPTIONS='
freebox.fr fritz.box intranet lan localdomain nowtv.com private routerlogin.net l
'
@@ -32,6 +32,7 @@ try_resolver() {
rm -f "${RES_DIR}/${priority}"
exec alarmer 3 dnscrypt-proxy --pid="$pid_file" \
--provider-name="$PROVIDER_NAME" --provider-key="$PROVIDER_KEY" \
--local-address="${INTERFACE_PROBES}:${priority}" $args 2>&1 | \
while read line; do
case "$line" in
@@ -135,6 +136,7 @@ fi
best_args=$(cat "${RES_DIR}/${best_file}")
eval dnscrypt-proxy $best_args --local-address="$INTERFACE_PROXY" \
--provider-name="$PROVIDER_NAME" --provider-key="$PROVIDER_KEY" \
--pidfile="$PROXY_PID_FILE" --user=daemon --daemonize $plugin_args
if [ $? != 0 ]; then
@@ -146,6 +148,7 @@ if [ $? != 0 ]; then
killall -9 dnscrypt-proxy
sleep 1
eval dnscrypt-proxy $best_args --local-address="$INTERFACE_PROXY" \
--provider-name="$PROVIDER_NAME" --provider-key="$PROVIDER_KEY" \
--pidfile="$PROXY_PID_FILE" --user=daemon --daemonize $plugin_args || \
exit 1
fi