summaryrefslogtreecommitdiff
path: root/ZeroTierUI
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-03 15:39:09 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-03 15:39:09 -0800
commit59b1623477e7cd9081d3cf75ea3fa0411214d58f (patch)
treee8b37f673d23b45cbe7a63ec5360a0a627d9820f /ZeroTierUI
parent22b52858e04c25709081251300fed6cdc42810be (diff)
downloadinfinitytier-59b1623477e7cd9081d3cf75ea3fa0411214d58f.tar.gz
infinitytier-59b1623477e7cd9081d3cf75ea3fa0411214d58f.zip
More install/deploy work for mac...
Diffstat (limited to 'ZeroTierUI')
-rw-r--r--ZeroTierUI/ZeroTierUI.pro14
-rw-r--r--ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist2
-rw-r--r--ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Resources/Scripts/main.scptbin1768 -> 2214 bytes
-rw-r--r--ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Info.plist2
-rw-r--r--ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Resources/Scripts/main.scptbin2818 -> 3946 bytes
-rw-r--r--ZeroTierUI/mainwindow.cpp53
-rw-r--r--ZeroTierUI/mainwindow.h6
7 files changed, 51 insertions, 26 deletions
diff --git a/ZeroTierUI/ZeroTierUI.pro b/ZeroTierUI/ZeroTierUI.pro
index 082477ca..1b735553 100644
--- a/ZeroTierUI/ZeroTierUI.pro
+++ b/ZeroTierUI/ZeroTierUI.pro
@@ -37,9 +37,9 @@ SOURCES += main.cpp\
../node/Topology.cpp \
../node/UdpSocket.cpp \
../node/Utils.cpp \
- ../ext/lz4/lz4.c \
- ../ext/lz4/lz4hc.c \
- networkwidget.cpp
+ ../ext/lz4/lz4.c \
+ ../ext/lz4/lz4hc.c \
+ networkwidget.cpp
HEADERS += mainwindow.h \
aboutwindow.h \
@@ -86,13 +86,13 @@ HEADERS += mainwindow.h \
../node/Thread.hpp \
../node/Topology.hpp \
../node/UdpSocket.hpp \
- ../ext/lz4/lz4.h \
- ../ext/lz4/lz4hc.h \
- networkwidget.h
+ ../ext/lz4/lz4.h \
+ ../ext/lz4/lz4hc.h \
+ networkwidget.h
FORMS += mainwindow.ui \
aboutwindow.ui \
- networkwidget.ui
+ networkwidget.ui
RESOURCES += \
resources.qrc
diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist
index ca85986a..c658bc21 100644
--- a/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist
+++ b/ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/Info.plist
@@ -44,7 +44,7 @@
<key>positionOfDivider</key>
<real>333</real>
<key>savedFrame</key>
- <string>36 164 602 597 0 0 1280 778 </string>
+ <string>239 124 602 597 0 0 1280 778 </string>
<key>selectedTabView</key>
<string>event log</string>
</dict>
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
index cb578574..5707e8e4 100644
--- 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
Binary files differ
diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Info.plist b/ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Info.plist
index 2c45edac..11315644 100644
--- a/ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Info.plist
+++ b/ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Info.plist
@@ -42,7 +42,7 @@
<key>positionOfDivider</key>
<real>333</real>
<key>savedFrame</key>
- <string>265 106 602 597 0 0 1280 778 </string>
+ <string>68 169 602 597 0 0 1280 778 </string>
<key>selectedTabView</key>
<string>event log</string>
</dict>
diff --git a/ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Resources/Scripts/main.scpt b/ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Resources/Scripts/main.scpt
index 6aff34e8..af0d80f5 100644
--- a/ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Resources/Scripts/main.scpt
+++ b/ZeroTierUI/helpers/mac/ZeroTier One (Install).app/Contents/Resources/Scripts/main.scpt
Binary files differ
diff --git a/ZeroTierUI/mainwindow.cpp b/ZeroTierUI/mainwindow.cpp
index 4028b789..521868cc 100644
--- a/ZeroTierUI/mainwindow.cpp
+++ b/ZeroTierUI/mainwindow.cpp
@@ -23,6 +23,8 @@
#include <QScrollBar>
#include <QEventLoop>
+QNetworkAccessManager *nam;
+
// Globally visible
ZeroTier::Node::LocalClient *zeroTierClient = (ZeroTier::Node::LocalClient *)0;
@@ -51,7 +53,8 @@ static void handleZTMessage(void *arg,unsigned long id,const char *line)
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
- ui(new Ui::MainWindow)
+ ui(new Ui::MainWindow),
+ nam(new QNetworkAccessManager(this))
{
ui->setupUi(this);
this->startTimer(1000); // poll service every second
@@ -59,6 +62,8 @@ MainWindow::MainWindow(QWidget *parent) :
mainWindow = this;
this->cyclesSinceResponseFromService = 0;
+ QObject::connect(nam,SIGNAL(finished(QNetworkReply*)),this,SLOT(on_networkReply(QNetworkReply*)));
+
if (ui->networkListWidget->verticalScrollBar())
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
@@ -79,30 +84,40 @@ void MainWindow::timerEvent(QTimerEvent *event)
{
event->accept();
-#ifdef __APPLE__
-#else
-#endif
-
if (!zeroTierClient) {
- std::string dotAuthFile((QDir::homePath() + QDir::separator() + ".zeroTierOneAuthToken").toStdString());
std::string authToken;
- if (!ZeroTier::Utils::readFile(dotAuthFile.c_str(),authToken)) {
+ if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
#ifdef __APPLE__
- // Run the little AppleScript hack that asks for admin credentials and
- // then installs the auth token file in the current user's home.
- QString authHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet");
- if (!QFile::exists(authHelperPath)) {
- // Allow this to also work from the source tree if it's run from there.
- // This is for debugging purposes and shouldn't harm the live release
- // in any way.
- authHelperPath = QCoreApplication::applicationDirPath() + "/../../../../ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet";
+ if (QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
+ // Run the little AppleScript hack that asks for admin credentials and
+ // then installs the auth token file in the current user's home.
+ QString authHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet");
if (!QFile::exists(authHelperPath)) {
- QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate authorization helper, cannot obtain authentication token.",QMessageBox::Ok,QMessageBox::NoButton);
+ // Allow this to also work from the source tree if it's run from there.
+ // This is for debugging purposes and shouldn't harm the live release
+ // in any way.
+ authHelperPath = QCoreApplication::applicationDirPath() + "/../../../../ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet";
+ if (!QFile::exists(authHelperPath)) {
+ QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate authorization helper, cannot obtain authentication token.",QMessageBox::Ok,QMessageBox::NoButton);
+ QApplication::exit(1);
+ return;
+ }
+ }
+ QProcess::execute(authHelperPath,QStringList());
+ } else {
+ // Download the latest version and install it
+ this->setEnabled(false);
+
+ // Run the little AppleScript hack that asks for admin credentials and
+ // then installs the auth token file in the current user's home.
+ QString installHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Install).app/Contents/MacOS/applet");
+ if (!QFile::exists(installHelperPath)) {
+ QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate install helper, cannot install service.",QMessageBox::Ok,QMessageBox::NoButton);
QApplication::exit(1);
return;
}
+ QProcess::execute(installHelperPath,QStringList());
}
- QProcess::execute(authHelperPath,QStringList());
#endif
if (!ZeroTier::Utils::readFile(dotAuthFile.c_str(),authToken)) {
@@ -291,3 +306,7 @@ void MainWindow::on_addressButton_clicked()
{
QApplication::clipboard()->setText(this->myAddress);
}
+
+void MainWindow::on_networkReply(QNetworkReply *reply)
+{
+}
diff --git a/ZeroTierUI/mainwindow.h b/ZeroTierUI/mainwindow.h
index f4ca51b4..d3ec15d8 100644
--- a/ZeroTierUI/mainwindow.h
+++ b/ZeroTierUI/mainwindow.h
@@ -4,6 +4,10 @@
#include <QMainWindow>
#include <QEvent>
#include <QString>
+#include <QNetworkAccessManager>
+#include <QUrl>
+#include <QNetworkRequest>
+#include <QNetworkReply>
#include <map>
#include <vector>
@@ -51,10 +55,12 @@ private slots:
void on_actionAbout_triggered();
void on_networkIdLineEdit_textChanged(const QString &text);
void on_addressButton_clicked();
+ void on_networkReply(QNetworkReply *reply);
private:
Ui::MainWindow *ui;
+ QNetworkAccessManager *nam;
QString myAddress;
QString myStatus;
QString myVersion;