Tiny fixes

This commit is contained in:
pokamest 2021-06-03 20:23:44 +03:00
parent 80ada3f241
commit d13df65bfb
6 changed files with 20 additions and 51 deletions

View file

@ -55,6 +55,7 @@ enum ErrorCode
// VPN errors
OpenVpnAdaptersInUseError,
OpenVpnUnknownError,
OpenVpnTapAdapterError,
// 3rd party utils errors
OpenVpnExecutableCrashed,

View file

@ -42,6 +42,7 @@ QString errorString(ErrorCode code){
// VPN errors
case (OpenVpnAdaptersInUseError): return QObject::tr("Can't connect: another VPN connection is active");
case (OpenVpnTapAdapterError): return QObject::tr("Can't setup OpenVPN TAP network adapter");
case(InternalError):
default:

View file

@ -48,7 +48,7 @@ QSharedPointer<IpcProcessInterfaceReplica> IpcClient::CreatePrivilegedProcess()
qWarning() << "IpcProcessInterfaceReplica replica is not connected!";
}
connect(pd->ipcProcess.data(), &IpcProcessInterfaceReplica::destroyed, pd->ipcProcess.data(), [pd](){
connect(pd->ipcProcess.data(), &IpcProcessInterfaceReplica::destroyed, pd->ipcProcess.data(), [this, pd](){
pd->replicaNode->deleteLater();
});
}

View file

@ -54,7 +54,7 @@ ErrorCode OpenVpnProtocol::checkAndSetupTapDriver()
QRemoteObjectPendingReply<bool> resultInstall = IpcClient::Interface()->checkAndInstallDriver();
resultInstall.waitForFinished();
if (!resultInstall.returnValue()) return ErrorCode::OpenVpnUnknownError;
if (!resultInstall.returnValue()) return ErrorCode::OpenVpnTapAdapterError;
}
return ErrorCode::NoError;
}
@ -288,52 +288,11 @@ void OpenVpnProtocol::updateVpnGateway(const QString &line)
for (const QString &l : params) {
if (l.contains("ifconfig")) {
if (l.split(" ").size() == 3) {
m_vpnAddress = l.split(" ").at(1);
m_vpnLocalAddress = l.split(" ").at(1);
m_vpnGateway = l.split(" ").at(2);
qDebug() << QString("Set vpn address %1, gw %2").arg(m_vpnAddress).arg(vpnGateway());
qDebug() << QString("Set vpn local address %1, gw %2").arg(m_vpnLocalAddress).arg(vpnGateway());
}
}
}
// QProcess ipconfig;
// ipconfig.start("ipconfig", QStringList() << "/all");
// ipconfig.waitForStarted();
// ipconfig.waitForFinished();
// QString d = ipconfig.readAll();
// d.replace("\r", "");
// //qDebug().noquote() << d;
// QStringList adapters = d.split(":\n");
// bool isTapV9Present = false;
// QString tapV9;
// for (int i = 0; i < adapters.size(); ++i) {
// if (adapters.at(i).contains("TAP-Windows Adapter V9")) {
// isTapV9Present = true;
// tapV9 = adapters.at(i);
// break;
// }
// }
// if (!isTapV9Present) {
// m_vpnGateway = "";
// }
// QStringList lines = tapV9.split("\n");
// for (int i = 0; i < lines.size(); ++i) {
// if (!lines.at(i).contains("DHCP")) continue;
// QRegularExpression re("(: )([\\d\\.]+)($)");
// QRegularExpressionMatch match = re.match(lines.at(i));
// if (match.hasMatch()) {
// qDebug().noquote() << "Current VPN Gateway IP Address: " << match.captured(0);
// m_vpnGateway = match.captured(2);
// return;
// }
// else continue;
// }
// m_vpnGateway = "";
}

View file

@ -1760,7 +1760,6 @@ void MainWindow::onConnect()
const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
onConnectWorker(serverIndex, credentials, container, containerConfig);
}
@ -1832,9 +1831,12 @@ void MainWindow::onPushButtonAddCustomSitesClicked()
const auto &cbResolv = [this, cbProcess](const QHostInfo &hostInfo){
const QList<QHostAddress> &addresses = hostInfo.addresses();
if (!addresses.isEmpty()) {
//qDebug() << "Resolved address for" << hostInfo.hostName() << addresses.first().toString();
cbProcess(hostInfo.hostName(), addresses.first().toString());
QString ipv4Addr;
for (const QHostAddress &addr: hostInfo.addresses()) {
if (addr.protocol() == QAbstractSocket::NetworkLayerProtocol::IPv4Protocol) {
cbProcess(hostInfo.hostName(),addr.toString());
break;
}
}
};
@ -1847,7 +1849,7 @@ void MainWindow::onPushButtonAddCustomSitesClicked()
else {
cbProcess(newSite, "");
updateSitesPage();
int reqId = QHostInfo::lookupHost(newSite, this, cbResolv);
QHostInfo::lookupHost(newSite, this, cbResolv);
}
}
@ -1876,6 +1878,9 @@ void MainWindow::updateSitesPage()
Settings::RouteMode m = m_settings.routeMode();
if (m == Settings::VpnAllSites) return;
if (m == Settings::VpnOnlyForwardSites) ui->label_sites_add_custom->setText(tr("These sites will be opened using VPN"));
if (m == Settings::VpnAllExceptSites) ui->label_sites_add_custom->setText(tr("These sites will be excepted from VPN"));
ui->tableView_sites->setModel(sitesModels.value(m));
sitesModels.value(m)->resetCache();
}
@ -1917,6 +1922,7 @@ void MainWindow::updateServerPage()
ui->pushButton_server_settings_clear->setVisible(m_settings.haveAuthData(selectedServerIndex));
ui->pushButton_server_settings_clear_client_cache->setVisible(m_settings.haveAuthData(selectedServerIndex));
ui->pushButton_server_settings_share_full->setVisible(m_settings.haveAuthData(selectedServerIndex));
QJsonObject server = m_settings.server(selectedServerIndex);
QString port = server.value(config_key::port).toString();

View file

@ -99,8 +99,10 @@ cd "%RELEASE_DIR:"=%\installer"
echo "Creating installer..."
"%QIF_BIN_DIR:"=%\binarycreator" --offline-only -v -c config\windows.xml -p packages -f %TARGET_FILENAME%
timeout 5
cd %PROJECT_DIR%
signtool sign /v /sm /s My /n "Privacy Technologies OU" /fd sha256 /tr http://timestamp.comodoca.com/?td=sha256 /td sha256 %TARGET_FILENAME%
signtool sign /v /sm /s My /n "Privacy Technologies OU" /fd sha256 /tr http://timestamp.comodoca.com/?td=sha256 /td sha256 "%TARGET_FILENAME%"
echo "Finished, see %TARGET_FILENAME%"
exit 0