GitHub issue #241 -- and also some appearance updates. Eventually this might get replaced by a native Mac app.

This commit is contained in:
Adam Ierymenko 2015-11-16 14:30:25 -08:00
parent 637d50a9de
commit 220552af62
14 changed files with 129 additions and 535 deletions

View file

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>14E46</string>
<string>15B42</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
@ -22,26 +22,35 @@
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6E35b</string>
<string>7B1005</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<string>15A278</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0640</string>
<string>0711</string>
<key>DTXcodeBuild</key>
<string>6E35b</string>
<string>7B1005</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>10.7</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

View file

@ -30,7 +30,7 @@
<dict>
<key>hash</key>
<data>
kkFJZm0JXF9gTUF2keyMJQ9p9SY=
8JZXf4/3df3LD+o74Y8WM0dV8io=
</data>
<key>optional</key>
<true/>
@ -39,7 +39,7 @@
<dict>
<key>hash</key>
<data>
42zB9+COYMmPW0WlnU1juN2B9SA=
7dgumnPDtoIzhi9QoaFhDvCo9ys=
</data>
<key>optional</key>
<true/>
@ -73,7 +73,7 @@
<dict>
<key>hash</key>
<data>
kkFJZm0JXF9gTUF2keyMJQ9p9SY=
8JZXf4/3df3LD+o74Y8WM0dV8io=
</data>
<key>optional</key>
<true/>
@ -82,7 +82,7 @@
<dict>
<key>hash</key>
<data>
42zB9+COYMmPW0WlnU1juN2B9SA=
7dgumnPDtoIzhi9QoaFhDvCo9ys=
</data>
<key>optional</key>
<true/>

View file

@ -269,7 +269,7 @@
FAE451B114BA79C600190544 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
LastUpgradeCheck = 0710;
ORGANIZATIONNAME = Twitter;
};
buildConfigurationList = FAE451B414BA79C600190544 /* Build configuration list for PBXProject "MacGap" */;
@ -374,9 +374,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@ -402,7 +402,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@ -434,6 +433,7 @@
GCC_VERSION = "";
INFOPLIST_FILE = "MacGap/MacGap-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_BUNDLE_IDENTIFIER = "com.zerotier.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "ZeroTier One";
SDKROOT = macosx;
WRAPPER_EXTENSION = app;
@ -455,6 +455,7 @@
GCC_VERSION = "";
INFOPLIST_FILE = "MacGap/MacGap-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_BUNDLE_IDENTIFIER = "com.zerotier.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "ZeroTier One";
SDKROOT = macosx;
WRAPPER_EXTENSION = app;

View file

