diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-01-08 23:12:03 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-01-08 23:12:03 -0800 |
| commit | 3482d836ae20db67a136795b9495a9f4ffcde934 (patch) | |
| tree | 43c056010ae60e19f6fb1dff0a5fe8ca907226df /ZeroTierUI/mainwindow.cpp | |
| parent | 60731e6d02c4ebeb0700bc1c6a53261159049e01 (diff) | |
| download | infinitytier-3482d836ae20db67a136795b9495a9f4ffcde934.tar.gz infinitytier-3482d836ae20db67a136795b9495a9f4ffcde934.zip | |
Mac install fixes, more internal use scripts.
Diffstat (limited to 'ZeroTierUI/mainwindow.cpp')
| -rw-r--r-- | ZeroTierUI/mainwindow.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/ZeroTierUI/mainwindow.cpp b/ZeroTierUI/mainwindow.cpp index f7d7e399..003b8651 100644 --- a/ZeroTierUI/mainwindow.cpp +++ b/ZeroTierUI/mainwindow.cpp @@ -69,6 +69,19 @@ MainWindow::MainWindow(QWidget *parent) : QWidgetList widgets = this->findChildren<QWidget*>(); foreach(QWidget* widget, widgets) widget->setAttribute(Qt::WA_MacShowFocusRect,false); + +#ifdef __APPLE__ + if (!QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) { + // If the service is not installed, download the installer and run it + // for the first time. + this->setEnabled(false); + InstallDialog *id = new InstallDialog(this); + id->setModal(true); + id->show(); + this->setHidden(true); + return; + } +#endif } MainWindow::~MainWindow() @@ -90,21 +103,15 @@ void MainWindow::timerEvent(QTimerEvent *event) std::string authToken; if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) { #ifdef __APPLE__ - //if (QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) { - if (false) { + 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. + QMessageBox::information(this,"Authorization Required","You must authenticate to authorize this user to\nadministrate ZeroTier One on this computer.\n\n(This only needs to be done once.)",QMessageBox::Ok,QMessageBox::NoButton); 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(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; - } + 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 { |
