From 0adc91d6cb40e185de972b5fa588ac9607e1ac74 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 18 Nov 2013 15:06:05 -0500 Subject: 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. --- .../Contents/Info.plist | 50 +++++++++++++++++++++ .../Contents/MacOS/applet | Bin 0 -> 25028 bytes .../Contents/PkgInfo | 1 + .../Contents/Resources/Scripts/main.scpt | Bin 0 -> 1768 bytes .../Contents/Resources/applet.icns | Bin 0 -> 71867 bytes .../Contents/Resources/applet.rsrc | Bin 0 -> 362 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 ++ ZeroTierUI/mainwindow.cpp | 23 ++++++++++ ZeroTierUI/mainwindow.h | 6 +++ 9 files changed, 84 insertions(+) create mode 100644 ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist create mode 100755 ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet create mode 100644 ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/PkgInfo create mode 100644 ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/Scripts/main.scpt create mode 100644 ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.icns create mode 100644 ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.rsrc create mode 100644 ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist new file mode 100644 index 00000000..0f32d0ef --- /dev/null +++ b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist @@ -0,0 +1,50 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleIdentifier + com.zerotier.one.ZeroTierOneMacAuthenticateScript + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ZeroTier One (Authenticate) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + NSHumanReadableCopyright + (c) 2013 ZeroTier Networks LLC + WindowState + + dividerCollapsed + + eventLogLevel + -1 + name + ScriptWindowState + positionOfDivider + 333 + savedFrame + 7 181 602 597 0 0 1280 778 + selectedTabView + result + + + diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet new file mode 100755 index 00000000..8057b9e3 Binary files /dev/null and b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet differ diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/PkgInfo b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/PkgInfo new file mode 100644 index 00000000..3253614c --- /dev/null +++ b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/Scripts/main.scpt b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/Scripts/main.scpt new file mode 100644 index 00000000..cb578574 Binary files /dev/null and b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/Scripts/main.scpt differ diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.icns b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.icns new file mode 100644 index 00000000..0cdd1708 Binary files /dev/null and b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.icns differ diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.rsrc b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.rsrc new file mode 100644 index 00000000..a528ee8a Binary files /dev/null and b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/applet.rsrc differ diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/description.rtfd/TXT.rtf b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100644 index 00000000..09700b2f --- /dev/null +++ b/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;} +} \ No newline at end of file diff --git a/ZeroTierUI/mainwindow.cpp b/ZeroTierUI/mainwindow.cpp index bb2c263b..d96ab207 100644 --- a/ZeroTierUI/mainwindow.cpp +++ b/ZeroTierUI/mainwindow.cpp @@ -2,7 +2,30 @@ #include "aboutwindow.h" #include "ui_mainwindow.h" +#include +#include +#include + #include +#include + +static std::map< unsigned long,std::vector > 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 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), diff --git a/ZeroTierUI/mainwindow.h b/ZeroTierUI/mainwindow.h index b68ba4f7..f41e527b 100644 --- a/ZeroTierUI/mainwindow.h +++ b/ZeroTierUI/mainwindow.h @@ -3,10 +3,16 @@ #include +#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 -- cgit v1.2.3