mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-23 14:52:24 +00:00
Add security notice the first time a user joins a public network.
This commit is contained in:
parent
7fdca150a9
commit
3f6152806f
@ -45,7 +45,8 @@ SOURCES += main.cpp \
|
||||
../ext/lz4/lz4hc.c \
|
||||
networkwidget.cpp \
|
||||
installdialog.cpp \
|
||||
licensedialog.cpp
|
||||
licensedialog.cpp \
|
||||
onetimedialog.cpp
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
aboutwindow.h \
|
||||
@ -98,14 +99,16 @@ HEADERS += mainwindow.h \
|
||||
installdialog.h \
|
||||
mac_doprivileged.h \
|
||||
licensedialog.h \
|
||||
main.h
|
||||
main.h \
|
||||
onetimedialog.h
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
aboutwindow.ui \
|
||||
networkwidget.ui \
|
||||
installdialog.ui \
|
||||
licensedialog.ui \
|
||||
quickstartdialog.ui
|
||||
quickstartdialog.ui \
|
||||
onetimedialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define MAIN_H
|
||||
|
||||
#include <QSettings>
|
||||
#include <QMainWindow>
|
||||
|
||||
extern QSettings *settings;
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
||||
ZeroTier::Node::LocalClient *zeroTierClient = (ZeroTier::Node::LocalClient *)0;
|
||||
|
||||
// Main window instance for app
|
||||
static MainWindow *mainWindow = (MainWindow *)0;
|
||||
QMainWindow *mainWindow = (MainWindow *)0;
|
||||
|
||||
// Handles message from ZeroTier One service
|
||||
static void handleZTMessage(void *arg,unsigned long id,const char *line)
|
||||
|
@ -51,6 +51,9 @@ class MainWindow;
|
||||
// Can be null if not connected, or will point to current
|
||||
extern ZeroTier::Node::LocalClient *zeroTierClient;
|
||||
|
||||
// Globally visible pointer to main app window
|
||||
extern QMainWindow *mainWindow;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "networkwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui_networkwidget.h"
|
||||
#include "onetimedialog.h"
|
||||
#include "main.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QString>
|
||||
@ -43,7 +45,8 @@
|
||||
NetworkWidget::NetworkWidget(QWidget *parent,const std::string &nwid) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::NetworkWidget),
|
||||
networkIdStr(nwid)
|
||||
networkIdStr(nwid),
|
||||
publicWarningShown(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->networkIdButton->setText(QString(nwid.c_str()));
|
||||
@ -98,9 +101,15 @@ void NetworkWidget::setNetworkType(const std::string &type)
|
||||
ui->networkTypeLabel->setText(QString(type.c_str()));
|
||||
if (type == "?")
|
||||
ui->networkTypeLabel->setStatusTip("Waiting for configuration...");
|
||||
else if (type == "public")
|
||||
else if (type == "public") {
|
||||
if ((!publicWarningShown)&&(!settings->value("shown_publicWarning",false).toBool())) {
|
||||
publicWarningShown = true;
|
||||
OneTimeDialog *d = new OneTimeDialog(mainWindow,"shown_publicWarning","Security Notice","Security Notice:"ZT_EOL_S""ZT_EOL_S"You have joined a public network. Anyone can join these. We recommend making sure that your system's automatic software updates are enabled and turning off any shared network services that you do not want people to access.");
|
||||
d->setModal(false);
|
||||
d->show();
|
||||
}
|
||||
ui->networkTypeLabel->setStatusTip("This network can be joined by anyone in the world.");
|
||||
else if (type == "private")
|
||||
} else if (type == "private")
|
||||
ui->networkTypeLabel->setStatusTip("This network is private; only authorized peers can join.");
|
||||
else ui->networkTypeLabel->setStatusTip("Unknown network type.");
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ private slots:
|
||||
private:
|
||||
Ui::NetworkWidget *ui;
|
||||
std::string networkIdStr;
|
||||
bool publicWarningShown;
|
||||
};
|
||||
|
||||
#endif // NETWORK_H
|
||||
|
37
ZeroTierUI/onetimedialog.cpp
Normal file
37
ZeroTierUI/onetimedialog.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "onetimedialog.h"
|
||||
#include "ui_onetimedialog.h"
|
||||
#include "main.h"
|
||||
|
||||
OneTimeDialog::OneTimeDialog(QWidget *parent,const char *propName,const QString &title,const QString &message) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::OneTimeDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->label->setText(message);
|
||||
this->setWindowTitle(title);
|
||||
_propName = propName;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets) {
|
||||
QFont font(widget->font());
|
||||
font.setPointSizeF(font.pointSizeF() * 0.75);
|
||||
widget->setFont(font);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
OneTimeDialog::~OneTimeDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OneTimeDialog::on_pushButton_clicked()
|
||||
{
|
||||
if (_propName) {
|
||||
settings->setValue(_propName,ui->checkBox->isChecked());
|
||||
settings->sync();
|
||||
}
|
||||
this->close();
|
||||
}
|
26
ZeroTierUI/onetimedialog.h
Normal file
26
ZeroTierUI/onetimedialog.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef ONETIMEDIALOG_H
|
||||
#define ONETIMEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class OneTimeDialog;
|
||||
}
|
||||
|
||||
class OneTimeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OneTimeDialog(QWidget *parent = 0,const char *propName = (const char *)0,const QString &title = QString(),const QString &message = QString());
|
||||
~OneTimeDialog();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OneTimeDialog *ui;
|
||||
const char *_propName;
|
||||
};
|
||||
|
||||
#endif // ONETIMEDIALOG_H
|
99
ZeroTierUI/onetimedialog.ui
Normal file
99
ZeroTierUI/onetimedialog.ui
Normal file
@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OneTimeDialog</class>
|
||||
<widget class="QDialog" name="OneTimeDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>496</width>
|
||||
<height>197</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't Show This Message Again</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user