Ver Fonte

Add AppleScript to get authentication token and place in home directory, used for OSX GUI app to authenticate a user as authorized to admin ZT1.

Adam Ierymenko há 11 anos atrás
pai
commit
0adc91d6cb

+ 50 - 0
ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleAllowMixedLocalizations</key>
+	<true/>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>applet</string>
+	<key>CFBundleIconFile</key>
+	<string>applet</string>
+	<key>CFBundleIdentifier</key>
+	<string>com.zerotier.one.ZeroTierOneMacAuthenticateScript</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>ZeroTier One (Authenticate)</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleSignature</key>
+	<string>aplt</string>
+	<key>LSMinimumSystemVersionByArchitecture</key>
+	<dict>
+		<key>x86_64</key>
+		<string>10.6</string>
+	</dict>
+	<key>LSRequiresCarbon</key>
+	<true/>
+	<key>NSHumanReadableCopyright</key>
+	<string>(c) 2013 ZeroTier Networks LLC</string>
+	<key>WindowState</key>
+	<dict>
+		<key>dividerCollapsed</key>
+		<false/>
+		<key>eventLogLevel</key>
+		<integer>-1</integer>
+		<key>name</key>
+		<string>ScriptWindowState</string>
+		<key>positionOfDivider</key>
+		<real>333</real>
+		<key>savedFrame</key>
+		<string>7 181 602 597 0 0 1280 778 </string>
+		<key>selectedTabView</key>
+		<string>result</string>
+	</dict>
+</dict>
+</plist>

BIN
ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet


+ 1 - 0
ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/PkgInfo

@@ -0,0 +1 @@
+APPLaplt

BIN
ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/Scripts/main.scpt


BIN
ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.icns


BIN
ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.rsrc


+ 4 - 0
ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/description.rtfd/TXT.rtf

@@ -0,0 +1,4 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1265
+{\fonttbl}
+{\colortbl;\red255\green255\blue255;}
+}

+ 23 - 0
ZeroTierUI/mainwindow.cpp

@@ -2,7 +2,30 @@
 #include "aboutwindow.h"
 #include "ui_mainwindow.h"
 
+#include <string>
+#include <map>
+#include <vector>
+
 #include <QClipboard>
+#include <QMutex>
+
+static std::map< unsigned long,std::vector<std::string> > ztReplies;
+static QMutex ztReplies_m;
+static void handleZTMessage(void *arg,unsigned long id,const char *line)
+{
+	ztReplies_m.lock();
+	if (*line) {
+		ztReplies[id].push_back(std::string(line));
+		ztReplies_m.unlock();
+	} else {
+		std::vector<std::string> resp(ztReplies[id]);
+		ztReplies.erase(id);
+		ztReplies_m.unlock();
+	}
+}
+
+// Globally visible
+ZeroTier::Node::LocalClient *zeroTierClient = (ZeroTier::Node::LocalClient *)0;
 
 MainWindow::MainWindow(QWidget *parent) :
 	QMainWindow(parent),

+ 6 - 0
ZeroTierUI/mainwindow.h

@@ -3,10 +3,16 @@
 
 #include <QMainWindow>
 
+#include "../node/Node.hpp"
+
 namespace Ui {
 class MainWindow;
 }
 
+// Globally visible instance of local client for communicating with ZT1
+// Can be null if not connected, or will point to current
+extern ZeroTier::Node::LocalClient *zeroTierClient;
+
 class MainWindow : public QMainWindow
 {
 	Q_OBJECT