Merge branch 'dev' into ss/impl

This commit is contained in:
pokamest 2021-01-10 20:52:04 +03:00
commit ba686556d2
11 changed files with 126 additions and 96 deletions

View file

@ -134,6 +134,7 @@ OpenVpnConfigurator::ConnectionData OpenVpnConfigurator::createCertRequest()
initPKI(path);
ErrorCode errorCode = genReq(path, connData.clientId);
Q_UNUSED(errorCode)
QFile req(path + "/pki/reqs/" + connData.clientId + ".req");
req.open(QIODevice::ReadOnly);

View file

@ -11,13 +11,12 @@ Router &Router::Instance()
bool Router::routeAdd(const QString &ip, const QString &gw, QString mask)
{
#ifdef Q_OS_WIN
qDebug().noquote() << QString("ROUTE ADD: IP:%1 %2 GW %3")
.arg(ip)
.arg(mask)
.arg(gw);
#ifdef Q_OS_WIN
if (mask == "") {
mask = "255.255.255.255";
if (ip.endsWith(".0")) mask = "255.255.255.0";
@ -108,7 +107,9 @@ bool Router::routeAdd(const QString &ip, const QString &gw, QString mask)
free(pIpForwardTable);
return (dwStatus == NO_ERROR);
#else
// Not implemented yet
return false;
#endif
}
@ -229,7 +230,9 @@ int Router::routeAddList(const QString &gw, const QStringList &ips)
qDebug() << "Router::routeAddList finished, success: " << success_count << "/" << ips.size();
return success_count;
#else
// Not implemented yet
return false;
#endif
}
@ -283,12 +286,16 @@ bool Router::clearSavedRoutes()
ipForwardRows.clear();
return true;
#else
// Not implemented yet
return false;
#endif
}
bool Router::routeDelete(const QString &ip)
{
qDebug().noquote() << QString("ROUTE DELETE, IP: %1").arg(ip);
#ifdef Q_OS_WIN
QProcess p;
p.setProcessChannelMode(QProcess::MergedChannels);
@ -300,6 +307,9 @@ bool Router::routeDelete(const QString &ip)
qDebug().noquote() << "OUTPUT route delete: " + p.readAll();
return true;
#else
// Not implemented yet
return false;
#endif
}

View file

@ -52,19 +52,19 @@ ErrorCode ServerController::runScript(const SshConnectionParameters &sshParams,
wait.quit();
});
QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardOutput, [proc](){
QString s = proc->readAllStandardOutput();
if (s != "." && !s.isEmpty()) {
qDebug().noquote() << s;
}
});
// QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardOutput, [proc](){
// QString s = proc->readAllStandardOutput();
// if (s != "." && !s.isEmpty()) {
// qDebug().noquote() << s;
// }
// });
QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardError, [proc](){
QString s = proc->readAllStandardError();
if (s != "." && !s.isEmpty()) {
qDebug().noquote() << s;
}
});
// QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardError, [proc](){
// QString s = proc->readAllStandardError();
// if (s != "." && !s.isEmpty()) {
// qDebug().noquote() << s;
// }
// });
proc->start();
@ -284,24 +284,15 @@ ErrorCode ServerController::setupOpenVpnServer(const ServerCredentials &credenti
ErrorCode e = runScript(sshParams(credentials), scriptData);
if (e) return e;
//return ok;
return checkOpenVpnServer(credentials);
}
ErrorCode ServerController::setupShadowSocksServer(const ServerCredentials &credentials)
{
QString scriptData;
QString scriptFileName = ":/server_scripts/setup_shadowsocks_server.sh";
QFile file(scriptFileName);
if (! file.open(QIODevice::ReadOnly)) return ErrorCode::InternalError;
Q_UNUSED(credentials)
scriptData = file.readAll();
if (scriptData.isEmpty()) return ErrorCode::InternalError;
ErrorCode e = runScript(sshParams(credentials), scriptData);
if (e) return e;
return ErrorCode::NoError;
//return checkShadowSocksServer(credentials);
return ErrorCode::NotImplementedError;
}
SshConnection *ServerController::connectToHost(const SshConnectionParameters &sshParams)

View file

@ -226,6 +226,7 @@ void OpenVpnProtocol::onReadyReadDataFromManagementServer()
else {
emit protocolError(ErrorCode::OpenVpnUnknownError);
}
return;
}
QByteArray data(line.toStdString().c_str());

View file

@ -33,10 +33,11 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
#endif
ui(new Ui::MainWindow),
m_settings(new Settings),
m_vpnConnection(nullptr)
m_vpnConnection(nullptr),
m_settings(new Settings)
{
ui->setupUi(this);
ui->label_error_text->clear();
ui->widget_tittlebar->installEventFilter(this);
ui->stackedWidget_main->setSpeed(200);
@ -375,8 +376,7 @@ void MainWindow::onConnectionStateChanged(VpnProtocol::ConnectionState state)
void MainWindow::onVpnProtocolError(ErrorCode errorCode)
{
// TODO fix crash on Windows when starting vpn and another vpn already connected
//QMessageBox::critical(this, APPLICATION_NAME, errorString(errorCode));
ui->label_error_text->setText(errorString(errorCode));
}
void MainWindow::onPushButtonConnectClicked(bool checked)
@ -528,6 +528,7 @@ void MainWindow::onTrayActivated(QSystemTrayIcon::ActivationReason reason)
void MainWindow::onConnect()
{
ui->label_error_text->clear();
ui->pushButton_connect->setChecked(true);
qApp->processEvents();

View file

@ -267,7 +267,7 @@ QStackedWidget QWidget {
</string>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="page_start">
<widget class="QLabel" name="label_23">
@ -1140,6 +1140,28 @@ color: #181922;
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_error_text">
<property name="geometry">
<rect>
<x>0</x>
<y>300</y>
<width>381</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>Error text</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_sites">
<property name="styleSheet">

0
deploy/data/macos/openvpn Normal file → Executable file
View file

0
deploy/data/macos/post_install.sh Normal file → Executable file
View file

0
deploy/data/macos/post_uninstall.sh Normal file → Executable file
View file

View file

@ -44,6 +44,9 @@ cp -av $DEPLOY_DATA_DIR/post_install.sh $INSTALLER_DATA_DIR/post_install.
cp -av $DEPLOY_DATA_DIR/post_uninstall.sh $INSTALLER_DATA_DIR/post_uninstall.sh
cp -av $DEPLOY_DATA_DIR/$PLIST_NAME $INSTALLER_DATA_DIR/$PLIST_NAME
rm -f $BUNDLE_DIR/Contents/macOS/post_install.sh $BUNDLE_DIR/Contents/macOS/post_uninstall.sh
chmod a+x $INSTALLER_DATA_DIR/post_install.sh $INSTALLER_DATA_DIR/post_uninstall.sh
cd $BUNDLE_DIR
tar czf $INSTALLER_DATA_DIR/$APP_NAME.tar.gz ./

View file

@ -45,6 +45,7 @@ del "%OUT_APP_DIR:"=%\*.cpp"
del "%OUT_APP_DIR:"=%\*.h"
del "%OUT_APP_DIR:"=%\*.res"
del "%OUT_APP_DIR:"=%\*.o"
del "%OUT_APP_DIR:"=%\*.moc"
del "%OUT_APP_DIR:"=%\*.lib"
del "%OUT_APP_DIR:"=%\*.exp"
echo "Deploying..."