@ -32,6 +32,7 @@
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification {
char buf[16384],userAuthTokenPath[4096];
struct stat systemAuthTokenStat,userAuthTokenStat;
FILE *pf = fopen("/Library/Application Support/ZeroTier/One/zerotier-one.port","r");
long port = 9993; // default
@ -50,14 +51,27 @@
const char *homeDir = getenv("HOME");
if (homeDir) {
snprintf(userAuthTokenPath,sizeof(userAuthTokenPath),"%s/Library/Application Support/ZeroTier/One/authtoken.secret",homeDir);
pf = fopen(userAuthTokenPath,"r");
if (pf) {
long n = fread(buf,1,sizeof(buf)-1,pf);
if (n > 0) {
buf[n] = (char)0;
snprintf(url,sizeof(url),"http://127.0.0.1:%ld/index.html?authToken=%s",port,buf);
bool userAuthTokenOutOfDate = false;
memset(&systemAuthTokenStat,0,sizeof(systemAuthTokenStat));
memset(&userAuthTokenStat,0,sizeof(userAuthTokenStat));
if (stat("/Library/Application Support/ZeroTier/One/authtoken.secret",&systemAuthTokenStat) == 0) {
if (stat(userAuthTokenPath,&userAuthTokenStat) == 0) {
if (userAuthTokenStat.st_mtimespec.tv_sec < systemAuthTokenStat.st_mtimespec.tv_sec)
userAuthTokenOutOfDate = true;
}
}
if (!userAuthTokenOutOfDate) {
pf = fopen(userAuthTokenPath,"r");
if (pf) {
long n = fread(buf,1,sizeof(buf)-1,pf);
if (n > 0) {
buf[n] = (char)0;
snprintf(url,sizeof(url),"http://127.0.0.1:%ld/index.html?authToken=%s",port,buf);
}
fclose(pf);
}
fclose(pf);
}
}

View file

@ -39,11 +39,11 @@
[self.webView setApplicationNameForUserAgent: @"MacGap"];
self.delegate = [[WebViewDelegate alloc] initWithMenu:[NSApp mainMenu]];
[self.webView setFrameLoadDelegate:self.delegate];
[self.webView setUIDelegate:self.delegate];
[self.webView setResourceLoadDelegate:self.delegate];
[self.webView setDownloadDelegate:self.delegate];
[self.webView setPolicyDelegate:self.delegate];
// [self.webView setFrameLoadDelegate:self.delegate];
// [self.webView setUIDelegate:self.delegate];
// [self.webView setResourceLoadDelegate:self.delegate];
// [self.webView setDownloadDelegate:self.delegate];
// [self.webView setPolicyDelegate:self.delegate];
[self.webView setDrawsBackground:NO];
[self.webView setShouldCloseWithWindow:NO];

View file

@ -2,14 +2,14 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIconFile</key>
<string>ZeroTierIcon</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>ZeroTier One</string>
<key>CFBundleIconFile</key>
<string>ZeroTierIcon</string>
<key>CFBundleIdentifier</key>
<string>com.zerotier.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@ -30,5 +30,10 @@
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>

View file

@ -1,337 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11C74</string>
<string key="IBDocument.InterfaceBuilderVersion">1938</string>
<string key="IBDocument.AppKitVersion">1138.23</string>
<string key="IBDocument.HIToolboxVersion">567.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>1938</string>
<string>822</string>
</object>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSWindowTemplate</string>
<string>NSView</string>
<string>NSCustomObject</string>
<string>WebView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
<string key="NSClassName">WindowController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="1005">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{196, 240}, {758, 410}}</string>
<int key="NSWTFlags">544735232</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="1006">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="WebView" id="807146547">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">274</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple HTML pasteboard type</string>
<string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
<string>Apple URL pasteboard type</string>
<string>Apple Web Archive pasteboard type</string>
<string>NSColor pasteboard type</string>
<string>NSFilenamesPboardType</string>
<string>NSStringPboardType</string>
<string>NeXT RTFD pasteboard type</string>
<string>NeXT Rich Text Format v1.0 pasteboard type</string>
<string>NeXT TIFF v4.0 pasteboard type</string>
<string>WebURLsWithTitlesPboardType</string>
<string>public.png</string>
<string>public.url</string>
<string>public.url-name</string>
</object>
</object>
<string key="NSFrameSize">{758, 410}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
<string key="NSReuseIdentifierKey">_NS:51</string>
<string key="FrameName"/>
<string key="GroupName"/>
<object class="WebPreferences" key="Preferences">
<string key="Identifier"/>
<object class="NSMutableDictionary" key="Values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>WebKitDefaultFixedFontSize</string>
<string>WebKitDefaultFontSize</string>
<string>WebKitMinimumFontSize</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="12"/>
<integer value="12"/>
<integer value="1"/>
</object>
</object>
</object>
<bool key="UseBackForwardList">YES</bool>
<bool key="AllowsUndo">YES</bool>
</object>
</object>
<string key="NSFrameSize">{758, 410}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="807146547"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<int key="NSWindowCollectionBehavior">128</int>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">contentView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1006"/>
</object>
<int key="connectionID">23</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1005"/>
</object>
<int key="connectionID">25</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">title: contentView.webView.mainFrameTitle</string>
<reference key="source" ref="1005"/>
<reference key="destination" ref="1001"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="1005"/>
<reference key="NSDestination" ref="1001"/>
<string key="NSLabel">title: contentView.webView.mainFrameTitle</string>
<string key="NSBinding">title</string>
<string key="NSKeyPath">contentView.webView.mainFrameTitle</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">31</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">webView</string>
<reference key="source" ref="1006"/>
<reference key="destination" ref="807146547"/>
</object>
<int key="connectionID">19</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="1002">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="1002"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="1002"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="1002"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="1005"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1006"/>
</object>
<reference key="parent" ref="1002"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="1006"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="807146547"/>
</object>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="807146547"/>
<reference key="parent" ref="1006"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>1.IBPluginDependency</string>
<string>1.IBWindowTemplateEditedContentRect</string>
<string>1.NSWindowTemplate.visibleAtLaunch</string>
<string>2.CustomClassName</string>
<string>2.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{357, 418}, {480, 270}}</string>
<integer value="1"/>
<string>ContentView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="1002"/>
<reference key="dict.values" ref="1002"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="1002"/>
<reference key="dict.values" ref="1002"/>
</object>
<nil key="sourceID"/>
<int key="maxID">31</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ContentView</string>
<string key="superclassName">NSView</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">webView</string>
<string key="NS.object.0">WebView</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">webView</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">webView</string>
<string key="candidateClassName">WebView</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ContentView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">WebView</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">reloadFromOrigin:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">reloadFromOrigin:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">reloadFromOrigin:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/WebView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">WindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">contentView</string>
<string key="NS.object.0">ContentView</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">contentView</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">contentView</string>
<string key="candidateClassName">ContentView</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/WindowController.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="9060"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="WindowController">
<connections>
<outlet property="contentView" destination="2" id="23"/>
<outlet property="window" destination="1" id="25"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" animationBehavior="default" id="1">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<rect key="contentRect" x="575" y="564" width="500" height="700"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/>
<value key="minSize" type="size" width="500" height="700"/>
<value key="maxSize" type="size" width="500" height="700"/>
<view key="contentView" id="2" customClass="ContentView">
<rect key="frame" x="0.0" y="0.0" width="500" height="700"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<webView id="5">
<rect key="frame" x="0.0" y="0.0" width="500" height="700"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12"/>
</webView>
</subviews>
<animations/>
<connections>
<outlet property="webView" destination="5" id="19"/>
</connections>
</view>
<connections>
<binding destination="-2" name="title" keyPath="contentView.webView.mainFrameTitle" id="31"/>
</connections>
</window>
</objects>
</document>

View file

@ -4,19 +4,17 @@ var ZeroTierNetwork = React.createClass({
},
leaveNetwork: function(event) {
if (confirm("Are you sure you want to leave this network?")) {
Ajax.call({
url: 'network/'+this.props.nwid+'?auth='+this.props.authToken,
cache: false,
type: 'DELETE',
success: function(data) {
if (this.props.onNetworkDeleted)
this.props.onNetworkDeleted(this.props.nwid);
}.bind(this),
error: function(error) {
}.bind(this)
});
}
Ajax.call({
url: 'network/'+this.props.nwid+'?auth='+this.props.authToken,
cache: false,
type: 'DELETE',
success: function(data) {
if (this.props.onNetworkDeleted)
this.props.onNetworkDeleted(this.props.nwid);
}.bind(this),
error: function(error) {
}.bind(this)
});
event.preventDefault();
},

View file

@ -122,7 +122,6 @@ var ZeroTierNode = React.createClass({
},
componentDidMount: function() {
this.tabIndex = 0;
this.updateAll();
this.updateIntervalId = setInterval(this.updateAll,2500);
},
@ -130,74 +129,19 @@ var ZeroTierNode = React.createClass({
clearInterval(this.updateIntervalId);
},
render: function() {
/* We implement tabs in a very simple way here with a React JSX conditional. The tabIndex
* local variable indicates the tab, and switching it determines which set of things we
* render in the main middle portion. On tab switch calls forceUpdate(). */
return (
<div className="zeroTierNode">
<div className="top">&nbsp;&nbsp;
<button disabled={this.tabIndex === 0} onClick={function() {this.tabIndex = 0; this.forceUpdate();}.bind(this)}>Networks</button>
<button disabled={this.tabIndex === 1} onClick={function() {this.tabIndex = 1; this.forceUpdate();}.bind(this)}>Peers</button>
</div>
<div className="middle"><div className="middleCell">
<div className="middleScroll">
{
(this.tabIndex === 1) ? (
<div className="peers" key="_peers">
<div className="peerHeader" key="_peersHeader">
<div className="f">Address</div>
<div className="f">Version</div>
<div className="f">Latency</div>
<div className="f">Data&nbsp;Paths</div>
<div className="f">Last&nbsp;Unicast</div>
<div className="f">Last&nbsp;Multicast</div>
<div className="f">Role</div>
</div>
{
this.state._peers.map(function(peer) {
return (
<div className="peer" key={peer['address']}>
<div className="f zeroTierAddress">{peer['address']}</div>
<div className="f">{(peer['version'] === '-1.-1.-1') ? '-' : peer['version']}</div>
<div className="f">{peer['latency']}</div>
<div className="f">
{
(peer['paths'].length === 0) ? (
<div className="peerPath"></div>
) : (
<div>
{
peer['paths'].map(function(path) {
var cn = ((path.active)||(path.fixed)) ? (path.preferred ? 'peerPathPreferred' : 'peerPathActive') : 'peerPathInactive';
return (
<div className={cn}>{path.address}&nbsp;&nbsp;{this.ago(path.lastSend)}/{this.ago(path.lastReceive)}</div>
);
}.bind(this))
}
</div>
)
}
</div>
<div className="f">{this.ago(peer['lastUnicastFrame'])}</div>
<div className="f">{this.ago(peer['lastMulticastFrame'])}</div>
<div className="f">{peer['role']}</div>
</div>
);
}.bind(this))
}
</div>
) : (
<div className="networks" key="_networks">
{
this.state._networks.map(function(network) {
network['authToken'] = this.props.authToken;
network['onNetworkDeleted'] = this.handleNetworkDelete;
return React.createElement('div',{className: 'network',key: network.nwid},React.createElement(ZeroTierNetwork,network));
}.bind(this))
}
</div>
)
}
<div className="networks" key="_networks">
{
this.state._networks.map(function(network) {
network['authToken'] = this.props.authToken;
network['onNetworkDeleted'] = this.handleNetworkDelete;
return React.createElement('div',{className: 'network',key: network.nwid},React.createElement(ZeroTierNetwork,network));
}.bind(this))
}
</div>
</div>
</div></div>
<div className="bottom">

View file

@ -25,34 +25,6 @@ html,body {
display: table;
}
.zeroTierNode > .top {
width: 100%;
overflow: hidden;
display: table-row;
white-space: nowrap;
background: #234447;
color: #ffffff;
padding: 0;
margin: 0;
}
.zeroTierNode > .top button {
display: inline-block;
padding: 0.25rem 0.75rem 0.25rem 0.75rem;
color: #ffffff;
margin: 0;
border: 0;
outline: none;
background: #234447;
font-size: 12pt;
cursor: pointer;
}
.zeroTierNode > .top button:hover {
background: #91a2a3;
}
.zeroTierNode > .top button:disabled {
background: #91a2a3;
}
.zeroTierNode > .middle {
width: 100%;
height: 100%;
@ -65,6 +37,7 @@ html,body {
width: 100%;
height: 100%;
display: table-cell;
border-bottom: 1px solid #000000;
}
.zeroTierNode > .middle > .middleCell > .middleScroll {
display: block;
@ -87,76 +60,19 @@ html,body {
border-collapse: collapse;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .networks > .network {
display: inline-block;
display: block;
border-top: 0.12rem solid #dddddd;
border-bottom: 0.12rem solid #dddddd;
padding: 0.25rem;
margin: 0.25rem 0 0 1%;
min-width: 31%;
max-width: 98%;
border: 1px solid #234447;
background: #ffffff;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers {
display: table;
width: 100%;
margin: 0;
border-collapse: collapse;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers > .peer {
width: 100%;
display: table-row;
background: #ffffff;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers > .peer:nth-child(odd) {
background: #f3f3f3;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers > .peer:nth-child(even) {
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers > .peer .peerPathActive {
font-size: 8pt;
color: #555555;
font-style: italic;
font-family: monospace;
white-space: nowrap;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers > .peer .peerPathPreferred {
font-size: 8pt;
color: #000000;
font-family: monospace;
white-space: nowrap;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers > .peer .peerPathInactive {
font-size: 8pt;
font-family: monospace;
color: #aaaaaa;
font-style: italic;
text-decoration: line-through;
white-space: nowrap;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers > .peer > .f {
display: table-cell;
padding: 0.05rem 0.15rem 0.05rem 0.15rem;
font-size: 8pt;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers > .peerHeader {
width: 100%;
font-size: 8pt;
display: table-row;
background: #ffffff;
border-bottom: 1px solid #000000;
}
.zeroTierNode > .middle > .middleCell > .middleScroll > .peers > .peerHeader > .f {
display: table-cell;
font-size: 8pt;
padding: 0.05rem 0.15rem 0.05rem 0.15rem;
font-weight: bold;
}
.zeroTierNode > .bottom {
font-size: 12pt;
width: 100%;
overflow: hidden;
display: table-row;
background: #234447;
background: #000000;
color: #ffffff;
}
.zeroTierNode > .bottom > .left {
@ -233,7 +149,7 @@ html,body {
.zeroTierNetwork .networkInfo .networkId {
font-size: 11pt;
font-family: monospace;
color: #91a2a3;
color: #000000;
}
.zeroTierNetwork .networkInfo .networkName {
padding: 0 0 0 1rem;
@ -271,7 +187,7 @@ html,body {
.zeroTierNetwork .leaveNetworkButton {
padding: 0.25rem 0.5rem 0.25rem 0.5rem;
margin: 0.25rem 0 0 0;
font-size: 10pt;
font-size: 9pt;
background: #ffffff;
outline: none;
background: #ffb354;

2
ui/ztui.min.js vendored

File diff suppressed because one or more lines are too long