mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-07-03 14:07:39 +02:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 48379245a5 | |||
| 9df1363463 | |||
| eb2d0491be | |||
| a3e4d89a86 | |||
| ed10774eed | |||
| dd7362ad6f | |||
| e9f6b95853 | |||
| 6a03eead3f | |||
| 9d456dc18e |
@@ -48,18 +48,14 @@ jobs:
|
||||
export QIF_BIN_DIR=${{ runner.temp }}/Qt/Tools/QtInstallerFramework/${{ env.QIF_VERSION }}/bin
|
||||
bash deploy/build_linux.sh
|
||||
|
||||
- name: 'Pack installer'
|
||||
run: cd deploy && tar -cf AmneziaVPN_Linux_Installer.tar AmneziaVPN_Linux_Installer.bin
|
||||
|
||||
- name: 'Upload installer artifact'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN_Linux_installer.tar
|
||||
path: deploy/AmneziaVPN_Linux_Installer.tar
|
||||
name: AmneziaVPN_Linux_installer
|
||||
path: deploy/AmneziaVPN_Linux_Installer
|
||||
retention-days: 7
|
||||
|
||||
- name: 'Upload unpacked artifact'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN_Linux_unpacked
|
||||
path: deploy/AppDir
|
||||
@@ -114,14 +110,13 @@ jobs:
|
||||
call deploy\\build_windows.bat
|
||||
|
||||
- name: 'Upload installer artifact'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN_Windows_installer
|
||||
path: AmneziaVPN_x${{ env.BUILD_ARCH }}.exe
|
||||
retention-days: 7
|
||||
|
||||
- name: 'Upload unpacked artifact'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN_Windows_unpacked
|
||||
path: deploy\\build_${{ env.BUILD_ARCH }}\\client\\Release
|
||||
@@ -205,7 +200,7 @@ jobs:
|
||||
IOS_NE_PROVISIONING_PROFILE: ${{ secrets.IOS_NE_PROVISIONING_PROFILE }}
|
||||
|
||||
# - name: 'Upload appstore .ipa and dSYMs to artifacts'
|
||||
# uses: actions/upload-artifact@v4
|
||||
# uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: app-store ipa & dsyms
|
||||
# path: |
|
||||
@@ -260,14 +255,13 @@ jobs:
|
||||
bash deploy/build_macos.sh
|
||||
|
||||
- name: 'Upload installer artifact'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN_MacOS_installer
|
||||
path: AmneziaVPN.dmg
|
||||
retention-days: 7
|
||||
|
||||
- name: 'Upload unpacked artifact'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN_MacOS_unpacked
|
||||
path: deploy/build/client/AmneziaVPN.app
|
||||
@@ -283,7 +277,6 @@ jobs:
|
||||
ANDROID_BUILD_PLATFORM: android-34
|
||||
QT_VERSION: 6.6.1
|
||||
QT_MODULES: 'qtremoteobjects qt5compat qtimageformats qtshadertools'
|
||||
BUILD_AAB: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
|
||||
|
||||
steps:
|
||||
- name: 'Install desktop Qt'
|
||||
@@ -382,45 +375,32 @@ jobs:
|
||||
ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_ALIAS }}
|
||||
ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_PASS }}
|
||||
shell: bash
|
||||
run: ./deploy/build_android.sh ${{ env.BUILD_AAB == 'true' && '--aab' || '' }} --apk all --build-platform ${{ env.ANDROID_BUILD_PLATFORM }}
|
||||
run: ./deploy/build_android.sh --apk all --build-platform ${{ env.ANDROID_BUILD_PLATFORM }}
|
||||
|
||||
- name: 'Upload x86_64 apk'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN-android-x86_64
|
||||
path: deploy/build/AmneziaVPN-x86_64-release.apk
|
||||
compression-level: 0
|
||||
retention-days: 7
|
||||
|
||||
- name: 'Upload x86 apk'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN-android-x86
|
||||
path: deploy/build/AmneziaVPN-x86-release.apk
|
||||
compression-level: 0
|
||||
retention-days: 7
|
||||
|
||||
- name: 'Upload arm64-v8a apk'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN-android-arm64-v8a
|
||||
path: deploy/build/AmneziaVPN-arm64-v8a-release.apk
|
||||
compression-level: 0
|
||||
retention-days: 7
|
||||
|
||||
- name: 'Upload armeabi-v7a apk'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AmneziaVPN-android-armeabi-v7a
|
||||
path: deploy/build/AmneziaVPN-armeabi-v7a-release.apk
|
||||
compression-level: 0
|
||||
retention-days: 7
|
||||
|
||||
- name: 'Upload aab'
|
||||
if: ${{ env.BUILD_AAB == 'true' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: AmneziaVPN-android
|
||||
path: deploy/build/AmneziaVPN-release.aab
|
||||
compression-level: 0
|
||||
retention-days: 7
|
||||
|
||||
+3
-3
@@ -22,6 +22,6 @@
|
||||
[submodule "client/3rd-prebuilt"]
|
||||
path = client/3rd-prebuilt
|
||||
url = https://github.com/amnezia-vpn/3rd-prebuilt
|
||||
[submodule "client/3rd/amneziawg-apple"]
|
||||
path = client/3rd/amneziawg-apple
|
||||
url = https://github.com/amnezia-vpn/amneziawg-apple
|
||||
[submodule "client/3rd/awg-apple"]
|
||||
path = client/3rd/awg-apple
|
||||
url = https://github.com/amnezia-vpn/awg-apple
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
|
||||
|
||||
set(PROJECT AmneziaVPN)
|
||||
|
||||
project(${PROJECT} VERSION 4.2.1.0
|
||||
project(${PROJECT} VERSION 4.1.0.1
|
||||
DESCRIPTION "AmneziaVPN"
|
||||
HOMEPAGE_URL "https://amnezia.org/"
|
||||
)
|
||||
@@ -11,7 +11,7 @@ string(TIMESTAMP CURRENT_DATE "%Y-%m-%d")
|
||||
set(RELEASE_DATE "${CURRENT_DATE}")
|
||||
|
||||
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
||||
set(APP_ANDROID_VERSION_CODE 42)
|
||||
set(APP_ANDROID_VERSION_CODE 39)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(MZ_PLATFORM_NAME "linux")
|
||||
|
||||
@@ -36,7 +36,7 @@ AmneziaVPN uses a number of open source projects to work:
|
||||
Make sure to pull all submodules after checking out the repo.
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
git submodule update --init
|
||||
```
|
||||
|
||||
## Development
|
||||
@@ -50,15 +50,7 @@ Look deploy folder for build scripts.
|
||||
|
||||
1. First, make sure you have [XCode](https://developer.apple.com/xcode/) installed, at least version 14 or higher.
|
||||
|
||||
2. We use QT to generate the XCode project. we need QT version 6.6.1. Install QT for macos in [here](https://doc.qt.io/qt-6/macos.html) or [QT Online Installer](https://www.qt.io/download-open-source). Required modules:
|
||||
- macOS
|
||||
- iOS
|
||||
- Qt 5 Compatibility Module
|
||||
- Qt Shader Tools
|
||||
- Additional Libraries:
|
||||
- Qt Image Formats
|
||||
- Qt Multimedia
|
||||
- Qt Remote Objects
|
||||
2. We use QT to generate the XCode project. we need QT version 6.4. Install QT for macos in [here](https://doc.qt.io/qt-6/macos.html)
|
||||
|
||||
3. Install cmake is require. We recommend cmake version 3.25. You can install cmake in [here](https://cmake.org/download/)
|
||||
|
||||
@@ -74,11 +66,10 @@ gomobile init
|
||||
5. Build project
|
||||
```bash
|
||||
export QT_BIN_DIR="<PATH-TO-QT-FOLDER>/Qt/<QT-VERSION>/ios/bin"
|
||||
export QT_MACOS_ROOT_DIR="<PATH-TO-QT-FOLDER>/Qt/<QT-VERSION>/macos"
|
||||
export QT_IOS_BIN=$QT_BIN_DIR
|
||||
export PATH=$PATH:~/go/bin
|
||||
mkdir build-ios
|
||||
$QT_IOS_BIN/qt-cmake . -B build-ios -GXcode -DQT_HOST_PATH=$QT_MACOS_ROOT_DIR
|
||||
$QT_IOS_BIN/qt-cmake . -B build-ios -GXcode -DQT_HOST_PATH=$QT_BIN_DIR
|
||||
```
|
||||
Replace PATH-TO-QT-FOLDER and QT-VERSION to your environment
|
||||
|
||||
|
||||
+1
-1
Submodule client/3rd-prebuilt updated: e568e7d0e8...b4156d4d09
Vendored
-1
Submodule client/3rd/amneziawg-apple deleted from f23eee4700
+1
Submodule client/3rd/awg-apple added at 233eda6760
Vendored
+1
-1
Submodule client/3rd/qtkeychain updated: 74776e2a3e...8bbaa6d830
+380
-389
@@ -1,389 +1,380 @@
|
||||
#include "amnezia_application.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QFontDatabase>
|
||||
#include <QMimeData>
|
||||
#include <QQuickStyle>
|
||||
#include <QResource>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextDocument>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
|
||||
#include <QQuickItem>
|
||||
|
||||
#include "logger.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "platforms/ios/QRCodeReaderBase.h"
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#include "platforms/android/android_controller.h"
|
||||
#endif
|
||||
|
||||
#include "protocols/qml_register_protocols.h"
|
||||
|
||||
#if defined(Q_OS_IOS)
|
||||
#include "platforms/ios/ios_controller.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_CLASS(argc, argv)
|
||||
#else
|
||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[], bool allowSecondary, SingleApplication::Options options,
|
||||
int timeout, const QString &userData)
|
||||
: SingleApplication(argc, argv, allowSecondary, options, timeout, userData)
|
||||
#endif
|
||||
{
|
||||
setQuitOnLastWindowClosed(false);
|
||||
|
||||
// Fix config file permissions
|
||||
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
|
||||
{
|
||||
QSettings s(ORGANIZATION_NAME, APPLICATION_NAME);
|
||||
s.setValue("permFixed", true);
|
||||
}
|
||||
|
||||
QString configLoc1 = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).first() + "/"
|
||||
+ ORGANIZATION_NAME + "/" + APPLICATION_NAME + ".conf";
|
||||
QFile::setPermissions(configLoc1, QFileDevice::ReadOwner | QFileDevice::WriteOwner);
|
||||
|
||||
QString configLoc2 = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).first() + "/"
|
||||
+ ORGANIZATION_NAME + "/" + APPLICATION_NAME + "/" + APPLICATION_NAME + ".conf";
|
||||
QFile::setPermissions(configLoc2, QFileDevice::ReadOwner | QFileDevice::WriteOwner);
|
||||
#endif
|
||||
|
||||
m_settings = std::shared_ptr<Settings>(new Settings);
|
||||
}
|
||||
|
||||
AmneziaApplication::~AmneziaApplication()
|
||||
{
|
||||
m_vpnConnectionThread.quit();
|
||||
m_vpnConnectionThread.wait(3000);
|
||||
|
||||
if (m_engine) {
|
||||
QObject::disconnect(m_engine, 0, 0, 0);
|
||||
delete m_engine;
|
||||
}
|
||||
}
|
||||
|
||||
void AmneziaApplication::init()
|
||||
{
|
||||
m_engine = new QQmlApplicationEngine;
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/ui/qml/main2.qml"));
|
||||
QObject::connect(
|
||||
m_engine, &QQmlApplicationEngine::objectCreated, this,
|
||||
[url](QObject *obj, const QUrl &objUrl) {
|
||||
if (!obj && url == objUrl)
|
||||
QCoreApplication::exit(-1);
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
m_engine->rootContext()->setContextProperty("Debug", &Logger::Instance());
|
||||
|
||||
m_configurator = std::shared_ptr<VpnConfigurator>(new VpnConfigurator(m_settings, this));
|
||||
m_vpnConnection.reset(new VpnConnection(m_settings, m_configurator));
|
||||
m_vpnConnection->moveToThread(&m_vpnConnectionThread);
|
||||
m_vpnConnectionThread.start();
|
||||
|
||||
initModels();
|
||||
loadTranslator();
|
||||
initControllers();
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
if(!AndroidController::initLogging()) {
|
||||
qFatal("Android logging initialization failed");
|
||||
}
|
||||
AndroidController::instance()->setSaveLogs(m_settings->isSaveLogs());
|
||||
connect(m_settings.get(), &Settings::saveLogsChanged,
|
||||
AndroidController::instance(), &AndroidController::setSaveLogs);
|
||||
|
||||
connect(AndroidController::instance(), &AndroidController::initConnectionState, this,
|
||||
[this](Vpn::ConnectionState state) {
|
||||
m_connectionController->onConnectionStateChanged(state);
|
||||
if (m_vpnConnection)
|
||||
m_vpnConnection->restoreConnection();
|
||||
});
|
||||
if (!AndroidController::instance()->initialize()) {
|
||||
qFatal("Android controller initialization failed");
|
||||
}
|
||||
|
||||
connect(AndroidController::instance(), &AndroidController::importConfigFromOutside, [this](QString data) {
|
||||
m_pageController->replaceStartPage();
|
||||
m_importController->extractConfigFromData(data);
|
||||
m_pageController->goToPageViewConfig();
|
||||
});
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_IOS
|
||||
IosController::Instance()->initialize();
|
||||
connect(IosController::Instance(), &IosController::importConfigFromOutside, [this](QString data) {
|
||||
m_pageController->replaceStartPage();
|
||||
m_importController->extractConfigFromData(data);
|
||||
m_pageController->goToPageViewConfig();
|
||||
});
|
||||
|
||||
connect(IosController::Instance(), &IosController::importBackupFromOutside, [this](QString filePath) {
|
||||
m_pageController->replaceStartPage();
|
||||
m_pageController->goToPageSettingsBackup();
|
||||
m_settingsController->importBackupFromOutside(filePath);
|
||||
});
|
||||
#endif
|
||||
|
||||
m_notificationHandler.reset(NotificationHandler::create(nullptr));
|
||||
|
||||
connect(m_vpnConnection.get(), &VpnConnection::connectionStateChanged, m_notificationHandler.get(),
|
||||
&NotificationHandler::setConnectionState);
|
||||
|
||||
connect(m_notificationHandler.get(), &NotificationHandler::raiseRequested, m_pageController.get(),
|
||||
&PageController::raiseMainWindow);
|
||||
connect(m_notificationHandler.get(), &NotificationHandler::connectRequested, m_connectionController.get(),
|
||||
&ConnectionController::openConnection);
|
||||
connect(m_notificationHandler.get(), &NotificationHandler::disconnectRequested, m_connectionController.get(),
|
||||
&ConnectionController::closeConnection);
|
||||
connect(this, &AmneziaApplication::translationsUpdated, m_notificationHandler.get(),
|
||||
&NotificationHandler::onTranslationsUpdated);
|
||||
|
||||
m_engine->load(url);
|
||||
m_systemController->setQmlRoot(m_engine->rootObjects().value(0));
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
if (m_settings->isSaveLogs()) {
|
||||
if (!Logger::init()) {
|
||||
qWarning() << "Initialization of debug subsystem failed";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (m_parser.isSet("a"))
|
||||
m_pageController->showOnStartup();
|
||||
else
|
||||
emit m_pageController->raiseMainWindow();
|
||||
#else
|
||||
m_pageController->showOnStartup();
|
||||
#endif
|
||||
|
||||
// TODO - fix
|
||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||
if (isPrimary()) {
|
||||
QObject::connect(this, &SingleApplication::instanceStarted, m_pageController.get(), [this]() {
|
||||
qDebug() << "Secondary instance started, showing this window instead";
|
||||
emit m_pageController->raiseMainWindow();
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
// Android TextArea clipboard workaround
|
||||
// Text from TextArea always has "text/html" mime-type:
|
||||
// /qt/6.6.1/Src/qtdeclarative/src/quick/items/qquicktextcontrol.cpp:1865
|
||||
// Next, html is created for this mime-type:
|
||||
// /qt/6.6.1/Src/qtdeclarative/src/quick/items/qquicktextcontrol.cpp:1885
|
||||
// And this html goes to the Androids clipboard, i.e. text from TextArea is always copied as richText:
|
||||
// /qt/6.6.1/Src/qtbase/src/plugins/platforms/android/androidjniclipboard.cpp:46
|
||||
// So we catch all the copies to the clipboard and clear them from "text/html"
|
||||
#ifdef Q_OS_ANDROID
|
||||
connect(QGuiApplication::clipboard(), &QClipboard::dataChanged, []() {
|
||||
auto clipboard = QGuiApplication::clipboard();
|
||||
if (clipboard->mimeData()->hasHtml()) {
|
||||
clipboard->setText(clipboard->text());
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void AmneziaApplication::registerTypes()
|
||||
{
|
||||
qRegisterMetaType<ServerCredentials>("ServerCredentials");
|
||||
|
||||
qRegisterMetaType<DockerContainer>("DockerContainer");
|
||||
qRegisterMetaType<TransportProto>("TransportProto");
|
||||
qRegisterMetaType<Proto>("Proto");
|
||||
qRegisterMetaType<ServiceType>("ServiceType");
|
||||
|
||||
declareQmlProtocolEnum();
|
||||
declareQmlContainerEnum();
|
||||
|
||||
qmlRegisterType<QRCodeReader>("QRCodeReader", 1, 0, "QRCodeReader");
|
||||
|
||||
m_containerProps.reset(new ContainerProps());
|
||||
qmlRegisterSingletonInstance("ContainerProps", 1, 0, "ContainerProps", m_containerProps.get());
|
||||
|
||||
m_protocolProps.reset(new ProtocolProps());
|
||||
qmlRegisterSingletonInstance("ProtocolProps", 1, 0, "ProtocolProps", m_protocolProps.get());
|
||||
|
||||
qmlRegisterSingletonType(QUrl("qrc:/ui/qml/Filters/ContainersModelFilters.qml"), "ContainersModelFilters", 1, 0,
|
||||
"ContainersModelFilters");
|
||||
|
||||
//
|
||||
Vpn::declareQmlVpnConnectionStateEnum();
|
||||
PageLoader::declareQmlPageEnum();
|
||||
}
|
||||
|
||||
void AmneziaApplication::loadFonts()
|
||||
{
|
||||
QQuickStyle::setStyle("Basic");
|
||||
|
||||
QFontDatabase::addApplicationFont(":/fonts/pt-root-ui_vf.ttf");
|
||||
}
|
||||
|
||||
void AmneziaApplication::loadTranslator()
|
||||
{
|
||||
auto locale = m_settings->getAppLanguage();
|
||||
m_translator.reset(new QTranslator());
|
||||
updateTranslator(locale);
|
||||
}
|
||||
|
||||
void AmneziaApplication::updateTranslator(const QLocale &locale)
|
||||
{
|
||||
if (!m_translator->isEmpty()) {
|
||||
QCoreApplication::removeTranslator(m_translator.get());
|
||||
}
|
||||
|
||||
QString strFileName = QString(":/translations/amneziavpn") + QLatin1String("_") + locale.name() + ".qm";
|
||||
if (m_translator->load(strFileName)) {
|
||||
if (QCoreApplication::installTranslator(m_translator.get())) {
|
||||
m_settings->setAppLanguage(locale);
|
||||
}
|
||||
} else {
|
||||
m_settings->setAppLanguage(QLocale::English);
|
||||
}
|
||||
|
||||
m_engine->retranslate();
|
||||
|
||||
emit translationsUpdated();
|
||||
}
|
||||
|
||||
bool AmneziaApplication::parseCommands()
|
||||
{
|
||||
m_parser.setApplicationDescription(APPLICATION_NAME);
|
||||
m_parser.addHelpOption();
|
||||
m_parser.addVersionOption();
|
||||
|
||||
QCommandLineOption c_autostart { { "a", "autostart" }, "System autostart" };
|
||||
m_parser.addOption(c_autostart);
|
||||
|
||||
QCommandLineOption c_cleanup { { "c", "cleanup" }, "Cleanup logs" };
|
||||
m_parser.addOption(c_cleanup);
|
||||
|
||||
m_parser.process(*this);
|
||||
|
||||
if (m_parser.isSet(c_cleanup)) {
|
||||
Logger::cleanUp();
|
||||
QTimer::singleShot(100, this, [this] { quit(); });
|
||||
exec();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QQmlApplicationEngine *AmneziaApplication::qmlEngine() const
|
||||
{
|
||||
return m_engine;
|
||||
}
|
||||
|
||||
void AmneziaApplication::initModels()
|
||||
{
|
||||
m_containersModel.reset(new ContainersModel(this));
|
||||
m_engine->rootContext()->setContextProperty("ContainersModel", m_containersModel.get());
|
||||
|
||||
m_serversModel.reset(new ServersModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("ServersModel", m_serversModel.get());
|
||||
connect(m_serversModel.get(), &ServersModel::containersUpdated, m_containersModel.get(),
|
||||
&ContainersModel::updateModel);
|
||||
connect(m_serversModel.get(), &ServersModel::defaultContainerChanged, m_containersModel.get(),
|
||||
&ContainersModel::setDefaultContainer);
|
||||
m_containersModel->setDefaultContainer(m_serversModel->getDefaultContainer()); // make better?
|
||||
|
||||
m_languageModel.reset(new LanguageModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("LanguageModel", m_languageModel.get());
|
||||
connect(m_languageModel.get(), &LanguageModel::updateTranslations, this, &AmneziaApplication::updateTranslator);
|
||||
connect(this, &AmneziaApplication::translationsUpdated, m_languageModel.get(), &LanguageModel::translationsUpdated);
|
||||
|
||||
m_sitesModel.reset(new SitesModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("SitesModel", m_sitesModel.get());
|
||||
|
||||
m_protocolsModel.reset(new ProtocolsModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("ProtocolsModel", m_protocolsModel.get());
|
||||
|
||||
m_openVpnConfigModel.reset(new OpenVpnConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("OpenVpnConfigModel", m_openVpnConfigModel.get());
|
||||
|
||||
m_shadowSocksConfigModel.reset(new ShadowSocksConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("ShadowSocksConfigModel", m_shadowSocksConfigModel.get());
|
||||
|
||||
m_cloakConfigModel.reset(new CloakConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("CloakConfigModel", m_cloakConfigModel.get());
|
||||
|
||||
m_wireGuardConfigModel.reset(new WireGuardConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("WireGuardConfigModel", m_wireGuardConfigModel.get());
|
||||
|
||||
m_awgConfigModel.reset(new AwgConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("AwgConfigModel", m_awgConfigModel.get());
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
m_ikev2ConfigModel.reset(new Ikev2ConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("Ikev2ConfigModel", m_ikev2ConfigModel.get());
|
||||
#endif
|
||||
|
||||
m_sftpConfigModel.reset(new SftpConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("SftpConfigModel", m_sftpConfigModel.get());
|
||||
|
||||
m_clientManagementModel.reset(new ClientManagementModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("ClientManagementModel", m_clientManagementModel.get());
|
||||
connect(m_clientManagementModel.get(), &ClientManagementModel::adminConfigRevoked,
|
||||
m_serversModel.get(), &ServersModel::clearCachedProfile);
|
||||
|
||||
connect(m_configurator.get(), &VpnConfigurator::newVpnConfigCreated, this,
|
||||
[this](const QString &clientId, const QString &clientName, const DockerContainer container,
|
||||
ServerCredentials credentials) {
|
||||
m_serversModel->reloadContainerConfig();
|
||||
m_clientManagementModel->appendClient(clientId, clientName, container, credentials);
|
||||
emit m_configurator->clientModelUpdated();
|
||||
});
|
||||
}
|
||||
|
||||
void AmneziaApplication::initControllers()
|
||||
{
|
||||
m_connectionController.reset(new ConnectionController(m_serversModel, m_containersModel, m_vpnConnection));
|
||||
m_engine->rootContext()->setContextProperty("ConnectionController", m_connectionController.get());
|
||||
|
||||
connect(this, &AmneziaApplication::translationsUpdated, m_connectionController.get(),
|
||||
&ConnectionController::onTranslationsUpdated);
|
||||
|
||||
m_pageController.reset(new PageController(m_serversModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("PageController", m_pageController.get());
|
||||
|
||||
m_installController.reset(new InstallController(m_serversModel, m_containersModel, m_protocolsModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("InstallController", m_installController.get());
|
||||
connect(m_installController.get(), &InstallController::passphraseRequestStarted, m_pageController.get(),
|
||||
&PageController::showPassphraseRequestDrawer);
|
||||
connect(m_pageController.get(), &PageController::passphraseRequestDrawerClosed, m_installController.get(),
|
||||
&InstallController::setEncryptedPassphrase);
|
||||
connect(m_installController.get(), &InstallController::currentContainerUpdated, m_connectionController.get(),
|
||||
&ConnectionController::onCurrentContainerUpdated);
|
||||
|
||||
m_importController.reset(new ImportController(m_serversModel, m_containersModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("ImportController", m_importController.get());
|
||||
|
||||
m_exportController.reset(new ExportController(m_serversModel, m_containersModel, m_clientManagementModel,
|
||||
m_settings, m_configurator));
|
||||
m_engine->rootContext()->setContextProperty("ExportController", m_exportController.get());
|
||||
|
||||
m_settingsController.reset(new SettingsController(m_serversModel, m_containersModel, m_languageModel, m_sitesModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("SettingsController", m_settingsController.get());
|
||||
if (m_settingsController->isAutoConnectEnabled() && m_serversModel->getDefaultServerIndex() >= 0) {
|
||||
QTimer::singleShot(1000, this, [this]() { m_connectionController->openConnection(); });
|
||||
}
|
||||
connect(m_settingsController.get(), &SettingsController::amneziaDnsToggled , m_serversModel.get(),
|
||||
&ServersModel::toggleAmneziaDns);
|
||||
|
||||
m_sitesController.reset(new SitesController(m_settings, m_vpnConnection, m_sitesModel));
|
||||
m_engine->rootContext()->setContextProperty("SitesController", m_sitesController.get());
|
||||
|
||||
m_systemController.reset(new SystemController(m_settings));
|
||||
m_engine->rootContext()->setContextProperty("SystemController", m_systemController.get());
|
||||
|
||||
m_cloudController.reset(new ApiController(m_serversModel, m_containersModel));
|
||||
m_engine->rootContext()->setContextProperty("ApiController", m_cloudController.get());
|
||||
}
|
||||
#include "amnezia_application.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QFontDatabase>
|
||||
#include <QMimeData>
|
||||
#include <QQuickStyle>
|
||||
#include <QResource>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextDocument>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
|
||||
#include <QQuickItem>
|
||||
|
||||
#include "logger.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "platforms/ios/QRCodeReaderBase.h"
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#include "platforms/android/android_controller.h"
|
||||
#endif
|
||||
|
||||
#include "protocols/qml_register_protocols.h"
|
||||
|
||||
#if defined(Q_OS_IOS)
|
||||
#include "platforms/ios/ios_controller.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_CLASS(argc, argv)
|
||||
#else
|
||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[], bool allowSecondary, SingleApplication::Options options,
|
||||
int timeout, const QString &userData)
|
||||
: SingleApplication(argc, argv, allowSecondary, options, timeout, userData)
|
||||
#endif
|
||||
{
|
||||
setQuitOnLastWindowClosed(false);
|
||||
|
||||
// Fix config file permissions
|
||||
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
|
||||
{
|
||||
QSettings s(ORGANIZATION_NAME, APPLICATION_NAME);
|
||||
s.setValue("permFixed", true);
|
||||
}
|
||||
|
||||
QString configLoc1 = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).first() + "/"
|
||||
+ ORGANIZATION_NAME + "/" + APPLICATION_NAME + ".conf";
|
||||
QFile::setPermissions(configLoc1, QFileDevice::ReadOwner | QFileDevice::WriteOwner);
|
||||
|
||||
QString configLoc2 = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).first() + "/"
|
||||
+ ORGANIZATION_NAME + "/" + APPLICATION_NAME + "/" + APPLICATION_NAME + ".conf";
|
||||
QFile::setPermissions(configLoc2, QFileDevice::ReadOwner | QFileDevice::WriteOwner);
|
||||
#endif
|
||||
|
||||
m_settings = std::shared_ptr<Settings>(new Settings);
|
||||
}
|
||||
|
||||
AmneziaApplication::~AmneziaApplication()
|
||||
{
|
||||
m_vpnConnectionThread.quit();
|
||||
m_vpnConnectionThread.wait(3000);
|
||||
|
||||
if (m_engine) {
|
||||
QObject::disconnect(m_engine, 0, 0, 0);
|
||||
delete m_engine;
|
||||
}
|
||||
}
|
||||
|
||||
void AmneziaApplication::init()
|
||||
{
|
||||
m_engine = new QQmlApplicationEngine;
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/ui/qml/main2.qml"));
|
||||
QObject::connect(
|
||||
m_engine, &QQmlApplicationEngine::objectCreated, this,
|
||||
[url](QObject *obj, const QUrl &objUrl) {
|
||||
if (!obj && url == objUrl)
|
||||
QCoreApplication::exit(-1);
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
m_engine->rootContext()->setContextProperty("Debug", &Logger::Instance());
|
||||
|
||||
m_configurator = std::shared_ptr<VpnConfigurator>(new VpnConfigurator(m_settings, this));
|
||||
m_vpnConnection.reset(new VpnConnection(m_settings, m_configurator));
|
||||
m_vpnConnection->moveToThread(&m_vpnConnectionThread);
|
||||
m_vpnConnectionThread.start();
|
||||
|
||||
initModels();
|
||||
loadTranslator();
|
||||
initControllers();
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
connect(AndroidController::instance(), &AndroidController::initConnectionState, this,
|
||||
[this](Vpn::ConnectionState state) {
|
||||
m_connectionController->onConnectionStateChanged(state);
|
||||
if (m_vpnConnection)
|
||||
m_vpnConnection->restoreConnection();
|
||||
});
|
||||
if (!AndroidController::instance()->initialize()) {
|
||||
qCritical() << QString("Init failed");
|
||||
if (m_vpnConnection)
|
||||
emit m_vpnConnection->connectionStateChanged(Vpn::ConnectionState::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
connect(AndroidController::instance(), &AndroidController::importConfigFromOutside, [this](QString data) {
|
||||
m_pageController->replaceStartPage();
|
||||
m_importController->extractConfigFromData(data);
|
||||
m_pageController->goToPageViewConfig();
|
||||
});
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_IOS
|
||||
IosController::Instance()->initialize();
|
||||
connect(IosController::Instance(), &IosController::importConfigFromOutside, [this](QString data) {
|
||||
m_pageController->replaceStartPage();
|
||||
m_importController->extractConfigFromData(data);
|
||||
m_pageController->goToPageViewConfig();
|
||||
});
|
||||
|
||||
connect(IosController::Instance(), &IosController::importBackupFromOutside, [this](QString filePath) {
|
||||
m_pageController->replaceStartPage();
|
||||
m_pageController->goToPageSettingsBackup();
|
||||
m_settingsController->importBackupFromOutside(filePath);
|
||||
});
|
||||
#endif
|
||||
|
||||
m_notificationHandler.reset(NotificationHandler::create(nullptr));
|
||||
|
||||
connect(m_vpnConnection.get(), &VpnConnection::connectionStateChanged, m_notificationHandler.get(),
|
||||
&NotificationHandler::setConnectionState);
|
||||
|
||||
connect(m_notificationHandler.get(), &NotificationHandler::raiseRequested, m_pageController.get(),
|
||||
&PageController::raiseMainWindow);
|
||||
connect(m_notificationHandler.get(), &NotificationHandler::connectRequested, m_connectionController.get(),
|
||||
&ConnectionController::openConnection);
|
||||
connect(m_notificationHandler.get(), &NotificationHandler::disconnectRequested, m_connectionController.get(),
|
||||
&ConnectionController::closeConnection);
|
||||
connect(this, &AmneziaApplication::translationsUpdated, m_notificationHandler.get(),
|
||||
&NotificationHandler::onTranslationsUpdated);
|
||||
|
||||
m_engine->load(url);
|
||||
m_systemController->setQmlRoot(m_engine->rootObjects().value(0));
|
||||
|
||||
if (m_settings->isSaveLogs()) {
|
||||
if (!Logger::init()) {
|
||||
qWarning() << "Initialization of debug subsystem failed";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (m_parser.isSet("a"))
|
||||
m_pageController->showOnStartup();
|
||||
else
|
||||
emit m_pageController->raiseMainWindow();
|
||||
#else
|
||||
m_pageController->showOnStartup();
|
||||
#endif
|
||||
|
||||
// TODO - fix
|
||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||
if (isPrimary()) {
|
||||
QObject::connect(this, &SingleApplication::instanceStarted, m_pageController.get(), [this]() {
|
||||
qDebug() << "Secondary instance started, showing this window instead";
|
||||
emit m_pageController->raiseMainWindow();
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
// Android TextField clipboard workaround
|
||||
// https://bugreports.qt.io/browse/QTBUG-113461
|
||||
#ifdef Q_OS_ANDROID
|
||||
QObject::connect(qApp, &QGuiApplication::applicationStateChanged, [](Qt::ApplicationState state) {
|
||||
if (state == Qt::ApplicationActive) {
|
||||
if (qApp->clipboard()->mimeData()->formats().contains("text/html")) {
|
||||
QTextDocument doc;
|
||||
doc.setHtml(qApp->clipboard()->mimeData()->html());
|
||||
qApp->clipboard()->setText(doc.toPlainText());
|
||||
}
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void AmneziaApplication::registerTypes()
|
||||
{
|
||||
qRegisterMetaType<ServerCredentials>("ServerCredentials");
|
||||
|
||||
qRegisterMetaType<DockerContainer>("DockerContainer");
|
||||
qRegisterMetaType<TransportProto>("TransportProto");
|
||||
qRegisterMetaType<Proto>("Proto");
|
||||
qRegisterMetaType<ServiceType>("ServiceType");
|
||||
|
||||
declareQmlProtocolEnum();
|
||||
declareQmlContainerEnum();
|
||||
|
||||
qmlRegisterType<QRCodeReader>("QRCodeReader", 1, 0, "QRCodeReader");
|
||||
|
||||
m_containerProps.reset(new ContainerProps());
|
||||
qmlRegisterSingletonInstance("ContainerProps", 1, 0, "ContainerProps", m_containerProps.get());
|
||||
|
||||
m_protocolProps.reset(new ProtocolProps());
|
||||
qmlRegisterSingletonInstance("ProtocolProps", 1, 0, "ProtocolProps", m_protocolProps.get());
|
||||
|
||||
qmlRegisterSingletonType(QUrl("qrc:/ui/qml/Filters/ContainersModelFilters.qml"), "ContainersModelFilters", 1, 0,
|
||||
"ContainersModelFilters");
|
||||
|
||||
//
|
||||
Vpn::declareQmlVpnConnectionStateEnum();
|
||||
PageLoader::declareQmlPageEnum();
|
||||
}
|
||||
|
||||
void AmneziaApplication::loadFonts()
|
||||
{
|
||||
QQuickStyle::setStyle("Basic");
|
||||
|
||||
QFontDatabase::addApplicationFont(":/fonts/pt-root-ui_vf.ttf");
|
||||
}
|
||||
|
||||
void AmneziaApplication::loadTranslator()
|
||||
{
|
||||
auto locale = m_settings->getAppLanguage();
|
||||
m_translator.reset(new QTranslator());
|
||||
updateTranslator(locale);
|
||||
}
|
||||
|
||||
void AmneziaApplication::updateTranslator(const QLocale &locale)
|
||||
{
|
||||
if (!m_translator->isEmpty()) {
|
||||
QCoreApplication::removeTranslator(m_translator.get());
|
||||
}
|
||||
|
||||
QString strFileName = QString(":/translations/amneziavpn") + QLatin1String("_") + locale.name() + ".qm";
|
||||
if (m_translator->load(strFileName)) {
|
||||
if (QCoreApplication::installTranslator(m_translator.get())) {
|
||||
m_settings->setAppLanguage(locale);
|
||||
}
|
||||
} else {
|
||||
m_settings->setAppLanguage(QLocale::English);
|
||||
}
|
||||
|
||||
m_engine->retranslate();
|
||||
|
||||
emit translationsUpdated();
|
||||
}
|
||||
|
||||
bool AmneziaApplication::parseCommands()
|
||||
{
|
||||
m_parser.setApplicationDescription(APPLICATION_NAME);
|
||||
m_parser.addHelpOption();
|
||||
m_parser.addVersionOption();
|
||||
|
||||
QCommandLineOption c_autostart { { "a", "autostart" }, "System autostart" };
|
||||
m_parser.addOption(c_autostart);
|
||||
|
||||
QCommandLineOption c_cleanup { { "c", "cleanup" }, "Cleanup logs" };
|
||||
m_parser.addOption(c_cleanup);
|
||||
|
||||
m_parser.process(*this);
|
||||
|
||||
if (m_parser.isSet(c_cleanup)) {
|
||||
Logger::cleanUp();
|
||||
QTimer::singleShot(100, this, [this] { quit(); });
|
||||
exec();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QQmlApplicationEngine *AmneziaApplication::qmlEngine() const
|
||||
{
|
||||
return m_engine;
|
||||
}
|
||||
|
||||
void AmneziaApplication::initModels()
|
||||
{
|
||||
m_containersModel.reset(new ContainersModel(this));
|
||||
m_engine->rootContext()->setContextProperty("ContainersModel", m_containersModel.get());
|
||||
|
||||
m_serversModel.reset(new ServersModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("ServersModel", m_serversModel.get());
|
||||
connect(m_serversModel.get(), &ServersModel::containersUpdated, m_containersModel.get(),
|
||||
&ContainersModel::updateModel);
|
||||
connect(m_serversModel.get(), &ServersModel::defaultContainerChanged, m_containersModel.get(),
|
||||
&ContainersModel::setDefaultContainer);
|
||||
m_containersModel->setDefaultContainer(m_serversModel->getDefaultContainer()); // make better?
|
||||
|
||||
m_languageModel.reset(new LanguageModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("LanguageModel", m_languageModel.get());
|
||||
connect(m_languageModel.get(), &LanguageModel::updateTranslations, this, &AmneziaApplication::updateTranslator);
|
||||
connect(this, &AmneziaApplication::translationsUpdated, m_languageModel.get(), &LanguageModel::translationsUpdated);
|
||||
|
||||
m_sitesModel.reset(new SitesModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("SitesModel", m_sitesModel.get());
|
||||
|
||||
m_protocolsModel.reset(new ProtocolsModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("ProtocolsModel", m_protocolsModel.get());
|
||||
|
||||
m_openVpnConfigModel.reset(new OpenVpnConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("OpenVpnConfigModel", m_openVpnConfigModel.get());
|
||||
|
||||
m_shadowSocksConfigModel.reset(new ShadowSocksConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("ShadowSocksConfigModel", m_shadowSocksConfigModel.get());
|
||||
|
||||
m_cloakConfigModel.reset(new CloakConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("CloakConfigModel", m_cloakConfigModel.get());
|
||||
|
||||
m_wireGuardConfigModel.reset(new WireGuardConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("WireGuardConfigModel", m_wireGuardConfigModel.get());
|
||||
|
||||
m_awgConfigModel.reset(new AwgConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("AwgConfigModel", m_awgConfigModel.get());
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
m_ikev2ConfigModel.reset(new Ikev2ConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("Ikev2ConfigModel", m_ikev2ConfigModel.get());
|
||||
#endif
|
||||
|
||||
m_sftpConfigModel.reset(new SftpConfigModel(this));
|
||||
m_engine->rootContext()->setContextProperty("SftpConfigModel", m_sftpConfigModel.get());
|
||||
|
||||
m_clientManagementModel.reset(new ClientManagementModel(m_settings, this));
|
||||
m_engine->rootContext()->setContextProperty("ClientManagementModel", m_clientManagementModel.get());
|
||||
connect(m_clientManagementModel.get(), &ClientManagementModel::adminConfigRevoked,
|
||||
m_serversModel.get(), &ServersModel::clearCachedProfile);
|
||||
|
||||
connect(m_configurator.get(), &VpnConfigurator::newVpnConfigCreated, this,
|
||||
[this](const QString &clientId, const QString &clientName, const DockerContainer container,
|
||||
ServerCredentials credentials) {
|
||||
m_serversModel->reloadContainerConfig();
|
||||
m_clientManagementModel->appendClient(clientId, clientName, container, credentials);
|
||||
emit m_configurator->clientModelUpdated();
|
||||
});
|
||||
}
|
||||
|
||||
void AmneziaApplication::initControllers()
|
||||
{
|
||||
m_connectionController.reset(new ConnectionController(m_serversModel, m_containersModel, m_vpnConnection));
|
||||
m_engine->rootContext()->setContextProperty("ConnectionController", m_connectionController.get());
|
||||
|
||||
connect(this, &AmneziaApplication::translationsUpdated, m_connectionController.get(),
|
||||
&ConnectionController::onTranslationsUpdated);
|
||||
|
||||
m_pageController.reset(new PageController(m_serversModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("PageController", m_pageController.get());
|
||||
|
||||
m_installController.reset(new InstallController(m_serversModel, m_containersModel, m_protocolsModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("InstallController", m_installController.get());
|
||||
connect(m_installController.get(), &InstallController::passphraseRequestStarted, m_pageController.get(),
|
||||
&PageController::showPassphraseRequestDrawer);
|
||||
connect(m_pageController.get(), &PageController::passphraseRequestDrawerClosed, m_installController.get(),
|
||||
&InstallController::setEncryptedPassphrase);
|
||||
connect(m_installController.get(), &InstallController::currentContainerUpdated, m_connectionController.get(),
|
||||
&ConnectionController::onCurrentContainerUpdated);
|
||||
|
||||
m_importController.reset(new ImportController(m_serversModel, m_containersModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("ImportController", m_importController.get());
|
||||
|
||||
m_exportController.reset(new ExportController(m_serversModel, m_containersModel, m_clientManagementModel,
|
||||
m_settings, m_configurator));
|
||||
m_engine->rootContext()->setContextProperty("ExportController", m_exportController.get());
|
||||
|
||||
m_settingsController.reset(new SettingsController(m_serversModel, m_containersModel, m_languageModel, m_sitesModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("SettingsController", m_settingsController.get());
|
||||
if (m_settingsController->isAutoConnectEnabled() && m_serversModel->getDefaultServerIndex() >= 0) {
|
||||
QTimer::singleShot(1000, this, [this]() { m_connectionController->openConnection(); });
|
||||
}
|
||||
connect(m_settingsController.get(), &SettingsController::amneziaDnsToggled , m_serversModel.get(),
|
||||
&ServersModel::toggleAmneziaDns);
|
||||
|
||||
m_sitesController.reset(new SitesController(m_settings, m_vpnConnection, m_sitesModel));
|
||||
m_engine->rootContext()->setContextProperty("SitesController", m_sitesController.get());
|
||||
|
||||
m_systemController.reset(new SystemController(m_settings));
|
||||
m_engine->rootContext()->setContextProperty("SystemController", m_systemController.get());
|
||||
|
||||
m_cloudController.reset(new ApiController(m_serversModel, m_containersModel));
|
||||
m_engine->rootContext()->setContextProperty("ApiController", m_cloudController.get());
|
||||
}
|
||||
|
||||
+127
-127
@@ -1,127 +1,127 @@
|
||||
#ifndef AMNEZIA_APPLICATION_H
|
||||
#define AMNEZIA_APPLICATION_H
|
||||
|
||||
#include <QCommandLineParser>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QThread>
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
#include <QGuiApplication>
|
||||
#else
|
||||
#include <QApplication>
|
||||
#endif
|
||||
|
||||
#include "settings.h"
|
||||
#include "vpnconnection.h"
|
||||
|
||||
#include "configurators/vpn_configurator.h"
|
||||
|
||||
#include "ui/controllers/connectionController.h"
|
||||
#include "ui/controllers/exportController.h"
|
||||
#include "ui/controllers/importController.h"
|
||||
#include "ui/controllers/installController.h"
|
||||
#include "ui/controllers/pageController.h"
|
||||
#include "ui/controllers/settingsController.h"
|
||||
#include "ui/controllers/sitesController.h"
|
||||
#include "ui/controllers/systemController.h"
|
||||
#include "ui/controllers/apiController.h"
|
||||
#include "ui/models/containers_model.h"
|
||||
#include "ui/models/languageModel.h"
|
||||
#include "ui/models/protocols/cloakConfigModel.h"
|
||||
#include "ui/notificationhandler.h"
|
||||
#ifdef Q_OS_WINDOWS
|
||||
#include "ui/models/protocols/ikev2ConfigModel.h"
|
||||
#endif
|
||||
#include "ui/models/protocols/awgConfigModel.h"
|
||||
#include "ui/models/protocols/openvpnConfigModel.h"
|
||||
#include "ui/models/protocols/shadowsocksConfigModel.h"
|
||||
#include "ui/models/protocols/wireguardConfigModel.h"
|
||||
#include "ui/models/protocols_model.h"
|
||||
#include "ui/models/servers_model.h"
|
||||
#include "ui/models/services/sftpConfigModel.h"
|
||||
#include "ui/models/sites_model.h"
|
||||
#include "ui/models/clientManagementModel.h"
|
||||
|
||||
#define amnApp (static_cast<AmneziaApplication *>(QCoreApplication::instance()))
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
#define AMNEZIA_BASE_CLASS QGuiApplication
|
||||
#else
|
||||
#define AMNEZIA_BASE_CLASS SingleApplication
|
||||
#define QAPPLICATION_CLASS QApplication
|
||||
#include "singleapplication.h"
|
||||
#endif
|
||||
|
||||
class AmneziaApplication : public AMNEZIA_BASE_CLASS
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
AmneziaApplication(int &argc, char *argv[]);
|
||||
#else
|
||||
AmneziaApplication(int &argc, char *argv[], bool allowSecondary = false,
|
||||
SingleApplication::Options options = SingleApplication::User, int timeout = 1000,
|
||||
const QString &userData = {});
|
||||
#endif
|
||||
virtual ~AmneziaApplication();
|
||||
|
||||
void init();
|
||||
void registerTypes();
|
||||
void loadFonts();
|
||||
void loadTranslator();
|
||||
void updateTranslator(const QLocale &locale);
|
||||
bool parseCommands();
|
||||
|
||||
QQmlApplicationEngine *qmlEngine() const;
|
||||
|
||||
signals:
|
||||
void translationsUpdated();
|
||||
|
||||
private:
|
||||
void initModels();
|
||||
void initControllers();
|
||||
|
||||
QQmlApplicationEngine *m_engine {};
|
||||
std::shared_ptr<Settings> m_settings;
|
||||
std::shared_ptr<VpnConfigurator> m_configurator;
|
||||
|
||||
QSharedPointer<ContainerProps> m_containerProps;
|
||||
QSharedPointer<ProtocolProps> m_protocolProps;
|
||||
|
||||
QSharedPointer<QTranslator> m_translator;
|
||||
QCommandLineParser m_parser;
|
||||
|
||||
QSharedPointer<ContainersModel> m_containersModel;
|
||||
QSharedPointer<ServersModel> m_serversModel;
|
||||
QSharedPointer<LanguageModel> m_languageModel;
|
||||
QSharedPointer<ProtocolsModel> m_protocolsModel;
|
||||
QSharedPointer<SitesModel> m_sitesModel;
|
||||
QSharedPointer<ClientManagementModel> m_clientManagementModel;
|
||||
|
||||
QScopedPointer<OpenVpnConfigModel> m_openVpnConfigModel;
|
||||
QScopedPointer<ShadowSocksConfigModel> m_shadowSocksConfigModel;
|
||||
QScopedPointer<CloakConfigModel> m_cloakConfigModel;
|
||||
QScopedPointer<WireGuardConfigModel> m_wireGuardConfigModel;
|
||||
QScopedPointer<AwgConfigModel> m_awgConfigModel;
|
||||
#ifdef Q_OS_WINDOWS
|
||||
QScopedPointer<Ikev2ConfigModel> m_ikev2ConfigModel;
|
||||
#endif
|
||||
|
||||
QScopedPointer<SftpConfigModel> m_sftpConfigModel;
|
||||
|
||||
QSharedPointer<VpnConnection> m_vpnConnection;
|
||||
QThread m_vpnConnectionThread;
|
||||
QScopedPointer<NotificationHandler> m_notificationHandler;
|
||||
|
||||
QScopedPointer<ConnectionController> m_connectionController;
|
||||
QScopedPointer<PageController> m_pageController;
|
||||
QScopedPointer<InstallController> m_installController;
|
||||
QScopedPointer<ImportController> m_importController;
|
||||
QScopedPointer<ExportController> m_exportController;
|
||||
QScopedPointer<SettingsController> m_settingsController;
|
||||
QScopedPointer<SitesController> m_sitesController;
|
||||
QScopedPointer<SystemController> m_systemController;
|
||||
QScopedPointer<ApiController> m_cloudController;
|
||||
};
|
||||
|
||||
#endif // AMNEZIA_APPLICATION_H
|
||||
#ifndef AMNEZIA_APPLICATION_H
|
||||
#define AMNEZIA_APPLICATION_H
|
||||
|
||||
#include <QCommandLineParser>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QThread>
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
#include <QGuiApplication>
|
||||
#else
|
||||
#include <QApplication>
|
||||
#endif
|
||||
|
||||
#include "settings.h"
|
||||
#include "vpnconnection.h"
|
||||
|
||||
#include "configurators/vpn_configurator.h"
|
||||
|
||||
#include "ui/controllers/connectionController.h"
|
||||
#include "ui/controllers/exportController.h"
|
||||
#include "ui/controllers/importController.h"
|
||||
#include "ui/controllers/installController.h"
|
||||
#include "ui/controllers/pageController.h"
|
||||
#include "ui/controllers/settingsController.h"
|
||||
#include "ui/controllers/sitesController.h"
|
||||
#include "ui/controllers/systemController.h"
|
||||
#include "ui/controllers/apiController.h"
|
||||
#include "ui/models/containers_model.h"
|
||||
#include "ui/models/languageModel.h"
|
||||
#include "ui/models/protocols/cloakConfigModel.h"
|
||||
#include "ui/notificationhandler.h"
|
||||
#ifdef Q_OS_WINDOWS
|
||||
#include "ui/models/protocols/ikev2ConfigModel.h"
|
||||
#endif
|
||||
#include "ui/models/protocols/awgConfigModel.h"
|
||||
#include "ui/models/protocols/openvpnConfigModel.h"
|
||||
#include "ui/models/protocols/shadowsocksConfigModel.h"
|
||||
#include "ui/models/protocols/wireguardConfigModel.h"
|
||||
#include "ui/models/protocols_model.h"
|
||||
#include "ui/models/servers_model.h"
|
||||
#include "ui/models/services/sftpConfigModel.h"
|
||||
#include "ui/models/sites_model.h"
|
||||
#include "ui/models/clientManagementModel.h"
|
||||
|
||||
#define amnApp (static_cast<AmneziaApplication *>(QCoreApplication::instance()))
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
#define AMNEZIA_BASE_CLASS QGuiApplication
|
||||
#else
|
||||
#define AMNEZIA_BASE_CLASS SingleApplication
|
||||
#define QAPPLICATION_CLASS QApplication
|
||||
#include "singleapplication.h"
|
||||
#endif
|
||||
|
||||
class AmneziaApplication : public AMNEZIA_BASE_CLASS
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
AmneziaApplication(int &argc, char *argv[]);
|
||||
#else
|
||||
AmneziaApplication(int &argc, char *argv[], bool allowSecondary = false,
|
||||
SingleApplication::Options options = SingleApplication::User, int timeout = 1000,
|
||||
const QString &userData = {});
|
||||
#endif
|
||||
virtual ~AmneziaApplication();
|
||||
|
||||
void init();
|
||||
void registerTypes();
|
||||
void loadFonts();
|
||||
void loadTranslator();
|
||||
void updateTranslator(const QLocale &locale);
|
||||
bool parseCommands();
|
||||
|
||||
QQmlApplicationEngine *qmlEngine() const;
|
||||
|
||||
signals:
|
||||
void translationsUpdated();
|
||||
|
||||
private:
|
||||
void initModels();
|
||||
void initControllers();
|
||||
|
||||
QQmlApplicationEngine *m_engine {};
|
||||
std::shared_ptr<Settings> m_settings;
|
||||
std::shared_ptr<VpnConfigurator> m_configurator;
|
||||
|
||||
QSharedPointer<ContainerProps> m_containerProps;
|
||||
QSharedPointer<ProtocolProps> m_protocolProps;
|
||||
|
||||
QSharedPointer<QTranslator> m_translator;
|
||||
QCommandLineParser m_parser;
|
||||
|
||||
QSharedPointer<ContainersModel> m_containersModel;
|
||||
QSharedPointer<ServersModel> m_serversModel;
|
||||
QSharedPointer<LanguageModel> m_languageModel;
|
||||
QSharedPointer<ProtocolsModel> m_protocolsModel;
|
||||
QSharedPointer<SitesModel> m_sitesModel;
|
||||
QSharedPointer<ClientManagementModel> m_clientManagementModel;
|
||||
|
||||
QScopedPointer<OpenVpnConfigModel> m_openVpnConfigModel;
|
||||
QScopedPointer<ShadowSocksConfigModel> m_shadowSocksConfigModel;
|
||||
QScopedPointer<CloakConfigModel> m_cloakConfigModel;
|
||||
QScopedPointer<WireGuardConfigModel> m_wireGuardConfigModel;
|
||||
QScopedPointer<AwgConfigModel> m_awgConfigModel;
|
||||
#ifdef Q_OS_WINDOWS
|
||||
QScopedPointer<Ikev2ConfigModel> m_ikev2ConfigModel;
|
||||
#endif
|
||||
|
||||
QScopedPointer<SftpConfigModel> m_sftpConfigModel;
|
||||
|
||||
QSharedPointer<VpnConnection> m_vpnConnection;
|
||||
QThread m_vpnConnectionThread;
|
||||
QScopedPointer<NotificationHandler> m_notificationHandler;
|
||||
|
||||
QScopedPointer<ConnectionController> m_connectionController;
|
||||
QScopedPointer<PageController> m_pageController;
|
||||
QScopedPointer<InstallController> m_installController;
|
||||
QScopedPointer<ImportController> m_importController;
|
||||
QScopedPointer<ExportController> m_exportController;
|
||||
QScopedPointer<SettingsController> m_settingsController;
|
||||
QScopedPointer<SitesController> m_sitesController;
|
||||
QScopedPointer<SystemController> m_systemController;
|
||||
QScopedPointer<ApiController> m_cloudController;
|
||||
};
|
||||
|
||||
#endif // AMNEZIA_APPLICATION_H
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Leave package attribute for androiddeployqt -->
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.amnezia.vpn"
|
||||
android:versionName="-- %%INSERT_VERSION_NAME%% --"
|
||||
android:versionCode="-- %%INSERT_VERSION_CODE%% --"
|
||||
@@ -24,6 +22,7 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
|
||||
<!-- Enable when VPN-per-app mode will be implemented -->
|
||||
<!-- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/> -->
|
||||
@@ -33,17 +32,13 @@
|
||||
android:label="-- %%INSERT_APP_NAME%% --"
|
||||
android:icon="@mipmap/icon"
|
||||
android:roundIcon="@mipmap/icon_round"
|
||||
android:theme="@style/NoActionBar"
|
||||
android:fullBackupContent="@xml/backup_content"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
tools:targetApi="s">
|
||||
android:theme="@style/NoActionBar">
|
||||
|
||||
<activity
|
||||
android:name=".AmneziaActivity"
|
||||
android:configChanges="uiMode|screenSize|smallestScreenSize|screenLayout|orientation|density
|
||||
|fontScale|layoutDirection|locale|keyboard|keyboardHidden|navigation|mcc|mnc"
|
||||
android:launchMode="singleInstance"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
@@ -152,7 +147,7 @@
|
||||
android:authorities="org.amnezia.vpn.qtprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/qtprovider_paths" />
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/qtprovider_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -108,6 +108,7 @@ dependencies {
|
||||
implementation(project(":cloak"))
|
||||
implementation(libs.androidx.core)
|
||||
implementation(libs.androidx.activity)
|
||||
implementation(libs.androidx.security.crypto)
|
||||
implementation(libs.kotlinx.coroutines)
|
||||
implementation(libs.bundles.androidx.camera)
|
||||
implementation(libs.google.mlkit)
|
||||
|
||||
+39
-39
@@ -52,7 +52,7 @@ class OpenVpnClient(
|
||||
// Callback to construct a new tun builder
|
||||
// Should be called first.
|
||||
override fun tun_builder_new(): Boolean {
|
||||
Log.d(TAG, "tun_builder_new")
|
||||
Log.v(TAG, "tun_builder_new")
|
||||
configBuilder.clearAddresses()
|
||||
return true
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class OpenVpnClient(
|
||||
// Callback to set MTU of the VPN interface
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_mtu(mtu: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_mtu: $mtu")
|
||||
Log.v(TAG, "tun_builder_set_mtu: $mtu")
|
||||
configBuilder.setMtu(mtu)
|
||||
return true
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class OpenVpnClient(
|
||||
address: String, prefix_length: Int,
|
||||
gateway: String, ipv6: Boolean, net30: Boolean
|
||||
): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_address: $address, $prefix_length, $gateway, $ipv6, $net30")
|
||||
Log.v(TAG, "tun_builder_add_address: $address, $prefix_length, $gateway, $ipv6, $net30")
|
||||
configBuilder.addAddress(InetNetwork(address, prefix_length))
|
||||
return true
|
||||
}
|
||||
@@ -80,7 +80,7 @@ class OpenVpnClient(
|
||||
// May be called more than once per tun_builder session
|
||||
// metric is optional and should be ignored if < 0
|
||||
override fun tun_builder_add_route(address: String, prefix_length: Int, metric: Int, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_route: $address, $prefix_length, $metric, $ipv6")
|
||||
Log.v(TAG, "tun_builder_add_route: $address, $prefix_length, $metric, $ipv6")
|
||||
if (address == "remote_host") return false
|
||||
configBuilder.addRoute(InetNetwork(address, prefix_length))
|
||||
return true
|
||||
@@ -90,7 +90,7 @@ class OpenVpnClient(
|
||||
// May be called more than once per tun_builder session
|
||||
// metric is optional and should be ignored if < 0
|
||||
override fun tun_builder_exclude_route(address: String, prefix_length: Int, metric: Int, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_exclude_route: $address, $prefix_length, $metric, $ipv6")
|
||||
Log.v(TAG, "tun_builder_exclude_route: $address, $prefix_length, $metric, $ipv6")
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
configBuilder.excludeRoute(InetNetwork(address, prefix_length))
|
||||
}
|
||||
@@ -104,7 +104,7 @@ class OpenVpnClient(
|
||||
// domain should be routed.
|
||||
// Guaranteed to be called after tun_builder_reroute_gw.
|
||||
override fun tun_builder_add_dns_server(address: String, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_dns_server: $address, $ipv6")
|
||||
Log.v(TAG, "tun_builder_add_dns_server: $address, $ipv6")
|
||||
configBuilder.addDnsServer(parseInetAddress(address))
|
||||
return true
|
||||
}
|
||||
@@ -119,28 +119,28 @@ class OpenVpnClient(
|
||||
// ignored for that family
|
||||
// See also Android's VPNService.Builder.allowFamily method
|
||||
/* override fun tun_builder_set_allow_family(af: Int, allow: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_allow_family: $af, $allow")
|
||||
Log.v(TAG, "tun_builder_set_allow_family: $af, $allow")
|
||||
return true
|
||||
} */
|
||||
|
||||
// Callback to set address of remote server
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_remote_address(address: String, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_remote_address: $address, $ipv6")
|
||||
Log.v(TAG, "tun_builder_set_remote_address: $address, $ipv6")
|
||||
return true
|
||||
}
|
||||
|
||||
// Optional callback that indicates OSI layer, should be 2 or 3.
|
||||
// Defaults to 3.
|
||||
override fun tun_builder_set_layer(layer: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_layer: $layer")
|
||||
Log.v(TAG, "tun_builder_set_layer: $layer")
|
||||
return layer == 3
|
||||
}
|
||||
|
||||
// Callback to set the session name
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_session_name(name: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_session_name: $name")
|
||||
Log.v(TAG, "tun_builder_set_session_name: $name")
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ class OpenVpnClient(
|
||||
// if the tunnel could not be established.
|
||||
// Always called last after tun_builder session has been configured.
|
||||
override fun tun_builder_establish(): Int {
|
||||
Log.d(TAG, "tun_builder_establish")
|
||||
Log.v(TAG, "tun_builder_establish")
|
||||
return establish(configBuilder)
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class OpenVpnClient(
|
||||
// flags are defined in RGWFlags (rgwflags.hpp).
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_reroute_gw(ipv4: Boolean, ipv6: Boolean, flags: Long): Boolean {
|
||||
Log.d(TAG, "tun_builder_reroute_gw: $ipv4, $ipv6, $flags")
|
||||
Log.v(TAG, "tun_builder_reroute_gw: $ipv4, $ipv6, $flags")
|
||||
if ((flags and EMULATED_EXCLUDE_ROUTES.toLong()) != 0L) return true
|
||||
if (ipv4) {
|
||||
configBuilder.addRoute(InetNetwork("0.0.0.0", 0))
|
||||
@@ -176,7 +176,7 @@ class OpenVpnClient(
|
||||
// reroute_dns parameter.
|
||||
// Guaranteed to be called after tun_builder_reroute_gw.
|
||||
override fun tun_builder_add_search_domain(domain: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_search_domain: $domain")
|
||||
Log.v(TAG, "tun_builder_add_search_domain: $domain")
|
||||
configBuilder.setSearchDomain(domain)
|
||||
return true
|
||||
}
|
||||
@@ -184,7 +184,7 @@ class OpenVpnClient(
|
||||
// Callback to set the HTTP proxy
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_proxy_http(host: String, port: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_proxy_http: $host, $port")
|
||||
Log.v(TAG, "tun_builder_set_proxy_http: $host, $port")
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
try {
|
||||
configBuilder.setHttpProxy(ProxyInfo.buildDirectProxy(host, port))
|
||||
@@ -199,7 +199,7 @@ class OpenVpnClient(
|
||||
// Callback to set the HTTPS proxy
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_proxy_https(host: String, port: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_proxy_https: $host, $port")
|
||||
Log.v(TAG, "tun_builder_set_proxy_https: $host, $port")
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ class OpenVpnClient(
|
||||
// to exclude them from the VPN network are generated
|
||||
// This should be a list of CIDR networks (e.g. 192.168.0.0/24)
|
||||
override fun tun_builder_get_local_networks(ipv6: Boolean): ClientAPI_StringVec {
|
||||
Log.d(TAG, "tun_builder_get_local_networks: $ipv6")
|
||||
Log.v(TAG, "tun_builder_get_local_networks: $ipv6")
|
||||
val networks = ClientAPI_StringVec()
|
||||
for (address in getLocalNetworks(ipv6)) {
|
||||
networks.add(address.toString())
|
||||
@@ -222,21 +222,21 @@ class OpenVpnClient(
|
||||
// tun_builder_reroute_gw. Route metric is ignored
|
||||
// if < 0.
|
||||
/* override fun tun_builder_set_route_metric_default(metric: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_route_metric_default: $metric")
|
||||
Log.v(TAG, "tun_builder_set_route_metric_default: $metric")
|
||||
return super.tun_builder_set_route_metric_default(metric)
|
||||
} */
|
||||
|
||||
// Callback to add a host which should bypass the proxy
|
||||
// May be called more than once per tun_builder session
|
||||
/* override fun tun_builder_add_proxy_bypass(bypass_host: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_proxy_bypass: $bypass_host")
|
||||
Log.v(TAG, "tun_builder_add_proxy_bypass: $bypass_host")
|
||||
return super.tun_builder_add_proxy_bypass(bypass_host)
|
||||
} */
|
||||
|
||||
// Callback to set the proxy "Auto Config URL"
|
||||
// Never called more than once per tun_builder session.
|
||||
/* override fun tun_builder_set_proxy_auto_config_url(url: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_proxy_auto_config_url: $url")
|
||||
Log.v(TAG, "tun_builder_set_proxy_auto_config_url: $url")
|
||||
return super.tun_builder_set_proxy_auto_config_url(url)
|
||||
} */
|
||||
|
||||
@@ -245,7 +245,7 @@ class OpenVpnClient(
|
||||
// May be called more than once per tun_builder session.
|
||||
// Guaranteed to be called after tun_builder_reroute_gw.
|
||||
/* override fun tun_builder_add_wins_server(address: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_wins_server: $address")
|
||||
Log.v(TAG, "tun_builder_add_wins_server: $address")
|
||||
return super.tun_builder_add_wins_server(address)
|
||||
} */
|
||||
|
||||
@@ -254,7 +254,7 @@ class OpenVpnClient(
|
||||
// set the "Connection-specific DNS Suffix" property on
|
||||
// the TAP driver.
|
||||
/* override fun tun_builder_set_adapter_domain_suffix(name: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_adapter_domain_suffix: $name")
|
||||
Log.v(TAG, "tun_builder_set_adapter_domain_suffix: $name")
|
||||
return super.tun_builder_set_adapter_domain_suffix(name)
|
||||
} */
|
||||
|
||||
@@ -266,13 +266,13 @@ class OpenVpnClient(
|
||||
// tun_builder_establish_lite() will be called. Otherwise,
|
||||
// tun_builder_establish() will be called.
|
||||
/* override fun tun_builder_persist(): Boolean {
|
||||
Log.d(TAG, "tun_builder_persist")
|
||||
Log.v(TAG, "tun_builder_persist")
|
||||
return super.tun_builder_persist()
|
||||
} */
|
||||
|
||||
// Indicates a reconnection with persisted tun state.
|
||||
/* override fun tun_builder_establish_lite() {
|
||||
Log.d(TAG, "tun_builder_establish_lite")
|
||||
Log.v(TAG, "tun_builder_establish_lite")
|
||||
super.tun_builder_establish_lite()
|
||||
} */
|
||||
|
||||
@@ -280,7 +280,7 @@ class OpenVpnClient(
|
||||
// If disconnect == true, then the teardown is occurring
|
||||
// prior to final disconnect.
|
||||
/* override fun tun_builder_teardown(disconnect: Boolean) {
|
||||
Log.d(TAG, "tun_builder_teardown: $disconnect")
|
||||
Log.v(TAG, "tun_builder_teardown: $disconnect")
|
||||
super.tun_builder_teardown(disconnect)
|
||||
} */
|
||||
|
||||
@@ -290,7 +290,7 @@ class OpenVpnClient(
|
||||
|
||||
// Parse OpenVPN configuration file.
|
||||
override fun eval_config(arg0: ClientAPI_Config): ClientAPI_EvalConfig {
|
||||
Log.d(TAG, "eval_config")
|
||||
Log.v(TAG, "eval_config")
|
||||
return super.eval_config(arg0)
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ class OpenVpnClient(
|
||||
// to event() and log() functions. Make sure to call eval_config()
|
||||
// and possibly provide_creds() as well before this function.
|
||||
override fun connect(): ClientAPI_Status {
|
||||
Log.d(TAG, "connect")
|
||||
Log.v(TAG, "connect")
|
||||
return super.connect()
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ class OpenVpnClient(
|
||||
// Will be called from the thread executing connect().
|
||||
// The remote and ipv6 are the remote host this socket will connect to
|
||||
override fun socket_protect(socket: Int, remote: String, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "socket_protect: $socket, $remote, $ipv6")
|
||||
Log.v(TAG, "socket_protect: $socket, $remote, $ipv6")
|
||||
return protect(socket)
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ class OpenVpnClient(
|
||||
// May be called asynchronously from a different thread
|
||||
// when connect() is running.
|
||||
override fun stop() {
|
||||
Log.d(TAG, "stop")
|
||||
Log.v(TAG, "stop")
|
||||
super.stop()
|
||||
}
|
||||
|
||||
@@ -323,21 +323,21 @@ class OpenVpnClient(
|
||||
// when network is down. May be called from a different thread
|
||||
// when connect() is running.
|
||||
override fun pause(reason: String) {
|
||||
Log.d(TAG, "pause: $reason")
|
||||
Log.v(TAG, "pause: $reason")
|
||||
super.pause(reason)
|
||||
}
|
||||
|
||||
// Resume the client after it has been paused. May be called from a
|
||||
// different thread when connect() is running.
|
||||
override fun resume() {
|
||||
Log.d(TAG, "resume")
|
||||
Log.v(TAG, "resume")
|
||||
super.resume()
|
||||
}
|
||||
|
||||
// Do a disconnect/reconnect cycle n seconds from now. May be called
|
||||
// from a different thread when connect() is running.
|
||||
override fun reconnect(seconds: Int) {
|
||||
Log.d(TAG, "reconnect: $seconds")
|
||||
Log.v(TAG, "reconnect")
|
||||
super.reconnect(seconds)
|
||||
}
|
||||
|
||||
@@ -346,14 +346,14 @@ class OpenVpnClient(
|
||||
// CONNECTION_TIMEOUT event. If true, the core will enter a PAUSE
|
||||
// state.
|
||||
override fun pause_on_connection_timeout(): Boolean {
|
||||
Log.d(TAG, "pause_on_connection_timeout")
|
||||
Log.v(TAG, "pause_on_connection_timeout")
|
||||
return false
|
||||
}
|
||||
|
||||
// Return information about the most recent connection. Should be called
|
||||
// after an event of type "CONNECTED".
|
||||
/* override fun connection_info(): ClientAPI_ConnectionInfo {
|
||||
Log.d(TAG, "connection_info")
|
||||
Log.v(TAG, "connection_info")
|
||||
return super.connection_info()
|
||||
} */
|
||||
|
||||
@@ -366,7 +366,7 @@ class OpenVpnClient(
|
||||
override fun event(event: ClientAPI_Event) {
|
||||
val name = event.name
|
||||
val info = event.info
|
||||
Log.d(TAG, "OpenVpn event: $name: $info")
|
||||
Log.v(TAG, "OpenVpn event: $name: $info")
|
||||
when (name) {
|
||||
"COMPRESSION_ENABLED", "WARN" -> Log.w(TAG, "$name: $info")
|
||||
"CONNECTED" -> state.value = CONNECTED
|
||||
@@ -398,31 +398,31 @@ class OpenVpnClient(
|
||||
|
||||
// return transport stats only
|
||||
override fun transport_stats(): ClientAPI_TransportStats {
|
||||
Log.d(TAG, "transport_stats")
|
||||
Log.v(TAG, "transport_stats")
|
||||
return super.transport_stats()
|
||||
}
|
||||
|
||||
// return a stats value, index should be >= 0 and < stats_n()
|
||||
/* override fun stats_value(index: Int): Long {
|
||||
Log.d(TAG, "stats_value: $index")
|
||||
Log.v(TAG, "stats_value: $index")
|
||||
return super.stats_value(index)
|
||||
} */
|
||||
|
||||
// return all stats in a bundle
|
||||
/* override fun stats_bundle(): ClientAPI_LLVector {
|
||||
Log.d(TAG, "stats_bundle")
|
||||
Log.v(TAG, "stats_bundle")
|
||||
return super.stats_bundle()
|
||||
} */
|
||||
|
||||
// return tun stats only
|
||||
/* override fun tun_stats(): ClientAPI_InterfaceStats {
|
||||
Log.d(TAG, "tun_stats")
|
||||
Log.v(TAG, "tun_stats")
|
||||
return super.tun_stats()
|
||||
} */
|
||||
|
||||
// post control channel message
|
||||
/* override fun post_cc_msg(msg: String) {
|
||||
Log.d(TAG, "post_cc_msg: $msg")
|
||||
Log.v(TAG, "post_cc_msg: $msg")
|
||||
super.post_cc_msg(msg)
|
||||
} */
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<full-backup-content>
|
||||
<exclude domain="sharedpref" path="." />
|
||||
</full-backup-content>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<exclude domain="sharedpref" path="." />
|
||||
</cloud-backup>
|
||||
<device-transfer>
|
||||
<exclude domain="sharedpref" path="." />
|
||||
</device-transfer>
|
||||
</data-extraction-rules>
|
||||
@@ -2,10 +2,8 @@ package org.amnezia.vpn
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.content.Intent.EXTRA_MIME_TYPES
|
||||
import android.content.Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
|
||||
import android.content.ServiceConnection
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.net.VpnService
|
||||
import android.os.Bundle
|
||||
@@ -14,13 +12,11 @@ import android.os.IBinder
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.os.Messenger
|
||||
import android.webkit.MimeTypeMap
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.core.content.ContextCompat
|
||||
import java.io.IOException
|
||||
import kotlin.LazyThreadSafetyMode.NONE
|
||||
import kotlin.text.RegexOption.IGNORE_CASE
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -39,7 +35,6 @@ private const val TAG = "AmneziaActivity"
|
||||
|
||||
private const val CHECK_VPN_PERMISSION_ACTION_CODE = 1
|
||||
private const val CREATE_FILE_ACTION_CODE = 2
|
||||
private const val OPEN_FILE_ACTION_CODE = 3
|
||||
private const val BIND_SERVICE_TIMEOUT = 1000L
|
||||
|
||||
class AmneziaActivity : QtActivity() {
|
||||
@@ -144,7 +139,7 @@ class AmneziaActivity : QtActivity() {
|
||||
*/
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
Log.d(TAG, "Create Amnezia activity: $intent")
|
||||
Log.v(TAG, "Create Amnezia activity: $intent")
|
||||
mainScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
||||
vpnServiceMessenger = IpcMessenger(
|
||||
onDeadObjectException = ::doUnbindService,
|
||||
@@ -155,7 +150,7 @@ class AmneziaActivity : QtActivity() {
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
Log.d(TAG, "onNewIntent: $intent")
|
||||
Log.v(TAG, "onNewIntent: $intent")
|
||||
intent?.let(::processIntent)
|
||||
}
|
||||
|
||||
@@ -175,7 +170,7 @@ class AmneziaActivity : QtActivity() {
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
Log.d(TAG, "Start Amnezia activity")
|
||||
Log.v(TAG, "Start Amnezia activity")
|
||||
mainScope.launch {
|
||||
qtInitialized.await()
|
||||
doBindService()
|
||||
@@ -183,13 +178,13 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
Log.d(TAG, "Stop Amnezia activity")
|
||||
Log.v(TAG, "Stop Amnezia activity")
|
||||
doUnbindService()
|
||||
super.onStop()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
Log.d(TAG, "Destroy Amnezia activity")
|
||||
Log.v(TAG, "Destroy Amnezia activity")
|
||||
mainScope.cancel()
|
||||
super.onDestroy()
|
||||
}
|
||||
@@ -206,19 +201,10 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
OPEN_FILE_ACTION_CODE -> {
|
||||
when (resultCode) {
|
||||
RESULT_OK -> data?.data?.toString() ?: ""
|
||||
else -> ""
|
||||
}.let { uri ->
|
||||
QtAndroidController.onFileOpened(uri)
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_VPN_PERMISSION_ACTION_CODE -> {
|
||||
when (resultCode) {
|
||||
RESULT_OK -> {
|
||||
Log.d(TAG, "Vpn permission granted")
|
||||
Log.v(TAG, "Vpn permission granted")
|
||||
Toast.makeText(this, "Vpn permission granted", Toast.LENGTH_LONG).show()
|
||||
checkVpnPermissionCallbacks?.run { onSuccess() }
|
||||
}
|
||||
@@ -241,7 +227,7 @@ class AmneziaActivity : QtActivity() {
|
||||
*/
|
||||
@MainThread
|
||||
private fun doBindService() {
|
||||
Log.d(TAG, "Bind service")
|
||||
Log.v(TAG, "Bind service")
|
||||
Intent(this, AmneziaVpnService::class.java).also {
|
||||
bindService(it, serviceConnection, BIND_ABOVE_CLIENT)
|
||||
}
|
||||
@@ -252,7 +238,7 @@ class AmneziaActivity : QtActivity() {
|
||||
@MainThread
|
||||
private fun doUnbindService() {
|
||||
if (isInBoundState) {
|
||||
Log.d(TAG, "Unbind service")
|
||||
Log.v(TAG, "Unbind service")
|
||||
isWaitingStatus = true
|
||||
QtAndroidController.onServiceDisconnected()
|
||||
vpnServiceMessenger.reset()
|
||||
@@ -287,7 +273,7 @@ class AmneziaActivity : QtActivity() {
|
||||
|
||||
@MainThread
|
||||
private fun checkVpnPermission(onSuccess: () -> Unit, onFail: () -> Unit) {
|
||||
Log.d(TAG, "Check VPN permission")
|
||||
Log.v(TAG, "Check VPN permission")
|
||||
VpnService.prepare(applicationContext)?.let {
|
||||
checkVpnPermissionCallbacks = CheckVpnPermissionCallbacks(onSuccess, onFail)
|
||||
startActivityForResult(it, CHECK_VPN_PERMISSION_ACTION_CODE)
|
||||
@@ -308,7 +294,7 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
|
||||
private fun connectToVpn(vpnConfig: String) {
|
||||
Log.d(TAG, "Connect to VPN")
|
||||
Log.v(TAG, "Connect to VPN")
|
||||
vpnServiceMessenger.send {
|
||||
Action.CONNECT.packToMessage {
|
||||
putString(VPN_CONFIG, vpnConfig)
|
||||
@@ -317,7 +303,7 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
|
||||
private fun startVpnService(vpnConfig: String) {
|
||||
Log.d(TAG, "Start VPN service")
|
||||
Log.v(TAG, "Start VPN service")
|
||||
Intent(this, AmneziaVpnService::class.java).apply {
|
||||
putExtra(VPN_CONFIG, vpnConfig)
|
||||
}.also {
|
||||
@@ -326,7 +312,7 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
|
||||
private fun disconnectFromVpn() {
|
||||
Log.d(TAG, "Disconnect from VPN")
|
||||
Log.v(TAG, "Disconnect from VPN")
|
||||
vpnServiceMessenger.send(Action.DISCONNECT)
|
||||
}
|
||||
|
||||
@@ -370,7 +356,7 @@ class AmneziaActivity : QtActivity() {
|
||||
|
||||
@Suppress("unused")
|
||||
fun saveFile(fileName: String, data: String) {
|
||||
Log.d(TAG, "Save file $fileName")
|
||||
Log.v(TAG, "Save file $fileName")
|
||||
mainScope.launch {
|
||||
tmpFileContentToSave = data
|
||||
|
||||
@@ -384,43 +370,17 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun openFile(filter: String?) {
|
||||
Log.v(TAG, "Open file with filter: $filter")
|
||||
|
||||
val mimeTypes = if (!filter.isNullOrEmpty()) {
|
||||
val extensionRegex = "\\*\\.[a-z .]+".toRegex(IGNORE_CASE)
|
||||
val mime = MimeTypeMap.getSingleton()
|
||||
extensionRegex.findAll(filter).map {
|
||||
mime.getMimeTypeFromExtension(it.value.drop(2))
|
||||
}.filterNotNull().toSet()
|
||||
} else emptySet()
|
||||
|
||||
Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
Log.v(TAG, "File mimyType filter: $mimeTypes")
|
||||
when (mimeTypes.size) {
|
||||
1 -> type = mimeTypes.first()
|
||||
|
||||
in 2..Int.MAX_VALUE -> {
|
||||
type = "*/*"
|
||||
putExtra(EXTRA_MIME_TYPES, mimeTypes.toTypedArray())
|
||||
}
|
||||
|
||||
else -> type = "*/*"
|
||||
}
|
||||
}.also {
|
||||
startActivityForResult(it, OPEN_FILE_ACTION_CODE)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun setNotificationText(title: String, message: String, timerSec: Int) {
|
||||
Log.v(TAG, "Set notification text")
|
||||
Log.w(TAG, "Not yet implemented")
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun isCameraPresent(): Boolean = applicationContext.packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)
|
||||
fun cleanupLogs() {
|
||||
Log.v(TAG, "Cleanup logs")
|
||||
Log.w(TAG, "Not yet implemented")
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun startQrCodeReader() {
|
||||
@@ -429,29 +389,4 @@ class AmneziaActivity : QtActivity() {
|
||||
startActivity(it)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun setSaveLogs(enabled: Boolean) {
|
||||
Log.d(TAG, "Set save logs: $enabled")
|
||||
mainScope.launch {
|
||||
Log.saveLogs = enabled
|
||||
vpnServiceMessenger.send {
|
||||
Action.SET_SAVE_LOGS.packToMessage {
|
||||
putBoolean(SAVE_LOGS, enabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun exportLogsFile(fileName: String) {
|
||||
Log.v(TAG, "Export logs file")
|
||||
saveFile(fileName, Log.getLogs())
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun clearLogs() {
|
||||
Log.v(TAG, "Clear logs")
|
||||
Log.clearLogs()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,20 +5,14 @@ import androidx.camera.core.CameraSelector
|
||||
import androidx.camera.core.CameraXConfig
|
||||
import androidx.core.app.NotificationChannelCompat.Builder
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import org.amnezia.vpn.util.Log
|
||||
import org.amnezia.vpn.util.Prefs
|
||||
import org.qtproject.qt.android.bindings.QtApplication
|
||||
|
||||
private const val TAG = "AmneziaApplication"
|
||||
const val NOTIFICATION_CHANNEL_ID: String = "org.amnezia.vpn.notification"
|
||||
|
||||
class AmneziaApplication : QtApplication(), CameraXConfig.Provider {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
Prefs.init(this)
|
||||
Log.init(this)
|
||||
Log.d(TAG, "Create Amnezia application")
|
||||
createNotificationChannel()
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ import org.amnezia.vpn.protocol.putStatistics
|
||||
import org.amnezia.vpn.protocol.putStatus
|
||||
import org.amnezia.vpn.protocol.wireguard.Wireguard
|
||||
import org.amnezia.vpn.util.Log
|
||||
import org.amnezia.vpn.util.Prefs
|
||||
import org.amnezia.vpn.util.net.NetworkState
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
@@ -59,8 +58,6 @@ private const val TAG = "AmneziaVpnService"
|
||||
|
||||
const val VPN_CONFIG = "VPN_CONFIG"
|
||||
const val ERROR_MSG = "ERROR_MSG"
|
||||
const val SAVE_LOGS = "SAVE_LOGS"
|
||||
|
||||
const val AFTER_PERMISSION_CHECK = "AFTER_PERMISSION_CHECK"
|
||||
private const val PREFS_CONFIG_KEY = "LAST_CONF"
|
||||
private const val NOTIFICATION_ID = 1337
|
||||
@@ -121,7 +118,7 @@ class AmneziaVpnService : VpnService() {
|
||||
|
||||
Action.CONNECT -> {
|
||||
val vpnConfig = msg.data.getString(VPN_CONFIG)
|
||||
Prefs.save(PREFS_CONFIG_KEY, vpnConfig)
|
||||
saveConfigToPrefs(vpnConfig)
|
||||
connect(vpnConfig)
|
||||
}
|
||||
|
||||
@@ -138,10 +135,6 @@ class AmneziaVpnService : VpnService() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Action.SET_SAVE_LOGS -> {
|
||||
Log.saveLogs = msg.data.getBoolean(SAVE_LOGS)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,7 +179,7 @@ class AmneziaVpnService : VpnService() {
|
||||
*/
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
Log.d(TAG, "Create Amnezia VPN service")
|
||||
Log.v(TAG, "Create Amnezia VPN service")
|
||||
mainScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
||||
connectionScope = CoroutineScope(SupervisorJob() + Dispatchers.IO + connectionExceptionHandler)
|
||||
clientMessenger = IpcMessenger(messengerName = "Client")
|
||||
@@ -200,15 +193,15 @@ class AmneziaVpnService : VpnService() {
|
||||
else intent?.component?.packageName != packageName
|
||||
|
||||
if (isAlwaysOnCompat) {
|
||||
Log.d(TAG, "Start service via Always-on")
|
||||
connect(Prefs.load(PREFS_CONFIG_KEY))
|
||||
Log.v(TAG, "Start service via Always-on")
|
||||
connect(loadConfigFromPrefs())
|
||||
} else if (intent?.getBooleanExtra(AFTER_PERMISSION_CHECK, false) == true) {
|
||||
Log.d(TAG, "Start service after permission check")
|
||||
connect(Prefs.load(PREFS_CONFIG_KEY))
|
||||
Log.v(TAG, "Start service after permission check")
|
||||
connect(loadConfigFromPrefs())
|
||||
} else {
|
||||
Log.d(TAG, "Start service")
|
||||
Log.v(TAG, "Start service")
|
||||
val vpnConfig = intent?.getStringExtra(VPN_CONFIG)
|
||||
Prefs.save(PREFS_CONFIG_KEY, vpnConfig)
|
||||
saveConfigToPrefs(vpnConfig)
|
||||
connect(vpnConfig)
|
||||
}
|
||||
ServiceCompat.startForeground(this, NOTIFICATION_ID, notification, foregroundServiceTypeCompat)
|
||||
@@ -244,7 +237,7 @@ class AmneziaVpnService : VpnService() {
|
||||
}
|
||||
|
||||
override fun onRevoke() {
|
||||
Log.d(TAG, "onRevoke")
|
||||
Log.v(TAG, "onRevoke")
|
||||
// Calls to onRevoke() method may not happen on the main thread of the process
|
||||
mainScope.launch {
|
||||
disconnect()
|
||||
@@ -252,7 +245,7 @@ class AmneziaVpnService : VpnService() {
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
Log.d(TAG, "Destroy service")
|
||||
Log.v(TAG, "Destroy service")
|
||||
runBlocking {
|
||||
disconnect()
|
||||
disconnectionJob?.join()
|
||||
@@ -263,7 +256,7 @@ class AmneziaVpnService : VpnService() {
|
||||
}
|
||||
|
||||
private fun stopService() {
|
||||
Log.d(TAG, "Stop service")
|
||||
Log.v(TAG, "Stop service")
|
||||
// the coroutine below will be canceled during the onDestroy call
|
||||
mainScope.launch {
|
||||
delay(STOP_SERVICE_TIMEOUT)
|
||||
@@ -279,7 +272,7 @@ class AmneziaVpnService : VpnService() {
|
||||
private fun launchProtocolStateHandler() {
|
||||
mainScope.launch {
|
||||
protocolState.collect { protocolState ->
|
||||
Log.d(TAG, "Protocol state changed: $protocolState")
|
||||
Log.d(TAG, "Protocol state: $protocolState")
|
||||
when (protocolState) {
|
||||
CONNECTED -> {
|
||||
clientMessenger.send(ServiceEvent.CONNECTED)
|
||||
@@ -312,7 +305,7 @@ class AmneziaVpnService : VpnService() {
|
||||
|
||||
@MainThread
|
||||
private fun launchSendingStatistics() {
|
||||
/* if (isServiceBound && isConnected) {
|
||||
if (isServiceBound && isConnected) {
|
||||
statisticsSendingJob = mainScope.launch {
|
||||
while (true) {
|
||||
clientMessenger.send {
|
||||
@@ -323,7 +316,7 @@ class AmneziaVpnService : VpnService() {
|
||||
delay(STATISTICS_SENDING_TIMEOUT)
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
@MainThread
|
||||
@@ -335,7 +328,7 @@ class AmneziaVpnService : VpnService() {
|
||||
private fun connect(vpnConfig: String?) {
|
||||
if (isConnected || protocolState.value == CONNECTING) return
|
||||
|
||||
Log.d(TAG, "Start VPN connection")
|
||||
Log.v(TAG, "Start VPN connection")
|
||||
|
||||
protocolState.value = CONNECTING
|
||||
|
||||
@@ -364,7 +357,7 @@ class AmneziaVpnService : VpnService() {
|
||||
private fun disconnect() {
|
||||
if (isUnknown || isDisconnected || protocolState.value == DISCONNECTING) return
|
||||
|
||||
Log.d(TAG, "Stop VPN connection")
|
||||
Log.v(TAG, "Stop VPN connection")
|
||||
|
||||
protocolState.value = DISCONNECTING
|
||||
|
||||
@@ -390,7 +383,7 @@ class AmneziaVpnService : VpnService() {
|
||||
private fun reconnect() {
|
||||
if (!isConnected) return
|
||||
|
||||
Log.d(TAG, "Reconnect VPN")
|
||||
Log.v(TAG, "Reconnect VPN")
|
||||
|
||||
protocolState.value = RECONNECTING
|
||||
|
||||
@@ -446,4 +439,10 @@ class AmneziaVpnService : VpnService() {
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|
||||
private fun loadConfigFromPrefs(): String? =
|
||||
Prefs.get(this).getString(PREFS_CONFIG_KEY, null)
|
||||
|
||||
private fun saveConfigToPrefs(config: String?) =
|
||||
Prefs.get(this).edit().putString(PREFS_CONFIG_KEY, config).apply()
|
||||
}
|
||||
|
||||
@@ -29,20 +29,20 @@ class ImportConfigActivity : ComponentActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
Log.d(TAG, "Create Import Config Activity: $intent")
|
||||
Log.v(TAG, "Create Import Config Activity: $intent")
|
||||
intent?.let(::readConfig)
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
Log.d(TAG, "onNewIntent: $intent")
|
||||
Log.v(TAG, "onNewIntent: $intent")
|
||||
intent?.let(::readConfig)
|
||||
}
|
||||
|
||||
private fun readConfig(intent: Intent) {
|
||||
when (intent.action) {
|
||||
ACTION_SEND -> {
|
||||
Log.d(TAG, "Process SEND action, type: ${intent.type}")
|
||||
Log.v(TAG, "Process SEND action, type: ${intent.type}")
|
||||
when (intent.type) {
|
||||
"application/octet-stream" -> {
|
||||
intent.getUriCompat()?.let { uri ->
|
||||
@@ -60,7 +60,7 @@ class ImportConfigActivity : ComponentActivity() {
|
||||
}
|
||||
|
||||
ACTION_VIEW -> {
|
||||
Log.d(TAG, "Process VIEW action, scheme: ${intent.scheme}")
|
||||
Log.v(TAG, "Process VIEW action, scheme: ${intent.scheme}")
|
||||
when (intent.scheme) {
|
||||
"file", "content" -> {
|
||||
intent.data?.let { uri ->
|
||||
@@ -128,7 +128,7 @@ class ImportConfigActivity : ComponentActivity() {
|
||||
|
||||
private fun startMainActivity(config: String) {
|
||||
if (config.isNotBlank()) {
|
||||
Log.d(TAG, "startMainActivity")
|
||||
Log.v(TAG, "startMainActivity")
|
||||
Intent(applicationContext, AmneziaActivity::class.java).apply {
|
||||
action = ACTION_IMPORT_CONFIG
|
||||
addCategory(CATEGORY_DEFAULT)
|
||||
|
||||
@@ -32,8 +32,7 @@ enum class Action : IpcMessage {
|
||||
REGISTER_CLIENT,
|
||||
CONNECT,
|
||||
DISCONNECT,
|
||||
REQUEST_STATUS,
|
||||
SET_SAVE_LOGS
|
||||
REQUEST_STATUS
|
||||
}
|
||||
|
||||
fun <T> T.packToMessage(): Message
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.security.crypto.EncryptedSharedPreferences
|
||||
import androidx.security.crypto.MasterKey
|
||||
import org.amnezia.vpn.util.Log
|
||||
|
||||
private const val TAG = "Prefs"
|
||||
private const val PREFS_FILE = "org.amnezia.vpn.prefs"
|
||||
private const val SECURE_PREFS_FILE = "$PREFS_FILE.secure"
|
||||
|
||||
object Prefs {
|
||||
fun get(context: Context, appContext: Context = context.applicationContext): SharedPreferences =
|
||||
try {
|
||||
EncryptedSharedPreferences(
|
||||
appContext,
|
||||
SECURE_PREFS_FILE,
|
||||
MasterKey(appContext)
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Getting Encryption Storage failed: ${e.message}, plaintext fallback")
|
||||
appContext.getSharedPreferences(PREFS_FILE, Context.MODE_PRIVATE)
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class VpnRequestActivity : ComponentActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
Log.d(TAG, "Start request activity")
|
||||
Log.v(TAG, "Start request activity")
|
||||
val requestIntent = VpnService.prepare(applicationContext)
|
||||
if (requestIntent != null) {
|
||||
if (getSystemService<KeyguardManager>()!!.isKeyguardLocked) {
|
||||
|
||||
@@ -15,8 +15,6 @@ object QtAndroidController {
|
||||
external fun onVpnReconnecting()
|
||||
external fun onStatisticsUpdate(rxBytes: Long, txBytes: Long)
|
||||
|
||||
external fun onFileOpened(uri: String)
|
||||
|
||||
external fun onConfigImported(data: String)
|
||||
|
||||
external fun decodeQrCode(data: String): Boolean
|
||||
|
||||
@@ -15,7 +15,3 @@ android {
|
||||
buildConfig = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.androidx.security.crypto)
|
||||
}
|
||||
|
||||
@@ -1,252 +1,33 @@
|
||||
package org.amnezia.vpn.util
|
||||
|
||||
import android.content.Context
|
||||
import android.icu.text.DateFormat
|
||||
import android.icu.text.SimpleDateFormat
|
||||
import android.os.Build
|
||||
import android.os.Process
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.RandomAccessFile
|
||||
import java.nio.channels.FileChannel
|
||||
import java.nio.channels.FileLock
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
import org.amnezia.vpn.util.Log.Priority.D
|
||||
import org.amnezia.vpn.util.Log.Priority.E
|
||||
import org.amnezia.vpn.util.Log.Priority.F
|
||||
import org.amnezia.vpn.util.Log.Priority.I
|
||||
import org.amnezia.vpn.util.Log.Priority.V
|
||||
import org.amnezia.vpn.util.Log.Priority.W
|
||||
import android.util.Log as NativeLog
|
||||
|
||||
private const val TAG = "Log"
|
||||
private const val LOG_FILE_NAME = "amneziaVPN.log"
|
||||
private const val ROTATE_LOG_FILE_NAME = "amneziaVPN.rotate.log"
|
||||
private const val LOCK_FILE_NAME = ".lock"
|
||||
private const val DATE_TIME_PATTERN = "MM-dd HH:mm:ss.SSS"
|
||||
private const val PREFS_SAVE_LOGS_KEY = "SAVE_LOGS"
|
||||
private const val LOG_MAX_FILE_SIZE = 1024 * 1024
|
||||
class Log {
|
||||
companion object {
|
||||
fun v(tag: String, msg: String) = debugLog(tag, msg, NativeLog::v)
|
||||
|
||||
/**
|
||||
* | Priority | Save to file | Logcat logging |
|
||||
* |-------------------|--------------|----------------------------------------------|
|
||||
* | Verbose | Don't save | Only in Debug build |
|
||||
* | Debug | Save | In Debug build or if log saving is enabled |
|
||||
* | Info, Warn, Error | Save | Enabled |
|
||||
* | Fatal (Assert) | Save | Enabled. Depending on system configuration, |
|
||||
* | | | create a report and/or terminate the process |
|
||||
*/
|
||||
object Log {
|
||||
private val dateTimeFormat: Any =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) DateTimeFormatter.ofPattern(DATE_TIME_PATTERN)
|
||||
else object : ThreadLocal<DateFormat>() {
|
||||
override fun initialValue(): DateFormat = SimpleDateFormat(DATE_TIME_PATTERN, Locale.US)
|
||||
fun d(tag: String, msg: String) = debugLog(tag, msg, NativeLog::d)
|
||||
|
||||
fun i(tag: String, msg: String) = log(tag, msg, NativeLog::i)
|
||||
|
||||
fun w(tag: String, msg: String) = log(tag, msg, NativeLog::w)
|
||||
|
||||
fun e(tag: String, msg: String) = log(tag, msg, NativeLog::e)
|
||||
|
||||
fun v(tag: String, msg: Any?) = v(tag, msg.toString())
|
||||
|
||||
fun d(tag: String, msg: Any?) = d(tag, msg.toString())
|
||||
|
||||
fun i(tag: String, msg: Any?) = i(tag, msg.toString())
|
||||
|
||||
fun w(tag: String, msg: Any?) = w(tag, msg.toString())
|
||||
|
||||
fun e(tag: String, msg: Any?) = e(tag, msg.toString())
|
||||
|
||||
private inline fun log(tag: String, msg: String, delegate: (String, String) -> Unit) = delegate(tag, msg)
|
||||
|
||||
private inline fun debugLog(tag: String, msg: String, delegate: (String, String) -> Unit) {
|
||||
if (BuildConfig.DEBUG) delegate(tag, msg)
|
||||
}
|
||||
|
||||
private lateinit var logDir: File
|
||||
private val logFile: File by lazy { File(logDir, LOG_FILE_NAME) }
|
||||
private val rotateLogFile: File by lazy { File(logDir, ROTATE_LOG_FILE_NAME) }
|
||||
|
||||
private val fileLock: FileChannel by lazy { RandomAccessFile(File(logDir, LOCK_FILE_NAME).path, "rw").channel }
|
||||
private val threadLock: ReentrantLock by lazy { ReentrantLock() }
|
||||
|
||||
@Volatile
|
||||
private var _saveLogs: Boolean = false
|
||||
var saveLogs: Boolean
|
||||
get() = _saveLogs
|
||||
set(value) {
|
||||
if (_saveLogs != value) {
|
||||
if (value && !logDir.exists() && !logDir.mkdir()) {
|
||||
NativeLog.e(TAG, "Failed to create dir: $logDir")
|
||||
return
|
||||
}
|
||||
_saveLogs = value
|
||||
Prefs.save(PREFS_SAVE_LOGS_KEY, value)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun v(tag: String, msg: String) = log(tag, msg, V)
|
||||
|
||||
@JvmStatic
|
||||
fun d(tag: String, msg: String) = log(tag, msg, D)
|
||||
|
||||
@JvmStatic
|
||||
fun i(tag: String, msg: String) = log(tag, msg, I)
|
||||
|
||||
@JvmStatic
|
||||
fun w(tag: String, msg: String) = log(tag, msg, W)
|
||||
|
||||
@JvmStatic
|
||||
fun e(tag: String, msg: String) = log(tag, msg, E)
|
||||
|
||||
@JvmStatic
|
||||
fun f(tag: String, msg: String) = log(tag, msg, F)
|
||||
|
||||
fun v(tag: String, msg: Any?) = v(tag, msg.toString())
|
||||
|
||||
fun d(tag: String, msg: Any?) = d(tag, msg.toString())
|
||||
|
||||
fun i(tag: String, msg: Any?) = i(tag, msg.toString())
|
||||
|
||||
fun w(tag: String, msg: Any?) = w(tag, msg.toString())
|
||||
|
||||
fun e(tag: String, msg: Any?) = e(tag, msg.toString())
|
||||
|
||||
fun f(tag: String, msg: Any?) = f(tag, msg.toString())
|
||||
|
||||
fun init(context: Context) {
|
||||
v(TAG, "Init Log")
|
||||
logDir = File(context.cacheDir, "logs")
|
||||
saveLogs = Prefs.load(PREFS_SAVE_LOGS_KEY)
|
||||
}
|
||||
|
||||
fun getLogs(): String =
|
||||
"${deviceInfo()}\n${readLogs()}\nLOGCAT:\n${getLogcat()}"
|
||||
|
||||
fun clearLogs() {
|
||||
withLock {
|
||||
logFile.delete()
|
||||
rotateLogFile.delete()
|
||||
}
|
||||
}
|
||||
|
||||
private fun log(tag: String, msg: String, priority: Priority) {
|
||||
if (saveLogs && priority != V) saveLogMsg(formatLogMsg(tag, msg, priority))
|
||||
|
||||
if (priority == F) {
|
||||
NativeLog.wtf(tag, msg)
|
||||
} else if (
|
||||
(priority != V && priority != D) ||
|
||||
(priority == V && BuildConfig.DEBUG) ||
|
||||
(priority == D && (BuildConfig.DEBUG || saveLogs))
|
||||
) {
|
||||
NativeLog.println(priority.level, tag, msg)
|
||||
}
|
||||
}
|
||||
|
||||
private fun saveLogMsg(msg: String) {
|
||||
withTryLock(condition = { logFile.length() > LOG_MAX_FILE_SIZE }) {
|
||||
logFile.renameTo(rotateLogFile)
|
||||
}
|
||||
try {
|
||||
logFile.appendText(msg)
|
||||
} catch (e: IOException) {
|
||||
NativeLog.e(TAG, "Failed to write log: $e")
|
||||
}
|
||||
}
|
||||
|
||||
private fun formatLogMsg(tag: String, msg: String, priority: Priority): String {
|
||||
val date = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
LocalDateTime.now().format(dateTimeFormat as DateTimeFormatter)
|
||||
} else {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(dateTimeFormat as ThreadLocal<DateFormat>).get()?.format(Date())
|
||||
}
|
||||
return "$date ${Process.myPid()} ${Process.myTid()} $priority [${Thread.currentThread().name}] " +
|
||||
"$tag: $msg\n"
|
||||
}
|
||||
|
||||
private fun deviceInfo(): String {
|
||||
val sb = StringBuilder()
|
||||
sb.append("Model: ").appendLine(Build.MODEL)
|
||||
sb.append("Brand: ").appendLine(Build.BRAND)
|
||||
sb.append("Product: ").appendLine(Build.PRODUCT)
|
||||
sb.append("Device: ").appendLine(Build.DEVICE)
|
||||
sb.append("Codename: ").appendLine(Build.VERSION.CODENAME)
|
||||
sb.append("Release: ").appendLine(Build.VERSION.RELEASE)
|
||||
sb.append("SDK: ").appendLine(Build.VERSION.SDK_INT)
|
||||
sb.append("ABI: ").appendLine(Build.SUPPORTED_ABIS.joinToString())
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
private fun readLogs(): String {
|
||||
var logText = ""
|
||||
withLock {
|
||||
try {
|
||||
if (rotateLogFile.exists()) logText = rotateLogFile.readText()
|
||||
if (logFile.exists()) logText += logFile.readText()
|
||||
} catch (e: IOException) {
|
||||
val errorMsg = "Failed to read log: $e"
|
||||
NativeLog.e(TAG, errorMsg)
|
||||
logText += errorMsg
|
||||
}
|
||||
}
|
||||
return logText
|
||||
}
|
||||
|
||||
private fun getLogcat(): String {
|
||||
try {
|
||||
val process = ProcessBuilder("logcat", "-d").redirectErrorStream(true).start()
|
||||
return process.inputStream.reader().readText()
|
||||
} catch (e: IOException) {
|
||||
val errorMsg = "Failed to get logcat log: $e"
|
||||
NativeLog.e(TAG, errorMsg)
|
||||
return errorMsg
|
||||
}
|
||||
}
|
||||
|
||||
private fun withLock(block: () -> Unit) {
|
||||
threadLock.lock()
|
||||
try {
|
||||
var l: FileLock? = null
|
||||
try {
|
||||
l = fileLock.lock()
|
||||
block()
|
||||
} catch (e: IOException) {
|
||||
NativeLog.e(TAG, "Failed to get file lock: $e")
|
||||
} finally {
|
||||
try {
|
||||
l?.release()
|
||||
} catch (e: IOException) {
|
||||
NativeLog.e(TAG, "Failed to release file lock: $e")
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
threadLock.unlock()
|
||||
}
|
||||
}
|
||||
|
||||
private fun withTryLock(condition: () -> Boolean, block: () -> Unit) {
|
||||
if (condition()) {
|
||||
if (threadLock.tryLock()) {
|
||||
try {
|
||||
if (condition()) {
|
||||
var l: FileLock? = null
|
||||
try {
|
||||
l = fileLock.tryLock()
|
||||
if (l != null) {
|
||||
if (condition()) {
|
||||
block()
|
||||
}
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
NativeLog.e(TAG, "Failed to get file tryLock: $e")
|
||||
} finally {
|
||||
try {
|
||||
l?.release()
|
||||
} catch (e: IOException) {
|
||||
NativeLog.e(TAG, "Failed to release file tryLock: $e")
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
threadLock.unlock()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum class Priority(val level: Int) {
|
||||
V(2),
|
||||
D(3),
|
||||
I(4),
|
||||
W(5),
|
||||
E(6),
|
||||
F(7)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package org.amnezia.vpn.util
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.security.crypto.EncryptedSharedPreferences
|
||||
import androidx.security.crypto.MasterKey
|
||||
import kotlin.reflect.typeOf
|
||||
|
||||
private const val TAG = "Prefs"
|
||||
private const val PREFS_FILE = "org.amnezia.vpn.prefs"
|
||||
private const val SECURE_PREFS_FILE = "$PREFS_FILE.secure"
|
||||
|
||||
object Prefs {
|
||||
private lateinit var app: Application
|
||||
val prefs: SharedPreferences
|
||||
get() = try {
|
||||
EncryptedSharedPreferences(
|
||||
app,
|
||||
SECURE_PREFS_FILE,
|
||||
MasterKey(app)
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Getting Encryption Storage failed: $e, plaintext fallback")
|
||||
app.getSharedPreferences(PREFS_FILE, Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
fun init(app: Application) {
|
||||
Log.v(TAG, "Init Prefs")
|
||||
this.app = app
|
||||
}
|
||||
|
||||
fun save(key: String, value: Boolean) =
|
||||
prefs.edit().putBoolean(key, value).apply()
|
||||
|
||||
fun save(key: String, value: String?) =
|
||||
prefs.edit().putString(key, value).apply()
|
||||
|
||||
fun save(key: String, value: Int) =
|
||||
prefs.edit().putInt(key, value).apply()
|
||||
|
||||
fun save(key: String, value: Long) =
|
||||
prefs.edit().putLong(key, value).apply()
|
||||
|
||||
fun save(key: String, value: Float) =
|
||||
prefs.edit().putFloat(key, value).apply()
|
||||
|
||||
inline fun <reified T> load(key: String): T {
|
||||
return when (typeOf<T>()) {
|
||||
typeOf<Boolean>() -> prefs.getBoolean(key, false)
|
||||
typeOf<String>() -> prefs.getString(key, "")
|
||||
typeOf<Int>() -> prefs.getInt(key, 0)
|
||||
typeOf<Long>() -> prefs.getLong(key, 0L)
|
||||
typeOf<Float>() -> prefs.getFloat(key, 0f)
|
||||
else -> throw IllegalArgumentException("SharedPreferences does not support type: ${typeOf<T>()}")
|
||||
} as T
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class NetworkState(
|
||||
|
||||
fun bindNetworkListener() {
|
||||
if (isListenerBound) return
|
||||
Log.d(TAG, "Bind network listener")
|
||||
Log.v(TAG, "Bind network listener")
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
connectivityManager.registerBestMatchingNetworkCallback(networkRequest, networkCallback, handler)
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
@@ -95,7 +95,7 @@ class NetworkState(
|
||||
|
||||
fun unbindNetworkListener() {
|
||||
if (!isListenerBound) return
|
||||
Log.d(TAG, "Unbind network listener")
|
||||
Log.v(TAG, "Unbind network listener")
|
||||
connectivityManager.unregisterNetworkCallback(networkCallback)
|
||||
isListenerBound = false
|
||||
currentNetwork = null
|
||||
|
||||
+3
-4
@@ -11,7 +11,7 @@ open class WireguardConfig protected constructor(
|
||||
val endpoint: InetEndpoint,
|
||||
val persistentKeepalive: Int,
|
||||
val publicKeyHex: String,
|
||||
val preSharedKeyHex: String?,
|
||||
val preSharedKeyHex: String,
|
||||
val privateKeyHex: String
|
||||
) : ProtocolConfig(protocolConfigBuilder) {
|
||||
|
||||
@@ -43,8 +43,7 @@ open class WireguardConfig protected constructor(
|
||||
appendLine("endpoint=$endpoint")
|
||||
if (persistentKeepalive != 0)
|
||||
appendLine("persistent_keepalive_interval=$persistentKeepalive")
|
||||
if (preSharedKeyHex != null)
|
||||
appendLine("preshared_key=$preSharedKeyHex")
|
||||
appendLine("preshared_key=$preSharedKeyHex")
|
||||
}
|
||||
|
||||
open class Builder : ProtocolConfig.Builder(true) {
|
||||
@@ -57,7 +56,7 @@ open class WireguardConfig protected constructor(
|
||||
internal lateinit var publicKeyHex: String
|
||||
private set
|
||||
|
||||
internal var preSharedKeyHex: String? = null
|
||||
internal lateinit var preSharedKeyHex: String
|
||||
private set
|
||||
|
||||
internal lateinit var privateKeyHex: String
|
||||
|
||||
@@ -90,7 +90,7 @@ include_directories(
|
||||
${LIBSSH_ROOT_DIR}/include
|
||||
${CLIENT_ROOT_DIR}/3rd/libssh/include
|
||||
${CLIENT_ROOT_DIR}/3rd/QSimpleCrypto/include
|
||||
${CLIENT_ROOT_DIR}/3rd/qtkeychain/qtkeychain
|
||||
${CLIENT_ROOT_DIR}/3rd/qtkeychain
|
||||
${CMAKE_CURRENT_BINARY_DIR}/3rd/qtkeychain
|
||||
${CMAKE_CURRENT_BINARY_DIR}/3rd/libssh/include
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ link_directories(${CMAKE_CURRENT_SOURCE_DIR}/platforms/android)
|
||||
set(HEADERS ${HEADERS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/android_controller.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/android_notificationhandler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/android_utils.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/androidutils.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/authResultReceiver.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/protocols/android_vpnprotocol.h
|
||||
)
|
||||
@@ -35,7 +35,7 @@ set(HEADERS ${HEADERS}
|
||||
set(SOURCES ${SOURCES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/android_controller.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/android_notificationhandler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/android_utils.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/androidutils.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/authResultReceiver.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/protocols/android_vpnprotocol.cpp
|
||||
)
|
||||
|
||||
@@ -97,7 +97,7 @@ target_compile_options(${PROJECT} PRIVATE
|
||||
-DVPN_NE_BUNDLEID=\"${BUILD_IOS_APP_IDENTIFIER}.network-extension\"
|
||||
)
|
||||
|
||||
set(WG_APPLE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rd/amneziawg-apple/Sources)
|
||||
set(WG_APPLE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rd/awg-apple/Sources)
|
||||
|
||||
target_sources(${PROJECT} PRIVATE
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/iosvpnprotocol.swift
|
||||
|
||||
@@ -118,33 +118,31 @@ QString OpenVpnConfigurator::genOpenVpnConfig(const ServerCredentials &credentia
|
||||
return QJsonDocument(jConfig).toJson();
|
||||
}
|
||||
|
||||
QString OpenVpnConfigurator::processConfigWithLocalSettings(QString jsonConfig, const int serverIndex)
|
||||
QString OpenVpnConfigurator::processConfigWithLocalSettings(QString jsonConfig)
|
||||
{
|
||||
QJsonObject json = QJsonDocument::fromJson(jsonConfig.toUtf8()).object();
|
||||
QString config = json[config_key::config].toString();
|
||||
|
||||
if (!m_settings->server(serverIndex).value(config_key::configVersion).toInt()) {
|
||||
QRegularExpression regex("redirect-gateway.*");
|
||||
config.replace(regex, "");
|
||||
QRegularExpression regex("redirect-gateway.*");
|
||||
config.replace(regex, "");
|
||||
|
||||
if (m_settings->routeMode() == Settings::VpnAllSites) {
|
||||
config.append("\nredirect-gateway def1 ipv6 bypass-dhcp\n");
|
||||
// Prevent ipv6 leak
|
||||
config.append("ifconfig-ipv6 fd15:53b6:dead::2/64 fd15:53b6:dead::1\n");
|
||||
config.append("block-ipv6\n");
|
||||
}
|
||||
if (m_settings->routeMode() == Settings::VpnOnlyForwardSites) {
|
||||
if (m_settings->routeMode() == Settings::VpnAllSites) {
|
||||
config.append("\nredirect-gateway def1 ipv6 bypass-dhcp\n");
|
||||
// Prevent ipv6 leak
|
||||
config.append("ifconfig-ipv6 fd15:53b6:dead::2/64 fd15:53b6:dead::1\n");
|
||||
config.append("block-ipv6\n");
|
||||
}
|
||||
if (m_settings->routeMode() == Settings::VpnOnlyForwardSites) {
|
||||
|
||||
// no redirect-gateway
|
||||
}
|
||||
if (m_settings->routeMode() == Settings::VpnAllExceptSites) {
|
||||
#ifndef Q_OS_ANDROID
|
||||
config.append("\nredirect-gateway ipv6 !ipv4 bypass-dhcp\n");
|
||||
#endif
|
||||
// Prevent ipv6 leak
|
||||
config.append("ifconfig-ipv6 fd15:53b6:dead::2/64 fd15:53b6:dead::1\n");
|
||||
config.append("block-ipv6\n");
|
||||
}
|
||||
// no redirect-gateway
|
||||
}
|
||||
if (m_settings->routeMode() == Settings::VpnAllExceptSites) {
|
||||
#ifndef Q_OS_ANDROID
|
||||
config.append("\nredirect-gateway ipv6 !ipv4 bypass-dhcp\n");
|
||||
#endif
|
||||
// Prevent ipv6 leak
|
||||
config.append("ifconfig-ipv6 fd15:53b6:dead::2/64 fd15:53b6:dead::1\n");
|
||||
config.append("block-ipv6\n");
|
||||
}
|
||||
|
||||
#ifndef MZ_WINDOWS
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
QString genOpenVpnConfig(const ServerCredentials &credentials, DockerContainer container,
|
||||
const QJsonObject &containerConfig, QString &clientId, ErrorCode *errorCode = nullptr);
|
||||
|
||||
QString processConfigWithLocalSettings(QString jsonConfig, const int serverIndex);
|
||||
QString processConfigWithLocalSettings(QString jsonConfig);
|
||||
QString processConfigWithExportSettings(QString jsonConfig);
|
||||
|
||||
ErrorCode signCert(DockerContainer container,
|
||||
|
||||
@@ -92,7 +92,7 @@ QString &VpnConfigurator::processConfigWithLocalSettings(int serverIndex, Docker
|
||||
processConfigWithDnsSettings(serverIndex, container, proto, config);
|
||||
|
||||
if (proto == Proto::OpenVpn) {
|
||||
config = openVpnConfigurator->processConfigWithLocalSettings(config, serverIndex);
|
||||
config = openVpnConfigurator->processConfigWithLocalSettings(config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ target_link_libraries(networkextension PRIVATE ${FW_UI_KIT})
|
||||
target_compile_options(networkextension PRIVATE -DGROUP_ID=\"${BUILD_IOS_GROUP_IDENTIFIER}\")
|
||||
target_compile_options(networkextension PRIVATE -DNETWORK_EXTENSION=1)
|
||||
|
||||
set(WG_APPLE_SOURCE_DIR ${CLIENT_ROOT_DIR}/3rd/amneziawg-apple/Sources)
|
||||
set(WG_APPLE_SOURCE_DIR ${CLIENT_ROOT_DIR}/3rd/awg-apple/Sources)
|
||||
|
||||
target_sources(networkextension PRIVATE
|
||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/WireGuardAdapter.swift
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "wireguard-go-version.h"
|
||||
#include "3rd/amneziawg-apple/Sources/WireGuardKitGo/wireguard.h"
|
||||
#include "3rd/amneziawg-apple/Sources/WireGuardKitC/WireGuardKitC.h"
|
||||
#include "3rd/awg-apple/Sources/WireGuardKitGo/wireguard.h"
|
||||
#include "3rd/awg-apple/Sources/WireGuardKitC/WireGuardKitC.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
#include <QDebug>
|
||||
#include <QTcpServer>
|
||||
#include <QTcpSocket>
|
||||
|
||||
#include "managementserver.h"
|
||||
|
||||
ManagementServer::ManagementServer(QObject *parent) : QObject(parent),
|
||||
m_tcpServer(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ManagementServer::~ManagementServer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ManagementServer::isOpen() const
|
||||
{
|
||||
return (m_socket && m_socket->isOpen());
|
||||
}
|
||||
|
||||
void ManagementServer::stop()
|
||||
{
|
||||
if (m_tcpServer) m_tcpServer->close();
|
||||
}
|
||||
|
||||
void ManagementServer::onAcceptError(QAbstractSocket::SocketError socketError)
|
||||
{
|
||||
qDebug().noquote() << QString("Accept error: %1").arg(socketError);
|
||||
}
|
||||
|
||||
qint64 ManagementServer::writeCommand(const QString& message)
|
||||
{
|
||||
if (!isOpen()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QString command = message + "\n";
|
||||
qint64 bytesWritten = m_socket->write(command.toStdString().c_str());
|
||||
m_socket->flush();
|
||||
return bytesWritten;
|
||||
}
|
||||
|
||||
void ManagementServer::onNewConnection()
|
||||
{
|
||||
qDebug() << "New incoming connection";
|
||||
|
||||
m_socket = QPointer<QTcpSocket>(m_tcpServer->nextPendingConnection());
|
||||
if (m_tcpServer) m_tcpServer->close();
|
||||
|
||||
QObject::connect(m_socket.data(), &QTcpSocket::disconnected, this, &ManagementServer::onSocketDisconnected);
|
||||
QObject::connect(m_socket.data(), &QTcpSocket::errorOccurred, this, &ManagementServer::onSocketError);
|
||||
QObject::connect(m_socket.data(), &QTcpSocket::readyRead, this, &ManagementServer::onReadyRead);
|
||||
}
|
||||
|
||||
void ManagementServer::onSocketError(QAbstractSocket::SocketError socketError)
|
||||
{
|
||||
Q_UNUSED(socketError)
|
||||
qDebug().noquote() << QString("Management server error: %1").arg(m_socket->errorString());
|
||||
}
|
||||
|
||||
void ManagementServer::onSocketDisconnected()
|
||||
{
|
||||
if (m_socket) m_socket->deleteLater();
|
||||
}
|
||||
|
||||
QPointer<QTcpSocket> ManagementServer::socket() const
|
||||
{
|
||||
if (!isOpen()) {
|
||||
return nullptr;
|
||||
}
|
||||
return m_socket;
|
||||
}
|
||||
|
||||
void ManagementServer::onReadyRead()
|
||||
{
|
||||
emit readyRead();
|
||||
}
|
||||
|
||||
bool ManagementServer::start(const QString& host, unsigned int port)
|
||||
{
|
||||
if (m_tcpServer) m_tcpServer->close();
|
||||
|
||||
m_tcpServer = QSharedPointer<QTcpServer>(new QTcpServer(this), [](QTcpServer *s){
|
||||
if (s) s->deleteLater();
|
||||
});
|
||||
m_tcpServer->setMaxPendingConnections(1);
|
||||
|
||||
connect(m_tcpServer.data(), SIGNAL(acceptError(QAbstractSocket::SocketError)), this, SLOT(onAcceptError(QAbstractSocket::SocketError)));
|
||||
connect(m_tcpServer.data(), SIGNAL(newConnection()), this, SLOT(onNewConnection()));
|
||||
|
||||
if (m_tcpServer->listen(QHostAddress(host), port)) {
|
||||
emit serverStarted();
|
||||
return true;
|
||||
}
|
||||
|
||||
qDebug().noquote() << QString("Can't start TCP server, %1,%2")
|
||||
.arg(m_tcpServer->serverError())
|
||||
.arg(m_tcpServer->errorString());
|
||||
return false;
|
||||
}
|
||||
|
||||
QString ManagementServer::readLine()
|
||||
{
|
||||
if (!isOpen()) {
|
||||
qDebug() << "Socket is not opened";
|
||||
return QString();
|
||||
}
|
||||
|
||||
return m_socket->readLine();
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
#ifndef MANAGEMENTSERVER_H
|
||||
#define MANAGEMENTSERVER_H
|
||||
|
||||
#include <QAbstractSocket>
|
||||
#include <QPointer>
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
|
||||
class QTcpServer;
|
||||
class QTcpSocket;
|
||||
|
||||
class ManagementServer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ManagementServer(QObject *parent = nullptr);
|
||||
~ManagementServer();
|
||||
|
||||
bool start(const QString& host, unsigned int port);
|
||||
void stop();
|
||||
bool isOpen() const;
|
||||
|
||||
QString readLine();
|
||||
qint64 writeCommand(const QString& message);
|
||||
|
||||
QPointer<QTcpSocket> socket() const;
|
||||
|
||||
signals:
|
||||
void readyRead();
|
||||
void serverStarted();
|
||||
|
||||
protected slots:
|
||||
void onAcceptError(QAbstractSocket::SocketError socketError);
|
||||
void onNewConnection();
|
||||
void onReadyRead();
|
||||
void onSocketDisconnected();
|
||||
void onSocketError(QAbstractSocket::SocketError socketError);
|
||||
|
||||
protected:
|
||||
QSharedPointer<QTcpServer> m_tcpServer;
|
||||
QPointer<QTcpSocket> m_socket;
|
||||
};
|
||||
|
||||
#endif // MANAGEMENTSERVER_H
|
||||
@@ -1,10 +1,8 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QJniEnvironment>
|
||||
#include <QJsonDocument>
|
||||
#include <QQmlFile>
|
||||
#include <QEventLoop>
|
||||
|
||||
#include "android_controller.h"
|
||||
#include "android_utils.h"
|
||||
#include "ui/controllers/importController.h"
|
||||
|
||||
namespace
|
||||
@@ -12,15 +10,13 @@ namespace
|
||||
AndroidController *s_instance = nullptr;
|
||||
|
||||
constexpr auto QT_ANDROID_CONTROLLER_CLASS = "org/amnezia/vpn/qt/QtAndroidController";
|
||||
constexpr auto ANDROID_LOG_CLASS = "org/amnezia/vpn/util/Log";
|
||||
constexpr auto TAG = "AmneziaQt";
|
||||
} // namespace
|
||||
|
||||
AndroidController::AndroidController() : QObject()
|
||||
{
|
||||
connect(this, &AndroidController::status, this,
|
||||
[this](AndroidController::ConnectionState state) {
|
||||
qDebug() << "Android event: status =" << textConnectionState(state);
|
||||
qDebug() << "Android event: status; state:" << textConnectionState(state);
|
||||
if (isWaitingStatus) {
|
||||
qDebug() << "Initialization by service status";
|
||||
isWaitingStatus = false;
|
||||
@@ -110,7 +106,6 @@ bool AndroidController::initialize()
|
||||
{"onVpnDisconnected", "()V", reinterpret_cast<void *>(onVpnDisconnected)},
|
||||
{"onVpnReconnecting", "()V", reinterpret_cast<void *>(onVpnReconnecting)},
|
||||
{"onStatisticsUpdate", "(JJ)V", reinterpret_cast<void *>(onStatisticsUpdate)},
|
||||
{"onFileOpened", "(Ljava/lang/String;)V", reinterpret_cast<void *>(onFileOpened)},
|
||||
{"onConfigImported", "(Ljava/lang/String;)V", reinterpret_cast<void *>(onConfigImported)},
|
||||
{"decodeQrCode", "(Ljava/lang/String;)Z", reinterpret_cast<bool *>(decodeQrCode)}
|
||||
};
|
||||
@@ -128,19 +123,24 @@ bool AndroidController::initialize()
|
||||
|
||||
// static
|
||||
template <typename Ret, typename ...Args>
|
||||
auto AndroidController::callActivityMethod(const char *methodName, const char *signature, Args &&...args)
|
||||
auto AndroidController::callActivityMethod(const char *methodName, const char *signature,
|
||||
const std::function<Ret()> &defValue, Args &&...args)
|
||||
{
|
||||
qDebug() << "Call activity method:" << methodName;
|
||||
QJniObject activity = AndroidUtils::getActivity();
|
||||
Q_ASSERT(activity.isValid());
|
||||
return activity.callMethod<Ret>(methodName, signature, std::forward<Args>(args)...);
|
||||
QJniObject activity = QNativeInterface::QAndroidApplication::context();
|
||||
if (activity.isValid()) {
|
||||
return activity.callMethod<Ret>(methodName, signature, std::forward<Args>(args)...);
|
||||
} else {
|
||||
qCritical() << "Activity is not valid";
|
||||
return defValue();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
template <typename ...Args>
|
||||
void AndroidController::callActivityMethod(const char *methodName, const char *signature, Args &&...args)
|
||||
{
|
||||
callActivityMethod<void>(methodName, signature, std::forward<Args>(args)...);
|
||||
callActivityMethod<void>(methodName, signature, [] {}, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
ErrorCode AndroidController::start(const QJsonObject &vpnConfig)
|
||||
@@ -165,24 +165,6 @@ void AndroidController::saveFile(const QString &fileName, const QString &data)
|
||||
QJniObject::fromString(data).object<jstring>());
|
||||
}
|
||||
|
||||
QString AndroidController::openFile(const QString &filter)
|
||||
{
|
||||
QEventLoop wait;
|
||||
QString fileName;
|
||||
connect(this, &AndroidController::fileOpened, this,
|
||||
[&fileName, &wait](const QString &uri) {
|
||||
qDebug() << "Android event: file opened; uri:" << uri;
|
||||
fileName = QQmlFile::urlToLocalFileOrQrc(uri);
|
||||
qDebug() << "Android opened filename:" << fileName;
|
||||
wait.quit();
|
||||
},
|
||||
static_cast<Qt::ConnectionType>(Qt::QueuedConnection | Qt::SingleShotConnection));
|
||||
callActivityMethod("openFile", "(Ljava/lang/String;)V",
|
||||
QJniObject::fromString(filter).object<jstring>());
|
||||
wait.exec();
|
||||
return fileName;
|
||||
}
|
||||
|
||||
void AndroidController::setNotificationText(const QString &title, const QString &message, int timerSec)
|
||||
{
|
||||
callActivityMethod("setNotificationText", "(Ljava/lang/String;Ljava/lang/String;I)V",
|
||||
@@ -191,114 +173,11 @@ void AndroidController::setNotificationText(const QString &title, const QString
|
||||
(jint) timerSec);
|
||||
}
|
||||
|
||||
bool AndroidController::isCameraPresent()
|
||||
{
|
||||
return callActivityMethod<jboolean>("isCameraPresent", "()Z");
|
||||
}
|
||||
|
||||
void AndroidController::startQrReaderActivity()
|
||||
{
|
||||
callActivityMethod("startQrCodeReader", "()V");
|
||||
}
|
||||
|
||||
void AndroidController::setSaveLogs(bool enabled)
|
||||
{
|
||||
callActivityMethod("setSaveLogs", "(Z)V", enabled);
|
||||
}
|
||||
|
||||
void AndroidController::exportLogsFile(const QString &fileName)
|
||||
{
|
||||
callActivityMethod("exportLogsFile", "(Ljava/lang/String;)V",
|
||||
QJniObject::fromString(fileName).object<jstring>());
|
||||
}
|
||||
|
||||
void AndroidController::clearLogs()
|
||||
{
|
||||
callActivityMethod("clearLogs", "()V");
|
||||
}
|
||||
|
||||
// Moving log processing to the Android side
|
||||
jclass AndroidController::log;
|
||||
jmethodID AndroidController::logDebug;
|
||||
jmethodID AndroidController::logInfo;
|
||||
jmethodID AndroidController::logWarning;
|
||||
jmethodID AndroidController::logError;
|
||||
jmethodID AndroidController::logFatal;
|
||||
|
||||
// static
|
||||
bool AndroidController::initLogging()
|
||||
{
|
||||
QJniEnvironment env;
|
||||
|
||||
log = env.findClass(ANDROID_LOG_CLASS);
|
||||
if (log == nullptr) {
|
||||
qCritical() << "Android log class" << ANDROID_LOG_CLASS << "not found";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto logMethodSignature = "(Ljava/lang/String;Ljava/lang/String;)V";
|
||||
|
||||
logDebug = env.findStaticMethod(log, "d", logMethodSignature);
|
||||
if (logDebug == nullptr) {
|
||||
qCritical() << "Android debug log method not found";
|
||||
return false;
|
||||
}
|
||||
|
||||
logInfo = env.findStaticMethod(log, "i", logMethodSignature);
|
||||
if (logInfo == nullptr) {
|
||||
qCritical() << "Android info log method not found";
|
||||
return false;
|
||||
}
|
||||
|
||||
logWarning = env.findStaticMethod(log, "w", logMethodSignature);
|
||||
if (logWarning == nullptr) {
|
||||
qCritical() << "Android warning log method not found";
|
||||
return false;
|
||||
}
|
||||
|
||||
logError = env.findStaticMethod(log, "e", logMethodSignature);
|
||||
if (logError == nullptr) {
|
||||
qCritical() << "Android error log method not found";
|
||||
return false;
|
||||
}
|
||||
|
||||
logFatal = env.findStaticMethod(log, "f", logMethodSignature);
|
||||
if (logFatal == nullptr) {
|
||||
qCritical() << "Android fatal log method not found";
|
||||
return false;
|
||||
}
|
||||
|
||||
qInstallMessageHandler(messageHandler);
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
void AndroidController::messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message)
|
||||
{
|
||||
jmethodID logMethod = logDebug;
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
logMethod = logDebug;
|
||||
break;
|
||||
case QtInfoMsg:
|
||||
logMethod = logInfo;
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
logMethod = logWarning;
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
logMethod = logError;
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
logMethod = logFatal;
|
||||
break;
|
||||
}
|
||||
QString formattedMessage = qFormatLogMessage(type, context, message);
|
||||
QJniObject::callStaticMethod<void>(log, logMethod,
|
||||
QJniObject::fromString(TAG).object<jstring>(),
|
||||
QJniObject::fromString(formattedMessage).object<jstring>());
|
||||
}
|
||||
|
||||
void AndroidController::qtAndroidControllerInitialized()
|
||||
{
|
||||
callActivityMethod("qtAndroidControllerInitialized", "()V");
|
||||
@@ -405,20 +284,21 @@ void AndroidController::onStatisticsUpdate(JNIEnv *env, jobject thiz, jlong rxBy
|
||||
emit AndroidController::instance()->statisticsUpdated((quint64) rxBytes, (quint64) txBytes);
|
||||
}
|
||||
|
||||
// static
|
||||
void AndroidController::onFileOpened(JNIEnv *env, jobject thiz, jstring uri)
|
||||
{
|
||||
Q_UNUSED(thiz);
|
||||
|
||||
emit AndroidController::instance()->fileOpened(AndroidUtils::convertJString(env, uri));
|
||||
}
|
||||
|
||||
// static
|
||||
void AndroidController::onConfigImported(JNIEnv *env, jobject thiz, jstring data)
|
||||
{
|
||||
Q_UNUSED(env);
|
||||
Q_UNUSED(thiz);
|
||||
|
||||
emit AndroidController::instance()->configImported(AndroidUtils::convertJString(env, data));
|
||||
const char *buffer = env->GetStringUTFChars(data, nullptr);
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString config(buffer);
|
||||
env->ReleaseStringUTFChars(data, buffer);
|
||||
|
||||
emit AndroidController::instance()->configImported(config);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -426,5 +306,12 @@ bool AndroidController::decodeQrCode(JNIEnv *env, jobject thiz, jstring data)
|
||||
{
|
||||
Q_UNUSED(thiz);
|
||||
|
||||
return ImportController::decodeQrCode(AndroidUtils::convertJString(env, data));
|
||||
const char *buffer = env->GetStringUTFChars(data, nullptr);
|
||||
if (!buffer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QString code(buffer);
|
||||
env->ReleaseStringUTFChars(data, buffer);
|
||||
return ImportController::decodeQrCode(code);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ public:
|
||||
bool initialize();
|
||||
|
||||
// keep synchronized with org.amnezia.vpn.protocol.ProtocolState
|
||||
enum class ConnectionState
|
||||
{
|
||||
enum class ConnectionState {
|
||||
CONNECTED,
|
||||
CONNECTING,
|
||||
DISCONNECTED,
|
||||
@@ -31,16 +30,8 @@ public:
|
||||
ErrorCode start(const QJsonObject &vpnConfig);
|
||||
void stop();
|
||||
void setNotificationText(const QString &title, const QString &message, int timerSec);
|
||||
void saveFile(const QString &fileName, const QString &data);
|
||||
QString openFile(const QString &filter);
|
||||
bool isCameraPresent();
|
||||
void saveFile(const QString& fileName, const QString &data);
|
||||
void startQrReaderActivity();
|
||||
void setSaveLogs(bool enabled);
|
||||
void exportLogsFile(const QString &fileName);
|
||||
void clearLogs();
|
||||
|
||||
static bool initLogging();
|
||||
static void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message);
|
||||
|
||||
signals:
|
||||
void connectionStateChanged(Vpn::ConnectionState state);
|
||||
@@ -52,7 +43,6 @@ signals:
|
||||
void vpnDisconnected();
|
||||
void vpnReconnecting();
|
||||
void statisticsUpdated(quint64 rxBytes, quint64 txBytes);
|
||||
void fileOpened(QString uri);
|
||||
void configImported(QString config);
|
||||
void importConfigFromOutside(QString config);
|
||||
void initConnectionState(Vpn::ConnectionState state);
|
||||
@@ -60,13 +50,6 @@ signals:
|
||||
private:
|
||||
bool isWaitingStatus = true;
|
||||
|
||||
static jclass log;
|
||||
static jmethodID logDebug;
|
||||
static jmethodID logInfo;
|
||||
static jmethodID logWarning;
|
||||
static jmethodID logError;
|
||||
static jmethodID logFatal;
|
||||
|
||||
void qtAndroidControllerInitialized();
|
||||
|
||||
static Vpn::ConnectionState convertState(ConnectionState state);
|
||||
@@ -82,11 +65,11 @@ private:
|
||||
static void onVpnReconnecting(JNIEnv *env, jobject thiz);
|
||||
static void onStatisticsUpdate(JNIEnv *env, jobject thiz, jlong rxBytes, jlong txBytes);
|
||||
static void onConfigImported(JNIEnv *env, jobject thiz, jstring data);
|
||||
static void onFileOpened(JNIEnv *env, jobject thiz, jstring uri);
|
||||
static bool decodeQrCode(JNIEnv *env, jobject thiz, jstring data);
|
||||
|
||||
template <typename Ret, typename ...Args>
|
||||
static auto callActivityMethod(const char *methodName, const char *signature, Args &&...args);
|
||||
static auto callActivityMethod(const char *methodName, const char *signature,
|
||||
const std::function<Ret()> &defValue, Args &&...args);
|
||||
template <typename ...Args>
|
||||
static void callActivityMethod(const char *methodName, const char *signature, Args &&...args);
|
||||
};
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#include <QCoreApplication>
|
||||
#include "android_utils.h"
|
||||
|
||||
namespace AndroidUtils
|
||||
{
|
||||
|
||||
QJniObject getActivity()
|
||||
{
|
||||
return QNativeInterface::QAndroidApplication::context();
|
||||
}
|
||||
|
||||
QString convertJString(JNIEnv *env, jstring data)
|
||||
{
|
||||
int len = env->GetStringLength(data);
|
||||
QString res(len, Qt::Uninitialized);
|
||||
env->GetStringRegion(data, 0, len, reinterpret_cast<jchar *>(res.data()));
|
||||
return res;
|
||||
}
|
||||
|
||||
void runOnAndroidThreadSync(const std::function<void()> &runnable)
|
||||
{
|
||||
QNativeInterface::QAndroidApplication::runOnAndroidMainThread(runnable).waitForFinished();
|
||||
}
|
||||
|
||||
void runOnAndroidThreadAsync(const std::function<void()> &runnable)
|
||||
{
|
||||
QNativeInterface::QAndroidApplication::runOnAndroidMainThread(runnable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef ANDROID_UTILS_H
|
||||
#define ANDROID_UTILS_H
|
||||
|
||||
#include <QJniObject>
|
||||
|
||||
namespace AndroidUtils
|
||||
{
|
||||
QJniObject getActivity();
|
||||
|
||||
QString convertJString(JNIEnv *env, jstring data);
|
||||
|
||||
void runOnAndroidThreadSync(const std::function<void()> &runnable);
|
||||
void runOnAndroidThreadAsync(const std::function<void()> &runnable);
|
||||
};
|
||||
|
||||
#endif // ANDROID_UTILS_H
|
||||
@@ -0,0 +1,183 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "androidutils.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QJniEnvironment>
|
||||
#include <QJniObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QNetworkCookieJar>
|
||||
#include <QTimer>
|
||||
#include <QUrlQuery>
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
AndroidUtils *s_instance = nullptr;
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
QString AndroidUtils::GetDeviceName()
|
||||
{
|
||||
QJniEnvironment env;
|
||||
jclass BUILD = env->FindClass("android/os/Build");
|
||||
jfieldID model = env->GetStaticFieldID(BUILD, "MODEL", "Ljava/lang/String;");
|
||||
jstring value = (jstring)env->GetStaticObjectField(BUILD, model);
|
||||
|
||||
if (!value) {
|
||||
return QString("Android Device");
|
||||
}
|
||||
|
||||
const char *buffer = env->GetStringUTFChars(value, nullptr);
|
||||
if (!buffer) {
|
||||
return QString("Android Device");
|
||||
}
|
||||
|
||||
QString res(buffer);
|
||||
env->ReleaseStringUTFChars(value, buffer);
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
// static
|
||||
AndroidUtils *AndroidUtils::instance()
|
||||
{
|
||||
if (!s_instance) {
|
||||
Q_ASSERT(qApp);
|
||||
s_instance = new AndroidUtils(qApp);
|
||||
}
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
AndroidUtils::AndroidUtils(QObject *parent) : QObject(parent)
|
||||
{
|
||||
Q_ASSERT(!s_instance);
|
||||
s_instance = this;
|
||||
}
|
||||
|
||||
AndroidUtils::~AndroidUtils()
|
||||
{
|
||||
Q_ASSERT(s_instance == this);
|
||||
s_instance = nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
void AndroidUtils::dispatchToMainThread(std::function<void()> callback)
|
||||
{
|
||||
QTimer *timer = new QTimer();
|
||||
timer->moveToThread(qApp->thread());
|
||||
timer->setSingleShot(true);
|
||||
QObject::connect(timer, &QTimer::timeout, [=]() {
|
||||
callback();
|
||||
timer->deleteLater();
|
||||
});
|
||||
QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
// static
|
||||
QByteArray AndroidUtils::getQByteArrayFromJString(JNIEnv *env, jstring data)
|
||||
{
|
||||
const char *buffer = env->GetStringUTFChars(data, nullptr);
|
||||
if (!buffer) {
|
||||
qDebug() << "getQByteArrayFromJString - failed to parse data.";
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QByteArray out(buffer);
|
||||
env->ReleaseStringUTFChars(data, buffer);
|
||||
return out;
|
||||
}
|
||||
|
||||
// static
|
||||
QString AndroidUtils::getQStringFromJString(JNIEnv *env, jstring data)
|
||||
{
|
||||
const char *buffer = env->GetStringUTFChars(data, nullptr);
|
||||
if (!buffer) {
|
||||
qDebug() << "getQStringFromJString - failed to parse data.";
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString out(buffer);
|
||||
env->ReleaseStringUTFChars(data, buffer);
|
||||
return out;
|
||||
}
|
||||
|
||||
// static
|
||||
QJsonObject AndroidUtils::getQJsonObjectFromJString(JNIEnv *env, jstring data)
|
||||
{
|
||||
QByteArray raw(getQByteArrayFromJString(env, data));
|
||||
QJsonParseError jsonError;
|
||||
QJsonDocument json = QJsonDocument::fromJson(raw, &jsonError);
|
||||
if (QJsonParseError::NoError != jsonError.error) {
|
||||
qDebug() << "getQJsonObjectFromJstring - error parsing json. Code: " << jsonError.error
|
||||
<< "Offset: " << jsonError.offset << "Message: " << jsonError.errorString() << "Data: " << raw;
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
if (!json.isObject()) {
|
||||
qDebug() << "getQJsonObjectFromJString - object expected.";
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
return json.object();
|
||||
}
|
||||
|
||||
QJniObject AndroidUtils::getActivity()
|
||||
{
|
||||
return QNativeInterface::QAndroidApplication::context();
|
||||
}
|
||||
|
||||
int AndroidUtils::GetSDKVersion()
|
||||
{
|
||||
QJniEnvironment env;
|
||||
jclass versionClass = env->FindClass("android/os/Build$VERSION");
|
||||
jfieldID sdkIntFieldID = env->GetStaticFieldID(versionClass, "SDK_INT", "I");
|
||||
int sdk = env->GetStaticIntField(versionClass, sdkIntFieldID);
|
||||
|
||||
return sdk;
|
||||
}
|
||||
|
||||
QString AndroidUtils::GetManufacturer()
|
||||
{
|
||||
QJniEnvironment env;
|
||||
jclass buildClass = env->FindClass("android/os/Build");
|
||||
jfieldID manuFacturerField = env->GetStaticFieldID(buildClass, "MANUFACTURER", "Ljava/lang/String;");
|
||||
jstring value = (jstring)env->GetStaticObjectField(buildClass, manuFacturerField);
|
||||
|
||||
const char *buffer = env->GetStringUTFChars(value, nullptr);
|
||||
|
||||
if (!buffer) {
|
||||
qDebug() << "Failed to fetch MANUFACTURER";
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QString res(buffer);
|
||||
qDebug() << "MANUFACTURER: " << res;
|
||||
env->ReleaseStringUTFChars(value, buffer);
|
||||
return res;
|
||||
}
|
||||
|
||||
void AndroidUtils::runOnAndroidThreadSync(const std::function<void()> runnable)
|
||||
{
|
||||
QNativeInterface::QAndroidApplication::runOnAndroidMainThread(runnable).waitForFinished();
|
||||
}
|
||||
|
||||
void AndroidUtils::runOnAndroidThreadAsync(const std::function<void()> runnable)
|
||||
{
|
||||
QNativeInterface::QAndroidApplication::runOnAndroidMainThread(runnable);
|
||||
}
|
||||
|
||||
// Static
|
||||
// Creates a copy of the passed QByteArray in the JVM and passes back a ref
|
||||
jbyteArray AndroidUtils::tojByteArray(const QByteArray &data)
|
||||
{
|
||||
QJniEnvironment env;
|
||||
jbyteArray out = env->NewByteArray(data.size());
|
||||
env->SetByteArrayRegion(out, 0, data.size(), reinterpret_cast<const jbyte *>(data.constData()));
|
||||
return out;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef ANDROIDUTILS_H
|
||||
#define ANDROIDUTILS_H
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include <QJniEnvironment>
|
||||
#include <QJniObject>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
class AndroidUtils final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(AndroidUtils)
|
||||
|
||||
public:
|
||||
static QString GetDeviceName();
|
||||
|
||||
static int GetSDKVersion();
|
||||
static QString GetManufacturer();
|
||||
|
||||
static AndroidUtils* instance();
|
||||
|
||||
static void dispatchToMainThread(std::function<void()> callback);
|
||||
|
||||
static QByteArray getQByteArrayFromJString(JNIEnv* env, jstring data);
|
||||
|
||||
static jbyteArray tojByteArray(const QByteArray& data);
|
||||
|
||||
static QString getQStringFromJString(JNIEnv* env, jstring data);
|
||||
|
||||
static QJsonObject getQJsonObjectFromJString(JNIEnv* env, jstring data);
|
||||
|
||||
static QJniObject getActivity();
|
||||
|
||||
static void runOnAndroidThreadSync(const std::function<void()> runnable);
|
||||
static void runOnAndroidThreadAsync(const std::function<void()> runnable);
|
||||
|
||||
private:
|
||||
AndroidUtils(QObject* parent);
|
||||
~AndroidUtils();
|
||||
};
|
||||
|
||||
#endif // ANDROIDUTILS_H
|
||||
@@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "3rd/amneziawg-apple/Sources/WireGuardKitC/WireGuardKitC.h"
|
||||
#include "3rd/awg-apple/Sources/WireGuardKitC/WireGuardKitC.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -22,6 +22,8 @@ OpenVpnOverCloakProtocol::~OpenVpnOverCloakProtocol()
|
||||
|
||||
ErrorCode OpenVpnOverCloakProtocol::start()
|
||||
{
|
||||
|
||||
#if 0
|
||||
if (!QFileInfo::exists(cloakExecPath())) {
|
||||
setLastError(ErrorCode::CloakExecutableMissing);
|
||||
return lastError();
|
||||
@@ -77,10 +79,12 @@ ErrorCode OpenVpnOverCloakProtocol::start()
|
||||
|
||||
if (m_ckProcess.state() == QProcess::ProcessState::Running) {
|
||||
setConnectionState(Vpn::ConnectionState::Connecting);
|
||||
|
||||
#endif
|
||||
return OpenVpnProtocol::start();
|
||||
#if 0
|
||||
}
|
||||
else return ErrorCode::CloakExecutableMissing;
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenVpnOverCloakProtocol::stop()
|
||||
@@ -90,16 +94,6 @@ void OpenVpnOverCloakProtocol::stop()
|
||||
|
||||
qDebug() << "OpenVpnOverCloakProtocol::stop()";
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
Utils::signalCtrl(m_ckProcess.processId(), CTRL_C_EVENT);
|
||||
#endif
|
||||
|
||||
m_ckProcess.terminate();
|
||||
|
||||
if (Utils::processIsRunning(Utils::executable("ck-client", false))) {
|
||||
QThread::msleep(1000);
|
||||
Utils::killProcessByName(Utils::executable("ck-client", false));
|
||||
}
|
||||
}
|
||||
|
||||
QString OpenVpnOverCloakProtocol::cloakExecPath()
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
#include "utilities.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
OpenVpnProtocol::OpenVpnProtocol(const QJsonObject &configuration, QObject *parent) : VpnProtocol(configuration, parent)
|
||||
{
|
||||
readOpenVpnConfiguration(configuration);
|
||||
connect(&m_managementServer, &ManagementServer::readyRead, this,
|
||||
&OpenVpnProtocol::onReadyReadDataFromManagementServer);
|
||||
}
|
||||
|
||||
OpenVpnProtocol::~OpenVpnProtocol()
|
||||
@@ -25,7 +24,6 @@ OpenVpnProtocol::~OpenVpnProtocol()
|
||||
|
||||
QString OpenVpnProtocol::defaultConfigFileName()
|
||||
{
|
||||
// qDebug() << "OpenVpnProtocol::defaultConfigFileName" << defaultConfigPath() + QString("/%1.ovpn").arg(APPLICATION_NAME);
|
||||
return defaultConfigPath() + QString("/%1.ovpn").arg(APPLICATION_NAME);
|
||||
}
|
||||
|
||||
@@ -33,25 +31,20 @@ QString OpenVpnProtocol::defaultConfigPath()
|
||||
{
|
||||
QString p = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/config";
|
||||
Utils::initializePath(p);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::stop()
|
||||
{
|
||||
qDebug() << "OpenVpnProtocol::stop()";
|
||||
setConnectionState(Vpn::ConnectionState::Disconnecting);
|
||||
|
||||
// TODO: need refactoring
|
||||
// sendTermSignal() will even return true while server connected ???
|
||||
if ((m_connectionState == Vpn::ConnectionState::Preparing) || (m_connectionState == Vpn::ConnectionState::Connecting)
|
||||
|| (m_connectionState == Vpn::ConnectionState::Connected)
|
||||
|| (m_connectionState == Vpn::ConnectionState::Reconnecting)) {
|
||||
if (!sendTermSignal()) {
|
||||
killOpenVpnProcess();
|
||||
}
|
||||
QThread::msleep(10);
|
||||
m_managementServer.stop();
|
||||
QThread::msleep(10);
|
||||
}
|
||||
setConnectionState(Vpn::ConnectionState::Disconnected);
|
||||
}
|
||||
@@ -86,9 +79,30 @@ void OpenVpnProtocol::readOpenVpnConfiguration(const QJsonObject &configuration)
|
||||
{
|
||||
if (configuration.contains(ProtocolProps::key_proto_config_data(Proto::OpenVpn))) {
|
||||
QJsonObject jConfig = configuration.value(ProtocolProps::key_proto_config_data(Proto::OpenVpn)).toObject();
|
||||
|
||||
QString plainConfig = jConfig.value(config_key::config).toString().toUtf8();
|
||||
if (configuration.contains(ProtocolProps::key_proto_config_data(Proto::Cloak))) {
|
||||
QJsonObject cloakConfig = configuration.value(ProtocolProps::key_proto_config_data(Proto::Cloak)).toObject();
|
||||
cloakConfig["NumConn"] = 1;
|
||||
cloakConfig["ProxyMethod"] = "openvpn";
|
||||
if (cloakConfig.contains("port")) {
|
||||
int portValue = cloakConfig.value("port").toInt();
|
||||
cloakConfig.remove("port");
|
||||
cloakConfig["RemotePort"] = portValue;
|
||||
}
|
||||
if (cloakConfig.contains("remote")) {
|
||||
QString hostValue = cloakConfig.value("remote").toString();
|
||||
cloakConfig.remove("remote");
|
||||
cloakConfig["RemoteHost"] = hostValue;
|
||||
}
|
||||
plainConfig += "\n<cloak>\n";
|
||||
QJsonDocument Doc(cloakConfig);
|
||||
QByteArray ba = Doc.toJson();
|
||||
QString plainCloak = ba;
|
||||
plainConfig += QString::fromLatin1(plainCloak.toUtf8().toBase64().data());
|
||||
plainConfig += "\n</cloak>\n";
|
||||
}
|
||||
m_configFile.open();
|
||||
m_configFile.write(jConfig.value(config_key::config).toString().toUtf8());
|
||||
m_configFile.write(plainConfig.toUtf8());
|
||||
m_configFile.close();
|
||||
m_configFileName = m_configFile.fileName();
|
||||
|
||||
@@ -98,60 +112,69 @@ void OpenVpnProtocol::readOpenVpnConfiguration(const QJsonObject &configuration)
|
||||
|
||||
bool OpenVpnProtocol::openVpnProcessIsRunning() const
|
||||
{
|
||||
return Utils::processIsRunning("openvpn");
|
||||
return Utils::processIsRunning("ovpncli");
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::disconnectFromManagementServer()
|
||||
{
|
||||
m_managementServer.stop();
|
||||
}
|
||||
|
||||
QString OpenVpnProtocol::configPath() const
|
||||
{
|
||||
return m_configFileName;
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::sendManagementCommand(const QString &command)
|
||||
{
|
||||
QIODevice *device = dynamic_cast<QIODevice *>(m_managementServer.socket().data());
|
||||
if (device) {
|
||||
QTextStream stream(device);
|
||||
stream << command << Qt::endl;
|
||||
}
|
||||
}
|
||||
|
||||
uint OpenVpnProtocol::selectMgmtPort()
|
||||
{
|
||||
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
quint32 port = QRandomGenerator::global()->generate();
|
||||
port = (double)(65000 - 15001) * port / UINT32_MAX + 15001;
|
||||
|
||||
QTcpServer s;
|
||||
bool ok = s.listen(QHostAddress::LocalHost, port);
|
||||
if (ok)
|
||||
return port;
|
||||
}
|
||||
|
||||
return m_managementPort;
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::updateRouteGateway(QString line)
|
||||
{
|
||||
// TODO: fix for macos
|
||||
line = line.split("ROUTE_GATEWAY", Qt::SkipEmptyParts).at(1);
|
||||
if (!line.contains("/"))
|
||||
return;
|
||||
m_routeGateway = line.split("/", Qt::SkipEmptyParts).first();
|
||||
m_routeGateway.replace(" ", "");
|
||||
qDebug() << "Set VPN route gateway" << m_routeGateway;
|
||||
const QString substr = "sitnl_route_best_gw result: via ";
|
||||
int start = line.indexOf(substr) + substr.size();
|
||||
int end = line.indexOf(" dev ", start);
|
||||
|
||||
m_routeGateway = line.mid(start, (end-start));
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::handle_cli_message(QString message)
|
||||
{
|
||||
QString line = message;
|
||||
|
||||
if (line.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (line.contains("EVENT: CONNECTED")) {
|
||||
setConnectionState(Vpn::ConnectionState::Connected);
|
||||
} else if (line.contains("EXITING")) {
|
||||
// openVpnStateSigTermHandler();
|
||||
setConnectionState(Vpn::ConnectionState::Disconnecting);
|
||||
} else if (line.contains("RECONNECTING")) {
|
||||
setConnectionState(Vpn::ConnectionState::Reconnecting);
|
||||
}
|
||||
|
||||
if (line.contains("sitnl_route_best_gw")) {
|
||||
updateRouteGateway(line);
|
||||
}
|
||||
|
||||
if (line.contains("[ifconfig]")) {
|
||||
updateVpnGateway(line);
|
||||
}
|
||||
|
||||
// TODO: SET CORRECT STRING
|
||||
if (line.contains("FATAL")) {
|
||||
if (line.contains("tap-windows6 adapters on this system are currently in use or disabled")) {
|
||||
emit protocolError(ErrorCode::OpenVpnAdaptersInUseError);
|
||||
} else {
|
||||
emit protocolError(ErrorCode::OpenVpnUnknownError);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
ErrorCode OpenVpnProtocol::start()
|
||||
{
|
||||
// qDebug() << "Start OpenVPN connection";
|
||||
OpenVpnProtocol::stop();
|
||||
|
||||
qDebug() << " Utils::openVpnExecPath();" << Utils::openVpnExecPath();
|
||||
|
||||
if (!QFileInfo::exists(Utils::openVpnExecPath())) {
|
||||
setLastError(ErrorCode::OpenVpnExecutableMissing);
|
||||
return lastError();
|
||||
@@ -184,23 +207,11 @@ ErrorCode OpenVpnProtocol::start()
|
||||
}
|
||||
#endif
|
||||
|
||||
// QString vpnLogFileNamePath = Utils::systemLogPath() + "/openvpn.log";
|
||||
// Utils::createEmptyFile(vpnLogFileNamePath);
|
||||
|
||||
uint mgmtPort = selectMgmtPort();
|
||||
qDebug() << "OpenVpnProtocol::start mgmt port selected:" << mgmtPort;
|
||||
|
||||
if (!m_managementServer.start(m_managementHost, mgmtPort)) {
|
||||
setLastError(ErrorCode::OpenVpnManagementServerError);
|
||||
return lastError();
|
||||
}
|
||||
|
||||
setConnectionState(Vpn::ConnectionState::Connecting);
|
||||
|
||||
m_openVpnProcess = IpcClient::CreatePrivilegedProcess();
|
||||
|
||||
if (!m_openVpnProcess) {
|
||||
// qWarning() << "IpcProcess replica is not created!";
|
||||
qWarning() << "IpcProcess replica is not created!";
|
||||
setLastError(ErrorCode::AmneziaServiceConnectionFailed);
|
||||
return ErrorCode::AmneziaServiceConnectionFailed;
|
||||
}
|
||||
@@ -212,122 +223,100 @@ ErrorCode OpenVpnProtocol::start()
|
||||
return ErrorCode::AmneziaServiceConnectionFailed;
|
||||
}
|
||||
m_openVpnProcess->setProgram(PermittedProcess::OpenVPN);
|
||||
QStringList arguments({
|
||||
"--config", configPath(), "--management", m_managementHost, QString::number(mgmtPort),
|
||||
"--management-client" /*, "--log", vpnLogFileNamePath */
|
||||
QStringList arguments({ configPath()/*, "--management", m_managementHost, QString::number(mgmtPort),
|
||||
"--management-client" *//*, "--log", vpnLogFileNamePath */
|
||||
});
|
||||
m_openVpnProcess->setArguments(arguments);
|
||||
|
||||
qDebug() << arguments.join(" ");
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::errorOccurred,
|
||||
[&](QProcess::ProcessError error) { qDebug() << "PrivilegedProcess errorOccurred" << error; });
|
||||
[&](QProcess::ProcessError error) {
|
||||
qDebug() << "PrivilegedProcess errorOccurred" << error;
|
||||
setConnectionState(Vpn::ConnectionState::Disconnected);
|
||||
});
|
||||
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::stateChanged,
|
||||
[&](QProcess::ProcessState newState) { qDebug() << "PrivilegedProcess stateChanged" << newState; });
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::stateChanged, [&](QProcess::ProcessState newState) {
|
||||
switch ( newState )
|
||||
{
|
||||
case QProcess::Starting:
|
||||
setConnectionState(Vpn::ConnectionState::Connecting);
|
||||
break;
|
||||
case QProcess::Running:
|
||||
setConnectionState(Vpn::ConnectionState::Connecting);
|
||||
break;
|
||||
default:
|
||||
setConnectionState(Vpn::ConnectionState::Disconnected);
|
||||
}
|
||||
qDebug() << "PrivilegedProcess stateChanged" << newState;
|
||||
});
|
||||
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::finished, this,
|
||||
[&]() { setConnectionState(Vpn::ConnectionState::Disconnected); });
|
||||
|
||||
m_openVpnProcess->start();
|
||||
|
||||
// startTimeoutTimer();
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::readyRead, this, [&] {
|
||||
|
||||
QRemoteObjectPendingReply<QByteArray> call = m_openVpnProcess->readAll();
|
||||
auto *watcher = new QRemoteObjectPendingCallWatcher(call, this);
|
||||
|
||||
auto *timeoutTimer = new QTimer(this);
|
||||
timeoutTimer->setSingleShot(true);
|
||||
m_watchers.insert(watcher, timeoutTimer);
|
||||
|
||||
connect(timeoutTimer, &QTimer::timeout, this, [this, watcher, timeoutTimer]() {
|
||||
qDebug() << "Foo request timed out.";
|
||||
|
||||
m_watchers.remove(watcher);
|
||||
watcher->deleteLater();
|
||||
timeoutTimer->deleteLater();
|
||||
});
|
||||
|
||||
connect(watcher, &QRemoteObjectPendingCallWatcher::finished, [this](QRemoteObjectPendingCallWatcher *self) {
|
||||
QTimer *timer = m_watchers.take(self);
|
||||
if (timer) {
|
||||
timer->stop();
|
||||
timer->deleteLater();
|
||||
}
|
||||
|
||||
QByteArray result = self->returnValue().toByteArray();
|
||||
handle_cli_message(QString(result));
|
||||
self->deleteLater();
|
||||
});
|
||||
|
||||
timeoutTimer->start(30000);
|
||||
|
||||
});
|
||||
|
||||
connect(m_openVpnProcess.data(), QOverload<int, QProcess::ExitStatus>::of(&PrivilegedProcess::finished), this, [this](int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
qDebug().noquote() << "OpenVPN finished, exitCode, exiStatus" << exitCode << exitStatus;
|
||||
setConnectionState(Vpn::ConnectionState::Disconnected);
|
||||
if (exitStatus != QProcess::NormalExit) {
|
||||
emit protocolError(amnezia::ErrorCode::ShadowSocksExecutableCrashed);
|
||||
stop();
|
||||
}
|
||||
if (exitCode !=0 ) {
|
||||
emit protocolError(amnezia::ErrorCode::InternalError);
|
||||
stop();
|
||||
}
|
||||
});
|
||||
|
||||
m_openVpnProcess->start();
|
||||
|
||||
return ErrorCode::NoError;
|
||||
}
|
||||
|
||||
bool OpenVpnProtocol::sendTermSignal()
|
||||
{
|
||||
return m_managementServer.writeCommand("signal SIGTERM");
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::sendByteCount()
|
||||
{
|
||||
m_managementServer.writeCommand("bytecount 1");
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::sendInitialData()
|
||||
{
|
||||
m_managementServer.writeCommand("state on");
|
||||
m_managementServer.writeCommand("log on");
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::onReadyReadDataFromManagementServer()
|
||||
{
|
||||
for (;;) {
|
||||
QString line = m_managementServer.readLine().simplified();
|
||||
|
||||
if (line.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!line.contains(">BYTECOUNT")) {
|
||||
qDebug().noquote() << line;
|
||||
}
|
||||
|
||||
if (line.contains(">INFO:OpenVPN Management Interface")) {
|
||||
sendInitialData();
|
||||
} else if (line.startsWith(">STATE")) {
|
||||
if (line.contains("CONNECTED,SUCCESS")) {
|
||||
sendByteCount();
|
||||
stopTimeoutTimer();
|
||||
setConnectionState(Vpn::ConnectionState::Connected);
|
||||
continue;
|
||||
} else if (line.contains("EXITING,SIGTER")) {
|
||||
// openVpnStateSigTermHandler();
|
||||
setConnectionState(Vpn::ConnectionState::Disconnecting);
|
||||
continue;
|
||||
} else if (line.contains("RECONNECTING")) {
|
||||
setConnectionState(Vpn::ConnectionState::Reconnecting);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (line.contains("ROUTE_GATEWAY")) {
|
||||
updateRouteGateway(line);
|
||||
}
|
||||
|
||||
if (line.contains("PUSH: Received control message")) {
|
||||
updateVpnGateway(line);
|
||||
}
|
||||
|
||||
if (line.contains("FATAL")) {
|
||||
if (line.contains("tap-windows6 adapters on this system are currently in use or disabled")) {
|
||||
emit protocolError(ErrorCode::OpenVpnAdaptersInUseError);
|
||||
} else {
|
||||
emit protocolError(ErrorCode::OpenVpnUnknownError);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray data(line.toStdString().c_str());
|
||||
if (data.contains(">BYTECOUNT:")) {
|
||||
int beg = data.lastIndexOf(">BYTECOUNT:");
|
||||
int end = data.indexOf("\n", beg);
|
||||
|
||||
beg += sizeof(">BYTECOUNT:") - 1;
|
||||
QList<QByteArray> count = data.mid(beg, end - beg + 1).split(',');
|
||||
|
||||
quint64 r = static_cast<quint64>(count.at(0).trimmed().toULongLong());
|
||||
quint64 s = static_cast<quint64>(count.at(1).trimmed().toULongLong());
|
||||
|
||||
setBytesChanged(r, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::updateVpnGateway(const QString &line)
|
||||
{
|
||||
// line looks like
|
||||
// PUSH: Received control message: 'PUSH_REPLY,route 10.8.0.1,topology net30,ping 10,ping-restart
|
||||
// 120,ifconfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM'
|
||||
|
||||
QStringList params = line.split(",");
|
||||
for (const QString &l : params) {
|
||||
if (l.contains("ifconfig")) {
|
||||
// "[ifconfig] [10.8.0.14] [10.8.0.13]"
|
||||
QStringList params = line.split("\n");
|
||||
for (const QString ¶m : params) {
|
||||
if (param.contains("ifconfig")) {
|
||||
QString l = param.right(param.size() - param.indexOf("ifconfig"));
|
||||
if (l.split(" ").size() == 3) {
|
||||
m_vpnLocalAddress = l.split(" ").at(1);
|
||||
m_vpnLocalAddress.remove("[");m_vpnLocalAddress.remove("]");
|
||||
m_vpnGateway = l.split(" ").at(2);
|
||||
|
||||
m_vpnGateway.remove("[");m_vpnGateway.remove("]");
|
||||
qDebug() << QString("Set vpn local address %1, gw %2").arg(m_vpnLocalAddress).arg(vpnGateway());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
|
||||
#include "managementserver.h"
|
||||
#include "vpnprotocol.h"
|
||||
|
||||
#include "core/ipcclient.h"
|
||||
@@ -25,28 +24,21 @@ public:
|
||||
static QString defaultConfigFileName();
|
||||
static QString defaultConfigPath();
|
||||
|
||||
protected slots:
|
||||
void onReadyReadDataFromManagementServer();
|
||||
|
||||
private:
|
||||
QString configPath() const;
|
||||
bool openVpnProcessIsRunning() const;
|
||||
bool sendTermSignal();
|
||||
void readOpenVpnConfiguration(const QJsonObject &configuration);
|
||||
void disconnectFromManagementServer();
|
||||
void handle_cli_message(QString message);
|
||||
void killOpenVpnProcess();
|
||||
void sendByteCount();
|
||||
void sendInitialData();
|
||||
void sendManagementCommand(const QString& command);
|
||||
|
||||
const QString m_managementHost = "127.0.0.1";
|
||||
const unsigned int m_managementPort = 57775;
|
||||
|
||||
ManagementServer m_managementServer;
|
||||
QHash<QRemoteObjectPendingCallWatcher*, QTimer*> m_watchers;
|
||||
QString m_configFileName;
|
||||
QTemporaryFile m_configFile;
|
||||
|
||||
uint selectMgmtPort();
|
||||
|
||||
private:
|
||||
void updateRouteGateway(QString line);
|
||||
|
||||
+1
-3
@@ -216,7 +216,6 @@ QString Settings::nextAvailableServerName() const
|
||||
void Settings::setSaveLogs(bool enabled)
|
||||
{
|
||||
setValue("Conf/saveLogs", enabled);
|
||||
#ifndef Q_OS_ANDROID
|
||||
if (!isSaveLogs()) {
|
||||
Logger::deInit();
|
||||
} else {
|
||||
@@ -224,8 +223,7 @@ void Settings::setSaveLogs(bool enabled)
|
||||
qWarning() << "Initialization of debug subsystem failed";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
emit saveLogsChanged(enabled);
|
||||
emit saveLogsChanged();
|
||||
}
|
||||
|
||||
QString Settings::routeModeString(RouteMode mode) const
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ public:
|
||||
void clearSettings();
|
||||
|
||||
signals:
|
||||
void saveLogsChanged(bool enabled);
|
||||
void saveLogsChanged();
|
||||
|
||||
private:
|
||||
QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
|
||||
|
||||
@@ -946,11 +946,6 @@ Already installed containers were found on the server. All installed containers
|
||||
<source>Show other methods on Github</source>
|
||||
<translation>نمایش متدهای دیگر در گیت هاب</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsAbout.qml" line="104"/>
|
||||
<source>https://github.com/amnezia-vpn/amnezia-client#donate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsAbout.qml" line="113"/>
|
||||
<source>Contacts</source>
|
||||
@@ -1859,11 +1854,6 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<source>I have nothing</source>
|
||||
<translation>من هیچی ندارم</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSetupWizardStart.qml" line="138"/>
|
||||
<source>https://amnezia.org/instructions/0_starter-guide</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PageSetupWizardTextKey</name>
|
||||
@@ -2188,38 +2178,38 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::DeletePasswordJobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="104"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="104"/>
|
||||
<source>Password entry not found</source>
|
||||
<translation>Password entry not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="108"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="108"/>
|
||||
<source>Could not decrypt data</source>
|
||||
<translation>Could not decrypt data</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="585"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="593"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="552"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="560"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="614"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="578"/>
|
||||
<source>Could not open wallet: %1; %2</source>
|
||||
<translation>Could not open wallet: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="177"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="177"/>
|
||||
<source>Password not found</source>
|
||||
<translation>Password not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="173"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="173"/>
|
||||
<source>Could not open keystore</source>
|
||||
<translation>Could not open keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="179"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="179"/>
|
||||
<source>Could not remove private key from keystore</source>
|
||||
<translation>Could not remove private key from keystore</translation>
|
||||
</message>
|
||||
@@ -2227,12 +2217,12 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::JobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="295"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="265"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="542"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="509"/>
|
||||
<source>Access to keychain denied</source>
|
||||
<translation>Access to keychain denied</translation>
|
||||
</message>
|
||||
@@ -2240,27 +2230,27 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::PlainTextStore</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="65"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="65"/>
|
||||
<source>Could not store data in settings: access error</source>
|
||||
<translation>Could not store data in settings: access error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="67"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="67"/>
|
||||
<source>Could not store data in settings: format error</source>
|
||||
<translation>Could not store data in settings: format error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="85"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="85"/>
|
||||
<source>Could not delete data from settings: access error</source>
|
||||
<translation>Could not delete data from settings: access error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="87"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="87"/>
|
||||
<source>Could not delete data from settings: format error</source>
|
||||
<translation>Could not delete data from settings: format error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="104"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="104"/>
|
||||
<source>Entry not found</source>
|
||||
<translation>Entry not found</translation>
|
||||
</message>
|
||||
@@ -2268,80 +2258,80 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::ReadPasswordJobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="32"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="32"/>
|
||||
<source>Password entry not found</source>
|
||||
<translation>Password entry not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="36"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="139"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="36"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="139"/>
|
||||
<source>Could not decrypt data</source>
|
||||
<translation>Could not decrypt data</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="205"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="178"/>
|
||||
<source>D-Bus is not running</source>
|
||||
<translation>D-Bus is not running</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="214"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="224"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="187"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="197"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="316"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="286"/>
|
||||
<source>No keychain service available</source>
|
||||
<translation>No keychain service available</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="318"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="288"/>
|
||||
<source>Could not open wallet: %1; %2</source>
|
||||
<translation>Could not open wallet: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="363"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="333"/>
|
||||
<source>Access to keychain denied</source>
|
||||
<translation>Access to keychain denied</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="384"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="354"/>
|
||||
<source>Could not determine data type: %1; %2</source>
|
||||
<translation>Could not determine data type: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="393"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="52"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="363"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="52"/>
|
||||
<source>Entry not found</source>
|
||||
<translation>Entry not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="402"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="372"/>
|
||||
<source>Unsupported entry type 'Map'</source>
|
||||
<translation>Unsupported entry type 'Map'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="405"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="375"/>
|
||||
<source>Unknown kwallet entry type '%1'</source>
|
||||
<translation>Unknown kwallet entry type '%1'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="96"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="96"/>
|
||||
<source>Password not found</source>
|
||||
<translation>Password not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="60"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="60"/>
|
||||
<source>Could not open keystore</source>
|
||||
<translation>Could not open keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="68"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="68"/>
|
||||
<source>Could not retrieve private key from keystore</source>
|
||||
<translation>Could not retrieve private key from keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="75"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="75"/>
|
||||
<source>Could not create decryption cipher</source>
|
||||
<translation>Could not create decryption cipher</translation>
|
||||
</message>
|
||||
@@ -2349,73 +2339,73 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::WritePasswordJobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="78"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="78"/>
|
||||
<source>Credential size exceeds maximum size of %1</source>
|
||||
<translation>Credential size exceeds maximum size of %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="87"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="87"/>
|
||||
<source>Credential key exceeds maximum size of %1</source>
|
||||
<translation>Credential key exceeds maximum size of %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="92"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="92"/>
|
||||
<source>Writing credentials failed: Win32 error code %1</source>
|
||||
<translation>Writing credentials failed: Win32 error code %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="162"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="162"/>
|
||||
<source>Encryption failed</source>
|
||||
<translation>Encryption failed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="445"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="415"/>
|
||||
<source>D-Bus is not running</source>
|
||||
<translation>D-Bus is not running</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="455"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="482"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="425"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="452"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="501"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="468"/>
|
||||
<source>Could not open wallet: %1; %2</source>
|
||||
<translation>Could not open wallet: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="144"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="144"/>
|
||||
<source>Password not found</source>
|
||||
<translation>Password not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="95"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="95"/>
|
||||
<source>Could not open keystore</source>
|
||||
<translation>Could not open keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="124"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="124"/>
|
||||
<source>Could not create private key generator</source>
|
||||
<translation>Could not create private key generator</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="131"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="131"/>
|
||||
<source>Could not generate new private key</source>
|
||||
<translation>Could not generate new private key</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="139"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="139"/>
|
||||
<source>Could not retrieve private key from keystore</source>
|
||||
<translation>Could not retrieve private key from keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="147"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="147"/>
|
||||
<source>Could not create encryption cipher</source>
|
||||
<translation>Could not create encryption cipher</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="155"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="155"/>
|
||||
<source>Could not encrypt data</source>
|
||||
<translation>Could not encrypt data</translation>
|
||||
</message>
|
||||
@@ -2865,72 +2855,74 @@ This means that AmneziaWG keeps the fast performance of the original while addin
|
||||
<translation>سرویس Sftp</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/libsecret.cpp" line="119"/>
|
||||
<location filename="../3rd/qtkeychain/libsecret.cpp" line="119"/>
|
||||
<source>Entry not found</source>
|
||||
<translation>Entry not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="255"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="225"/>
|
||||
<source>Access to keychain denied</source>
|
||||
<translation>Access to keychain denied</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="257"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="227"/>
|
||||
<source>No keyring daemon</source>
|
||||
<translation>No keyring daemon</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="259"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="229"/>
|
||||
<source>Already unlocked</source>
|
||||
<translation>Already unlocked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="261"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="231"/>
|
||||
<source>No such keyring</source>
|
||||
<translation>No such keyring</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="263"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="233"/>
|
||||
<source>Bad arguments</source>
|
||||
<translation>Bad arguments</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="265"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="235"/>
|
||||
<source>I/O error</source>
|
||||
<translation>I/O error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="267"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="237"/>
|
||||
<source>Cancelled</source>
|
||||
<translation>Cancelled</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="269"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="239"/>
|
||||
<source>Keyring already exists</source>
|
||||
<translation>Keyring already exists</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="271"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="241"/>
|
||||
<source>No match</source>
|
||||
<translation>No match</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="276"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="246"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="72"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="72"/>
|
||||
<source>error 0x%1: %2</source>
|
||||
<translation>error 0x%1: %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/wireguard-tools/contrib/highlighter/gui/highlight.cpp" line="39"/>
|
||||
<source>WireGuard Configuration Highlighter</source>
|
||||
<translation type="vanished">هایلایتر پیکربندی WireGuard</translation>
|
||||
<translation>هایلایتر پیکربندی WireGuard</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/wireguard-tools/contrib/highlighter/gui/highlight.cpp" line="82"/>
|
||||
<source>&Randomize colors</source>
|
||||
<translation type="vanished">رنگهای تصادفی</translation>
|
||||
<translation>رنگهای تصادفی</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@@ -2944,13 +2936,13 @@ This means that AmneziaWG keeps the fast performance of the original while addin
|
||||
<context>
|
||||
<name>Settings</name>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="30"/>
|
||||
<location filename="../settings.cpp" line="26"/>
|
||||
<source>Server #1</source>
|
||||
<translation>Server #1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="206"/>
|
||||
<location filename="../settings.cpp" line="213"/>
|
||||
<location filename="../settings.cpp" line="202"/>
|
||||
<location filename="../settings.cpp" line="209"/>
|
||||
<source>Server</source>
|
||||
<translation>Server</translation>
|
||||
</message>
|
||||
@@ -2958,22 +2950,22 @@ This means that AmneziaWG keeps the fast performance of the original while addin
|
||||
<context>
|
||||
<name>SettingsController</name>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="26"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="25"/>
|
||||
<source>Software version</source>
|
||||
<translation>نسخه نرمافزار</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="139"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="137"/>
|
||||
<source>All settings have been reset to default values</source>
|
||||
<translation>تمام تنظیمات به مقادیر پیش فرض ریست شد</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="145"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="143"/>
|
||||
<source>Cached profiles cleared</source>
|
||||
<translation>پروفایل ذخیره شده پاک شد</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="123"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="122"/>
|
||||
<source>Backup file is corrupted</source>
|
||||
<translation>فایل بکآپ خراب شده است</translation>
|
||||
</message>
|
||||
|
||||
@@ -15,13 +15,15 @@
|
||||
<context>
|
||||
<name>AndroidController</name>
|
||||
<message>
|
||||
<location filename="../platforms/android/android_controller.cpp" line="236"/>
|
||||
<source>AmneziaVPN</source>
|
||||
<translation type="vanished">AmneziaVPN</translation>
|
||||
<translation>AmneziaVPN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../platforms/android/android_controller.cpp" line="239"/>
|
||||
<source>VPN Connected</source>
|
||||
<extracomment>Refers to the app - which is currently running the background and waiting</extracomment>
|
||||
<translation type="vanished">VPN Подключен</translation>
|
||||
<translation>VPN Подключен</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@@ -149,7 +151,7 @@
|
||||
<context>
|
||||
<name>ImportController</name>
|
||||
<message>
|
||||
<location filename="../ui/controllers/importController.cpp" line="411"/>
|
||||
<location filename="../ui/controllers/importController.cpp" line="435"/>
|
||||
<source>Scanned %1 of %2.</source>
|
||||
<translation>Отсканировано %1 из%2.</translation>
|
||||
</message>
|
||||
@@ -944,11 +946,6 @@ Already installed containers were found on the server. All installed containers
|
||||
<source>Show other methods on Github</source>
|
||||
<translation>Показать другие способы на Github</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsAbout.qml" line="104"/>
|
||||
<source>https://github.com/amnezia-vpn/amnezia-client#donate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsAbout.qml" line="113"/>
|
||||
<source>Contacts</source>
|
||||
@@ -1431,22 +1428,22 @@ Already installed containers were found on the server. All installed containers
|
||||
<translation>Имя сервера</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="111"/>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="110"/>
|
||||
<source>Save</source>
|
||||
<translation>Сохранить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="142"/>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="137"/>
|
||||
<source>Protocols</source>
|
||||
<translation>Протоколы</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="148"/>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="143"/>
|
||||
<source>Services</source>
|
||||
<translation>Сервисы</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="152"/>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="147"/>
|
||||
<source>Data</source>
|
||||
<translation>Данные</translation>
|
||||
</message>
|
||||
@@ -1857,11 +1854,6 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<source>I have nothing</source>
|
||||
<translation>У меня ничего нет</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSetupWizardStart.qml" line="138"/>
|
||||
<source>https://amnezia.org/instructions/0_starter-guide</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PageSetupWizardTextKey</name>
|
||||
@@ -1949,8 +1941,8 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation type="vanished">Доступ к управлению сервером. Пользователь, с которым вы делитесь полным доступом к соединению, сможет добавлять и удалять ваши протоколы и службы на сервере, а также изменять настройки.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="279"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="280"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="281"/>
|
||||
<source>Server</source>
|
||||
<translation>Сервер</translation>
|
||||
</message>
|
||||
@@ -2025,7 +2017,7 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="231"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="486"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="483"/>
|
||||
<source>Users</source>
|
||||
<translation type="unfinished">Пользователи</translation>
|
||||
</message>
|
||||
@@ -2035,52 +2027,47 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation type="unfinished">Имя пользователя</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="502"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="499"/>
|
||||
<source>Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="584"/>
|
||||
<source>Creation date: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="598"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="595"/>
|
||||
<source>Rename</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="627"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="624"/>
|
||||
<source>Client name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="636"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="632"/>
|
||||
<source>Save</source>
|
||||
<translation type="unfinished">Сохранить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="668"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="660"/>
|
||||
<source>Revoke</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="671"/>
|
||||
<source>Revoke the config for a user - %1?</source>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="663"/>
|
||||
<source>Revoke the config for a user - </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="672"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="664"/>
|
||||
<source>The user will no longer be able to connect to your server.</source>
|
||||
<translation type="unfinished">Пользователь больше не сможет подключаться к вашему серверу</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="673"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="665"/>
|
||||
<source>Continue</source>
|
||||
<translation type="unfinished">Продолжить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="674"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="666"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Отменить</translation>
|
||||
</message>
|
||||
@@ -2094,20 +2081,20 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation>Поделиться доступом к VPN, без возможности управления сервером</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="331"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="332"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="333"/>
|
||||
<source>Protocol</source>
|
||||
<translation>Протокол</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="428"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="429"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="430"/>
|
||||
<source>Connection format</source>
|
||||
<translation>Формат подключения</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="186"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="469"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="468"/>
|
||||
<source>Share</source>
|
||||
<translation>Поделиться</translation>
|
||||
</message>
|
||||
@@ -2137,12 +2124,12 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation type="unfinished">Сервер</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShareFullAccess.qml" line="100"/>
|
||||
<location filename="../ui/qml/Pages2/PageShareFullAccess.qml" line="102"/>
|
||||
<source>Accessing </source>
|
||||
<translation type="unfinished">Доступ </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShareFullAccess.qml" line="101"/>
|
||||
<location filename="../ui/qml/Pages2/PageShareFullAccess.qml" line="103"/>
|
||||
<source>File with accessing settings to </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -2173,38 +2160,38 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::DeletePasswordJobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="104"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="104"/>
|
||||
<source>Password entry not found</source>
|
||||
<translation>Password entry not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="108"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="108"/>
|
||||
<source>Could not decrypt data</source>
|
||||
<translation>Could not decrypt data</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="585"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="593"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="552"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="560"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="614"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="578"/>
|
||||
<source>Could not open wallet: %1; %2</source>
|
||||
<translation>Could not open wallet: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="177"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="177"/>
|
||||
<source>Password not found</source>
|
||||
<translation>Password not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="173"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="173"/>
|
||||
<source>Could not open keystore</source>
|
||||
<translation>Could not open keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="179"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="179"/>
|
||||
<source>Could not remove private key from keystore</source>
|
||||
<translation>Could not remove private key from keystore</translation>
|
||||
</message>
|
||||
@@ -2212,12 +2199,12 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::JobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="295"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="265"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="542"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="509"/>
|
||||
<source>Access to keychain denied</source>
|
||||
<translation>Access to keychain denied</translation>
|
||||
</message>
|
||||
@@ -2225,27 +2212,27 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::PlainTextStore</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="65"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="65"/>
|
||||
<source>Could not store data in settings: access error</source>
|
||||
<translation>Could not store data in settings: access error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="67"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="67"/>
|
||||
<source>Could not store data in settings: format error</source>
|
||||
<translation>Could not store data in settings: format error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="85"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="85"/>
|
||||
<source>Could not delete data from settings: access error</source>
|
||||
<translation>Could not delete data from settings: access error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="87"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="87"/>
|
||||
<source>Could not delete data from settings: format error</source>
|
||||
<translation>Could not delete data from settings: format error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="104"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="104"/>
|
||||
<source>Entry not found</source>
|
||||
<translation>Entry not found</translation>
|
||||
</message>
|
||||
@@ -2253,80 +2240,80 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::ReadPasswordJobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="32"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="32"/>
|
||||
<source>Password entry not found</source>
|
||||
<translation>Password entry not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="36"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="139"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="36"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="139"/>
|
||||
<source>Could not decrypt data</source>
|
||||
<translation>Could not decrypt data</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="205"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="178"/>
|
||||
<source>D-Bus is not running</source>
|
||||
<translation>D-Bus is not running</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="214"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="224"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="187"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="197"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="316"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="286"/>
|
||||
<source>No keychain service available</source>
|
||||
<translation>No keychain service available</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="318"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="288"/>
|
||||
<source>Could not open wallet: %1; %2</source>
|
||||
<translation>Could not open wallet: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="363"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="333"/>
|
||||
<source>Access to keychain denied</source>
|
||||
<translation>Access to keychain denied</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="384"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="354"/>
|
||||
<source>Could not determine data type: %1; %2</source>
|
||||
<translation>Could not determine data type: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="393"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="52"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="363"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="52"/>
|
||||
<source>Entry not found</source>
|
||||
<translation>Entry not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="402"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="372"/>
|
||||
<source>Unsupported entry type 'Map'</source>
|
||||
<translation>Unsupported entry type 'Map'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="405"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="375"/>
|
||||
<source>Unknown kwallet entry type '%1'</source>
|
||||
<translation>Unknown kwallet entry type '%1'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="96"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="96"/>
|
||||
<source>Password not found</source>
|
||||
<translation>Password not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="60"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="60"/>
|
||||
<source>Could not open keystore</source>
|
||||
<translation>Could not open keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="68"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="68"/>
|
||||
<source>Could not retrieve private key from keystore</source>
|
||||
<translation>Could not retrieve private key from keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="75"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="75"/>
|
||||
<source>Could not create decryption cipher</source>
|
||||
<translation>Could not create decryption cipher</translation>
|
||||
</message>
|
||||
@@ -2334,73 +2321,73 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::WritePasswordJobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="78"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="78"/>
|
||||
<source>Credential size exceeds maximum size of %1</source>
|
||||
<translation>Credential size exceeds maximum size of %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="87"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="87"/>
|
||||
<source>Credential key exceeds maximum size of %1</source>
|
||||
<translation>Credential key exceeds maximum size of %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="92"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="92"/>
|
||||
<source>Writing credentials failed: Win32 error code %1</source>
|
||||
<translation>Writing credentials failed: Win32 error code %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="162"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="162"/>
|
||||
<source>Encryption failed</source>
|
||||
<translation>Encryption failed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="445"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="415"/>
|
||||
<source>D-Bus is not running</source>
|
||||
<translation>D-Bus is not running</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="455"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="482"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="425"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="452"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="501"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="468"/>
|
||||
<source>Could not open wallet: %1; %2</source>
|
||||
<translation>Could not open wallet: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="144"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="144"/>
|
||||
<source>Password not found</source>
|
||||
<translation>Password not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="95"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="95"/>
|
||||
<source>Could not open keystore</source>
|
||||
<translation>Could not open keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="124"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="124"/>
|
||||
<source>Could not create private key generator</source>
|
||||
<translation>Could not create private key generator</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="131"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="131"/>
|
||||
<source>Could not generate new private key</source>
|
||||
<translation>Could not generate new private key</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="139"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="139"/>
|
||||
<source>Could not retrieve private key from keystore</source>
|
||||
<translation>Could not retrieve private key from keystore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="147"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="147"/>
|
||||
<source>Could not create encryption cipher</source>
|
||||
<translation>Could not create encryption cipher</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="155"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="155"/>
|
||||
<source>Could not encrypt data</source>
|
||||
<translation>Could not encrypt data</translation>
|
||||
</message>
|
||||
@@ -2607,12 +2594,7 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation>VPN pool error: no available addresses</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../core/errorstrings.cpp" line="63"/>
|
||||
<source>VPN connection error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../core/errorstrings.cpp" line="67"/>
|
||||
<location filename="../core/errorstrings.cpp" line="64"/>
|
||||
<source>Internal error</source>
|
||||
<translation>Internal error</translation>
|
||||
</message>
|
||||
@@ -2840,62 +2822,62 @@ This means that AmneziaWG keeps the fast performance of the original while addin
|
||||
<translation>Сервис SFTP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/libsecret.cpp" line="119"/>
|
||||
<location filename="../3rd/qtkeychain/libsecret.cpp" line="119"/>
|
||||
<source>Entry not found</source>
|
||||
<translation>Entry not found</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="255"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="225"/>
|
||||
<source>Access to keychain denied</source>
|
||||
<translation>Access to keychain denied</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="257"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="227"/>
|
||||
<source>No keyring daemon</source>
|
||||
<translation>No keyring daemon</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="259"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="229"/>
|
||||
<source>Already unlocked</source>
|
||||
<translation>Already unlocked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="261"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="231"/>
|
||||
<source>No such keyring</source>
|
||||
<translation>No such keyring</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="263"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="233"/>
|
||||
<source>Bad arguments</source>
|
||||
<translation>Bad arguments</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="265"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="235"/>
|
||||
<source>I/O error</source>
|
||||
<translation>I/O error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="267"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="237"/>
|
||||
<source>Cancelled</source>
|
||||
<translation>Cancelled</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="269"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="239"/>
|
||||
<source>Keyring already exists</source>
|
||||
<translation>Keyring already exists</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="271"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="241"/>
|
||||
<source>No match</source>
|
||||
<translation>No match</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="276"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="246"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>Unknown error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="72"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="72"/>
|
||||
<source>error 0x%1: %2</source>
|
||||
<translation>error 0x%1: %2</translation>
|
||||
</message>
|
||||
@@ -2911,13 +2893,13 @@ This means that AmneziaWG keeps the fast performance of the original while addin
|
||||
<context>
|
||||
<name>Settings</name>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="30"/>
|
||||
<location filename="../settings.cpp" line="26"/>
|
||||
<source>Server #1</source>
|
||||
<translation>Server #1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="206"/>
|
||||
<location filename="../settings.cpp" line="213"/>
|
||||
<location filename="../settings.cpp" line="202"/>
|
||||
<location filename="../settings.cpp" line="209"/>
|
||||
<source>Server</source>
|
||||
<translation>Server</translation>
|
||||
</message>
|
||||
@@ -2925,22 +2907,22 @@ This means that AmneziaWG keeps the fast performance of the original while addin
|
||||
<context>
|
||||
<name>SettingsController</name>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="26"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="25"/>
|
||||
<source>Software version</source>
|
||||
<translation>Версия ПО</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="139"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="137"/>
|
||||
<source>All settings have been reset to default values</source>
|
||||
<translation>Все настройки были сброшены к значению "По умолчанию"</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="145"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="143"/>
|
||||
<source>Cached profiles cleared</source>
|
||||
<translation>Кэш профиля очищен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="123"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="122"/>
|
||||
<source>Backup file is corrupted</source>
|
||||
<translation>Backup файл поврежден</translation>
|
||||
</message>
|
||||
@@ -3072,7 +3054,7 @@ This means that AmneziaWG keeps the fast performance of the original while addin
|
||||
<context>
|
||||
<name>VpnConnection</name>
|
||||
<message>
|
||||
<location filename="../vpnconnection.cpp" line="432"/>
|
||||
<location filename="../vpnconnection.cpp" line="429"/>
|
||||
<source>Mbps</source>
|
||||
<translation>Mbps</translation>
|
||||
</message>
|
||||
|
||||
@@ -11,9 +11,15 @@
|
||||
<context>
|
||||
<name>AndroidController</name>
|
||||
<message>
|
||||
<location filename="../platforms/android/android_controller.cpp" line="236"/>
|
||||
<source>AmneziaVPN</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../platforms/android/android_controller.cpp" line="239"/>
|
||||
<source>VPN Connected</source>
|
||||
<extracomment>Refers to the app - which is currently running the background and waiting</extracomment>
|
||||
<translation type="vanished">VPN已连接</translation>
|
||||
<translation>VPN已连接</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@@ -152,7 +158,7 @@
|
||||
<context>
|
||||
<name>ImportController</name>
|
||||
<message>
|
||||
<location filename="../ui/controllers/importController.cpp" line="411"/>
|
||||
<location filename="../ui/controllers/importController.cpp" line="435"/>
|
||||
<source>Scanned %1 of %2.</source>
|
||||
<translation>扫描 %1 of %2.</translation>
|
||||
</message>
|
||||
@@ -991,11 +997,6 @@ And if you don't like the app, all the more support it - the donation will
|
||||
<source>Show other methods on Github</source>
|
||||
<translation>其他捐款途径</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsAbout.qml" line="104"/>
|
||||
<source>https://github.com/amnezia-vpn/amnezia-client#donate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsAbout.qml" line="113"/>
|
||||
<source>Contacts</source>
|
||||
@@ -1510,22 +1511,22 @@ And if you don't like the app, all the more support it - the donation will
|
||||
<translation>服务器名</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="111"/>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="110"/>
|
||||
<source>Save</source>
|
||||
<translation>保存</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="142"/>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="137"/>
|
||||
<source>Protocols</source>
|
||||
<translation>协议</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="148"/>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="143"/>
|
||||
<source>Services</source>
|
||||
<translation>服务</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="152"/>
|
||||
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="147"/>
|
||||
<source>Data</source>
|
||||
<translation>数据</translation>
|
||||
</message>
|
||||
@@ -1956,11 +1957,6 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<source>I have nothing</source>
|
||||
<translation>我没有</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageSetupWizardStart.qml" line="138"/>
|
||||
<source>https://amnezia.org/instructions/0_starter-guide</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PageSetupWizardTextKey</name>
|
||||
@@ -2082,7 +2078,7 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="231"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="486"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="483"/>
|
||||
<source>Users</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -2092,52 +2088,47 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation>共享 VPN 访问,无需管理服务器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="502"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="499"/>
|
||||
<source>Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="584"/>
|
||||
<source>Creation date: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="598"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="595"/>
|
||||
<source>Rename</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="627"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="624"/>
|
||||
<source>Client name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="636"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="632"/>
|
||||
<source>Save</source>
|
||||
<translation type="unfinished">保存</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="668"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="660"/>
|
||||
<source>Revoke</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="671"/>
|
||||
<source>Revoke the config for a user - %1?</source>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="663"/>
|
||||
<source>Revoke the config for a user - </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="672"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="664"/>
|
||||
<source>The user will no longer be able to connect to your server.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="673"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="665"/>
|
||||
<source>Continue</source>
|
||||
<translation type="unfinished">继续</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="674"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="666"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">取消</translation>
|
||||
</message>
|
||||
@@ -2179,8 +2170,8 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation type="obsolete">服务器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="279"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="280"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="281"/>
|
||||
<source>Server</source>
|
||||
<translation>服务器</translation>
|
||||
</message>
|
||||
@@ -2202,8 +2193,8 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation type="obsolete">协议</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="331"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="332"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="333"/>
|
||||
<source>Protocol</source>
|
||||
<translation>协议</translation>
|
||||
</message>
|
||||
@@ -2223,14 +2214,14 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="428"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="429"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="430"/>
|
||||
<source>Connection format</source>
|
||||
<translation>连接格式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="186"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="469"/>
|
||||
<location filename="../ui/qml/Pages2/PageShare.qml" line="468"/>
|
||||
<source>Share</source>
|
||||
<translation>共享</translation>
|
||||
</message>
|
||||
@@ -2260,12 +2251,12 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation type="unfinished">服务器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShareFullAccess.qml" line="100"/>
|
||||
<location filename="../ui/qml/Pages2/PageShareFullAccess.qml" line="102"/>
|
||||
<source>Accessing </source>
|
||||
<translation type="unfinished">访问</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageShareFullAccess.qml" line="101"/>
|
||||
<location filename="../ui/qml/Pages2/PageShareFullAccess.qml" line="103"/>
|
||||
<source>File with accessing settings to </source>
|
||||
<translation type="unfinished">访问配置文件的内容为:</translation>
|
||||
</message>
|
||||
@@ -2296,38 +2287,38 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::DeletePasswordJobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="104"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="104"/>
|
||||
<source>Password entry not found</source>
|
||||
<translation>未发现秘密</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="108"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="108"/>
|
||||
<source>Could not decrypt data</source>
|
||||
<translation>数据无法加密</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="585"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="593"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="552"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="560"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>未知错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="614"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="578"/>
|
||||
<source>Could not open wallet: %1; %2</source>
|
||||
<translation>无法打开钱包: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="177"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="177"/>
|
||||
<source>Password not found</source>
|
||||
<translation>未发现密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="173"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="173"/>
|
||||
<source>Could not open keystore</source>
|
||||
<translation>无法打开密钥库</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="179"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="179"/>
|
||||
<source>Could not remove private key from keystore</source>
|
||||
<translation>无法从密钥库中删除私钥</translation>
|
||||
</message>
|
||||
@@ -2335,12 +2326,12 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::JobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="295"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="265"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>未知错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="542"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="509"/>
|
||||
<source>Access to keychain denied</source>
|
||||
<translation>访问钥匙串被拒绝</translation>
|
||||
</message>
|
||||
@@ -2348,27 +2339,27 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::PlainTextStore</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="65"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="65"/>
|
||||
<source>Could not store data in settings: access error</source>
|
||||
<translation>无法在配置中存储数据:访问错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="67"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="67"/>
|
||||
<source>Could not store data in settings: format error</source>
|
||||
<translation>无法在陪置中存储数据:格式错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="85"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="85"/>
|
||||
<source>Could not delete data from settings: access error</source>
|
||||
<translation>无法在配置中删除数据:访问错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="87"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="87"/>
|
||||
<source>Could not delete data from settings: format error</source>
|
||||
<translation>无法在配置中删除数据:格式错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/plaintextstore.cpp" line="104"/>
|
||||
<location filename="../3rd/qtkeychain/plaintextstore.cpp" line="104"/>
|
||||
<source>Entry not found</source>
|
||||
<translation>未找到条目</translation>
|
||||
</message>
|
||||
@@ -2376,80 +2367,80 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::ReadPasswordJobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="32"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="32"/>
|
||||
<source>Password entry not found</source>
|
||||
<translation>未发现密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="36"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="139"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="36"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="139"/>
|
||||
<source>Could not decrypt data</source>
|
||||
<translation>数据无法加密</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="205"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="178"/>
|
||||
<source>D-Bus is not running</source>
|
||||
<translation>D-Bus未运行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="214"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="224"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="187"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="197"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>未知错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="316"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="286"/>
|
||||
<source>No keychain service available</source>
|
||||
<translation>没有有效的钥匙串服务</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="318"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="288"/>
|
||||
<source>Could not open wallet: %1; %2</source>
|
||||
<translation>无法打开钱包: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="363"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="333"/>
|
||||
<source>Access to keychain denied</source>
|
||||
<translation>访问钥匙串被拒绝</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="384"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="354"/>
|
||||
<source>Could not determine data type: %1; %2</source>
|
||||
<translation>无法确定数据类型: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="393"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="52"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="363"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="52"/>
|
||||
<source>Entry not found</source>
|
||||
<translation>未找到记录</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="402"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="372"/>
|
||||
<source>Unsupported entry type 'Map'</source>
|
||||
<translation>不支持的记录类型 'Map'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="405"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="375"/>
|
||||
<source>Unknown kwallet entry type '%1'</source>
|
||||
<translation>未知钱包类型 '%1'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="96"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="96"/>
|
||||
<source>Password not found</source>
|
||||
<translation>未发现密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="60"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="60"/>
|
||||
<source>Could not open keystore</source>
|
||||
<translation>无法打开密钥库</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="68"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="68"/>
|
||||
<source>Could not retrieve private key from keystore</source>
|
||||
<translation>无法从密钥存储库中检索私钥</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="75"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="75"/>
|
||||
<source>Could not create decryption cipher</source>
|
||||
<translation>无法创建解密算法</translation>
|
||||
</message>
|
||||
@@ -2457,73 +2448,73 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<context>
|
||||
<name>QKeychain::WritePasswordJobPrivate</name>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="78"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="78"/>
|
||||
<source>Credential size exceeds maximum size of %1</source>
|
||||
<translation>证书大小超过上限,最大为: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="87"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="87"/>
|
||||
<source>Credential key exceeds maximum size of %1</source>
|
||||
<translation>凭证密钥大小超过上限,最大为: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="92"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="92"/>
|
||||
<source>Writing credentials failed: Win32 error code %1</source>
|
||||
<translation>写入凭证失败,Win32错误码: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_win.cpp" line="162"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_win.cpp" line="162"/>
|
||||
<source>Encryption failed</source>
|
||||
<translation>加密失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="445"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="415"/>
|
||||
<source>D-Bus is not running</source>
|
||||
<translation>D-Bus未运行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="455"/>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="482"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="425"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="452"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>未知错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="501"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="468"/>
|
||||
<source>Could not open wallet: %1; %2</source>
|
||||
<translation>无法打开钱包: %1; %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="144"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="144"/>
|
||||
<source>Password not found</source>
|
||||
<translation>未发现密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="95"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="95"/>
|
||||
<source>Could not open keystore</source>
|
||||
<translation>无法打开密钥库</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="124"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="124"/>
|
||||
<source>Could not create private key generator</source>
|
||||
<translation>无法创建私钥生成器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="131"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="131"/>
|
||||
<source>Could not generate new private key</source>
|
||||
<translation>无法生成新的私钥</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="139"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="139"/>
|
||||
<source>Could not retrieve private key from keystore</source>
|
||||
<translation>无法从密钥库检索私钥</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="147"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="147"/>
|
||||
<source>Could not create encryption cipher</source>
|
||||
<translation>无法创建加密密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_android.cpp" line="155"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_android.cpp" line="155"/>
|
||||
<source>Could not encrypt data</source>
|
||||
<translation>无法加密数据</translation>
|
||||
</message>
|
||||
@@ -2675,11 +2666,6 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<source>Sftp error: No media was in remote drive</source>
|
||||
<translation>Sftp 错误: 远程驱动器中没有媒介</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../core/errorstrings.cpp" line="63"/>
|
||||
<source>VPN connection error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to save config to disk</source>
|
||||
<translation type="vanished">配置保存到磁盘失败</translation>
|
||||
@@ -2744,7 +2730,7 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
||||
<translation type="vanished">该配置不包含任何用于连接到服务器的容器和凭据。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../core/errorstrings.cpp" line="67"/>
|
||||
<location filename="../core/errorstrings.cpp" line="64"/>
|
||||
<source>Internal error</source>
|
||||
<translation>内部错误</translation>
|
||||
</message>
|
||||
@@ -2984,62 +2970,62 @@ While it offers a blend of security, stability, and speed, it's essential t
|
||||
<translation>Sftp 文件共享服务 - 安全的 FTP 服务</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/libsecret.cpp" line="119"/>
|
||||
<location filename="../3rd/qtkeychain/libsecret.cpp" line="119"/>
|
||||
<source>Entry not found</source>
|
||||
<translation>未找到记录</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="255"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="225"/>
|
||||
<source>Access to keychain denied</source>
|
||||
<translation>访问钥匙串被拒绝</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="257"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="227"/>
|
||||
<source>No keyring daemon</source>
|
||||
<translation>没有密钥环守护进程</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="259"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="229"/>
|
||||
<source>Already unlocked</source>
|
||||
<translation>已经解锁</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="261"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="231"/>
|
||||
<source>No such keyring</source>
|
||||
<translation>没有这样的密钥环</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="263"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="233"/>
|
||||
<source>Bad arguments</source>
|
||||
<translation>错误参数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="265"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="235"/>
|
||||
<source>I/O error</source>
|
||||
<translation>I/O错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="267"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="237"/>
|
||||
<source>Cancelled</source>
|
||||
<translation>已取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="269"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="239"/>
|
||||
<source>Keyring already exists</source>
|
||||
<translation>密匙环已经存在</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="271"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="241"/>
|
||||
<source>No match</source>
|
||||
<translation>不匹配</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_unix.cpp" line="276"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_unix.cpp" line="246"/>
|
||||
<source>Unknown error</source>
|
||||
<translation>未知错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/qtkeychain/qtkeychain/keychain_haiku.cpp" line="72"/>
|
||||
<location filename="../3rd/qtkeychain/keychain_haiku.cpp" line="72"/>
|
||||
<source>error 0x%1: %2</source>
|
||||
<translation>错误 0x%1: %2</translation>
|
||||
</message>
|
||||
@@ -3055,13 +3041,13 @@ While it offers a blend of security, stability, and speed, it's essential t
|
||||
<context>
|
||||
<name>Settings</name>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="30"/>
|
||||
<location filename="../settings.cpp" line="26"/>
|
||||
<source>Server #1</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="206"/>
|
||||
<location filename="../settings.cpp" line="213"/>
|
||||
<location filename="../settings.cpp" line="202"/>
|
||||
<location filename="../settings.cpp" line="209"/>
|
||||
<source>Server</source>
|
||||
<translation>服务器</translation>
|
||||
</message>
|
||||
@@ -3069,22 +3055,22 @@ While it offers a blend of security, stability, and speed, it's essential t
|
||||
<context>
|
||||
<name>SettingsController</name>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="26"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="25"/>
|
||||
<source>Software version</source>
|
||||
<translation>软件版本</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="123"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="122"/>
|
||||
<source>Backup file is corrupted</source>
|
||||
<translation>备份文件已损坏</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="139"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="137"/>
|
||||
<source>All settings have been reset to default values</source>
|
||||
<translation>所配置恢复为默认值</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="145"/>
|
||||
<location filename="../ui/controllers/settingsController.cpp" line="143"/>
|
||||
<source>Cached profiles cleared</source>
|
||||
<translation>缓存的配置文件已清除</translation>
|
||||
</message>
|
||||
@@ -3220,7 +3206,7 @@ While it offers a blend of security, stability, and speed, it's essential t
|
||||
<context>
|
||||
<name>VpnConnection</name>
|
||||
<message>
|
||||
<location filename="../vpnconnection.cpp" line="432"/>
|
||||
<location filename="../vpnconnection.cpp" line="429"/>
|
||||
<source>Mbps</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "core/errorstrings.h"
|
||||
#include "systemController.h"
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "platforms/android/android_utils.h"
|
||||
#include "platforms/android/androidutils.h"
|
||||
#endif
|
||||
#include "qrcodegen.hpp"
|
||||
|
||||
|
||||
@@ -239,12 +239,7 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data)
|
||||
// && !configMap.value("PresharedKey").isEmpty() && !configMap.value("PublicKey").isEmpty()) {
|
||||
lastConfig[config_key::client_priv_key] = configMap.value("PrivateKey");
|
||||
lastConfig[config_key::client_ip] = configMap.value("Address");
|
||||
if (!configMap.value("PresharedKey").isEmpty()) {
|
||||
lastConfig[config_key::psk_key] = configMap.value("PresharedKey");
|
||||
} else if (!configMap.value("PreSharedKey").isEmpty()) {
|
||||
lastConfig[config_key::psk_key] = configMap.value("PreSharedKey");
|
||||
}
|
||||
|
||||
lastConfig[config_key::psk_key] = configMap.value("PresharedKey");
|
||||
lastConfig[config_key::server_pub_key] = configMap.value("PublicKey");
|
||||
// } else {
|
||||
// qDebug() << "Failed to import profile";
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "platforms/android/android_utils.h"
|
||||
#include "../../platforms/android/androidutils.h"
|
||||
#include <QJniObject>
|
||||
#endif
|
||||
#if defined Q_OS_MAC
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include "ui/qautostart.h"
|
||||
#include "version.h"
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "platforms/android/android_utils.h"
|
||||
#include "platforms/android/android_controller.h"
|
||||
#include "../../platforms/android/android_controller.h"
|
||||
#include "../../platforms/android/androidutils.h"
|
||||
#include <QJniObject>
|
||||
#endif
|
||||
|
||||
@@ -92,21 +92,13 @@ void SettingsController::openLogsFolder()
|
||||
|
||||
void SettingsController::exportLogsFile(const QString &fileName)
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
AndroidController::instance()->exportLogsFile(fileName);
|
||||
#else
|
||||
SystemController::saveFile(fileName, Logger::getLogFile());
|
||||
#endif
|
||||
}
|
||||
|
||||
void SettingsController::clearLogs()
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
AndroidController::instance()->clearLogs();
|
||||
#else
|
||||
Logger::clearLogs();
|
||||
Logger::clearServiceLogs();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SettingsController::backupAppConfig(const QString &fileName)
|
||||
@@ -206,14 +198,3 @@ void SettingsController::toggleScreenshotsEnabled(bool enable)
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SettingsController::isCameraPresent()
|
||||
{
|
||||
#if defined Q_OS_IOS
|
||||
return true;
|
||||
#elif defined Q_OS_ANDROID
|
||||
return AndroidController::instance()->isCameraPresent();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -59,8 +59,6 @@ public slots:
|
||||
bool isScreenshotsEnabled();
|
||||
void toggleScreenshotsEnabled(bool enable);
|
||||
|
||||
bool isCameraPresent();
|
||||
|
||||
signals:
|
||||
void primaryDnsChanged();
|
||||
void secondaryDnsChanged();
|
||||
|
||||
@@ -60,11 +60,6 @@ QString SystemController::getFileName(const QString &acceptLabel, const QString
|
||||
const QString &selectedFile, const bool isSaveMode, const QString &defaultSuffix)
|
||||
{
|
||||
QString fileName;
|
||||
#ifdef Q_OS_ANDROID
|
||||
Q_ASSERT(!isSaveMode);
|
||||
return AndroidController::instance()->openFile(nameFilter);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_IOS
|
||||
|
||||
MobileUtils mobileUtils;
|
||||
@@ -113,6 +108,20 @@ QString SystemController::getFileName(const QString &acceptLabel, const QString
|
||||
}
|
||||
|
||||
fileName = mainFileDialog->property("selectedFile").toString();
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
// patch for files containing spaces etc
|
||||
const QString sep { "raw%3A%2F" };
|
||||
if (fileName.startsWith("content://") && fileName.contains(sep)) {
|
||||
QString contentUrl = fileName.split(sep).at(0);
|
||||
QString rawUrl = fileName.split(sep).at(1);
|
||||
rawUrl.replace(" ", "%20");
|
||||
fileName = contentUrl + sep + rawUrl;
|
||||
}
|
||||
|
||||
return fileName;
|
||||
#endif
|
||||
|
||||
return QUrl(fileName).toLocalFile();
|
||||
}
|
||||
|
||||
|
||||
@@ -245,13 +245,8 @@ ErrorCode ClientManagementModel::appendClient(const QString &clientId, const QSt
|
||||
const QByteArray clientsTableString = QJsonDocument(m_clientsTable).toJson();
|
||||
|
||||
ServerController serverController(m_settings);
|
||||
QString clientsTableFile = QString("/opt/amnezia/%1/clientsTable");
|
||||
if (container == DockerContainer::OpenVpn || container == DockerContainer::ShadowSocks
|
||||
|| container == DockerContainer::Cloak) {
|
||||
clientsTableFile = clientsTableFile.arg(ContainerProps::containerTypeToString(DockerContainer::OpenVpn));
|
||||
} else {
|
||||
clientsTableFile = clientsTableFile.arg(ContainerProps::containerTypeToString(container));
|
||||
}
|
||||
const QString clientsTableFile =
|
||||
QString("/opt/amnezia/%1/clientsTable").arg(ContainerProps::containerTypeToString(container));
|
||||
|
||||
error = serverController.uploadTextFileToContainer(container, credentials, clientsTableString, clientsTableFile);
|
||||
if (error != ErrorCode::NoError) {
|
||||
@@ -278,13 +273,8 @@ ErrorCode ClientManagementModel::renameClient(const int row, const QString &clie
|
||||
const QByteArray clientsTableString = QJsonDocument(m_clientsTable).toJson();
|
||||
|
||||
ServerController serverController(m_settings);
|
||||
QString clientsTableFile = QString("/opt/amnezia/%1/clientsTable");
|
||||
if (container == DockerContainer::OpenVpn || container == DockerContainer::ShadowSocks
|
||||
|| container == DockerContainer::Cloak) {
|
||||
clientsTableFile = clientsTableFile.arg(ContainerProps::containerTypeToString(DockerContainer::OpenVpn));
|
||||
} else {
|
||||
clientsTableFile = clientsTableFile.arg(ContainerProps::containerTypeToString(container));
|
||||
}
|
||||
const QString clientsTableFile =
|
||||
QString("/opt/amnezia/%1/clientsTable").arg(ContainerProps::containerTypeToString(container));
|
||||
|
||||
ErrorCode error =
|
||||
serverController.uploadTextFileToContainer(container, credentials, clientsTableString, clientsTableFile);
|
||||
@@ -355,13 +345,8 @@ ErrorCode ClientManagementModel::revokeOpenVpn(const int row, const DockerContai
|
||||
|
||||
const QByteArray clientsTableString = QJsonDocument(m_clientsTable).toJson();
|
||||
|
||||
QString clientsTableFile = QString("/opt/amnezia/%1/clientsTable");
|
||||
if (container == DockerContainer::OpenVpn || container == DockerContainer::ShadowSocks
|
||||
|| container == DockerContainer::Cloak) {
|
||||
clientsTableFile = clientsTableFile.arg(ContainerProps::containerTypeToString(DockerContainer::OpenVpn));
|
||||
} else {
|
||||
clientsTableFile = clientsTableFile.arg(ContainerProps::containerTypeToString(container));
|
||||
}
|
||||
const QString clientsTableFile =
|
||||
QString("/opt/amnezia/%1/clientsTable").arg(ContainerProps::containerTypeToString(container));
|
||||
error = serverController.uploadTextFileToContainer(container, credentials, clientsTableString, clientsTableFile);
|
||||
if (error != ErrorCode::NoError) {
|
||||
logger.error() << "Failed to upload the clientsTable file to the server";
|
||||
@@ -410,13 +395,8 @@ ErrorCode ClientManagementModel::revokeWireGuard(const int row, const DockerCont
|
||||
|
||||
const QByteArray clientsTableString = QJsonDocument(m_clientsTable).toJson();
|
||||
|
||||
QString clientsTableFile = QString("/opt/amnezia/%1/clientsTable");
|
||||
if (container == DockerContainer::OpenVpn || container == DockerContainer::ShadowSocks
|
||||
|| container == DockerContainer::Cloak) {
|
||||
clientsTableFile = clientsTableFile.arg(ContainerProps::containerTypeToString(DockerContainer::OpenVpn));
|
||||
} else {
|
||||
clientsTableFile = clientsTableFile.arg(ContainerProps::containerTypeToString(container));
|
||||
}
|
||||
const QString clientsTableFile =
|
||||
QString("/opt/amnezia/%1/clientsTable").arg(ContainerProps::containerTypeToString(container));
|
||||
error = serverController.uploadTextFileToContainer(container, credentials, clientsTableString, clientsTableFile);
|
||||
if (error != ErrorCode::NoError) {
|
||||
logger.error() << "Failed to upload the clientsTable file to the server";
|
||||
|
||||
@@ -15,10 +15,6 @@ ServersModel::ServersModel(std::shared_ptr<Settings> settings, QObject *parent)
|
||||
auto defaultContainer = ContainerProps::containerFromString(m_servers.at(serverIndex).toObject().value(config_key::defaultContainer).toString());
|
||||
emit ServersModel::defaultContainerChanged(defaultContainer);
|
||||
});
|
||||
connect(this, &ServersModel::currentlyProcessedServerIndexChanged, this, [this](const int serverIndex) {
|
||||
auto defaultContainer = ContainerProps::containerFromString(m_servers.at(serverIndex).toObject().value(config_key::defaultContainer).toString());
|
||||
emit ServersModel::defaultContainerChanged(defaultContainer);
|
||||
});
|
||||
}
|
||||
|
||||
int ServersModel::rowCount(const QModelIndex &parent) const
|
||||
@@ -273,7 +269,6 @@ void ServersModel::removeServer()
|
||||
if (m_settings->serversCount() == 0) {
|
||||
setDefaultServerIndex(-1);
|
||||
}
|
||||
setCurrentlyProcessedServerIndex(m_defaultServerIndex);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@@ -531,8 +526,3 @@ void ServersModel::toggleAmneziaDns(bool enabled)
|
||||
emit defaultServerDescriptionChanged();
|
||||
}
|
||||
|
||||
bool ServersModel::isDefaultServerFromApi()
|
||||
{
|
||||
return m_settings->server(m_defaultServerIndex).value(config_key::configVersion).toInt();
|
||||
}
|
||||
|
||||
|
||||
@@ -97,8 +97,6 @@ public slots:
|
||||
|
||||
void toggleAmneziaDns(bool enabled);
|
||||
|
||||
bool isDefaultServerFromApi();
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
|
||||
@@ -26,22 +26,6 @@ ListView {
|
||||
id: containersRadioButtonGroup
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: ServersModel
|
||||
|
||||
function onCurrentlyProcessedServerIndexChanged() {
|
||||
menuContent.checkCurrentItem()
|
||||
}
|
||||
}
|
||||
|
||||
function checkCurrentItem() {
|
||||
var item = menuContent.itemAtIndex(currentIndex)
|
||||
if (item !== null) {
|
||||
var radioButton = item.children[0].children[0]
|
||||
radioButton.checked = true
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Item {
|
||||
implicitWidth: rootWidth
|
||||
implicitHeight: content.implicitHeight
|
||||
|
||||
@@ -31,7 +31,6 @@ PageType {
|
||||
containersDropDown.rootButtonClickedFunction()
|
||||
}
|
||||
}
|
||||
|
||||
function onForceCloseDrawer() {
|
||||
buttonContent.state = "collapsed"
|
||||
}
|
||||
|
||||
@@ -28,14 +28,6 @@ PageType {
|
||||
anchors.bottom: parent.bottom
|
||||
contentHeight: content.height
|
||||
|
||||
enabled: !ServersModel.isDefaultServerFromApi()
|
||||
|
||||
Component.onCompleted: {
|
||||
if (ServersModel.isDefaultServerFromApi()) {
|
||||
PageController.showNotificationMessage(qsTr("Default server does not support custom dns"))
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
|
||||
|
||||
@@ -55,9 +55,6 @@ PageType {
|
||||
model: SortFilterProxyModel {
|
||||
id: proxyContainersModel
|
||||
sourceModel: ContainersModel
|
||||
sorters: [
|
||||
RoleSorter { roleName: "isInstalled"; sortOrder: Qt.DescendingOrder }
|
||||
]
|
||||
}
|
||||
|
||||
Component.onCompleted: updateContainersModelFilters()
|
||||
|
||||
@@ -21,13 +21,7 @@ PageType {
|
||||
id: root
|
||||
|
||||
property bool pageEnabled: {
|
||||
return !ConnectionController.isConnected && !ServersModel.isDefaultServerFromApi()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (ServersModel.isDefaultServerFromApi()) {
|
||||
PageController.showNotificationMessage(qsTr("Default server does not support split tunneling function"))
|
||||
}
|
||||
return !ConnectionController.isConnected
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
||||
@@ -90,7 +90,7 @@ It's okay as long as it's from someone you trust.")
|
||||
|
||||
LabelWithButtonType {
|
||||
Layout.fillWidth: true
|
||||
visible: SettingsController.isCameraPresent()
|
||||
visible: GC.isMobile()
|
||||
|
||||
text: qsTr("QR-code")
|
||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||
@@ -105,7 +105,7 @@ It's okay as long as it's from someone you trust.")
|
||||
}
|
||||
|
||||
DividerType {
|
||||
visible: SettingsController.isCameraPresent()
|
||||
visible: GC.isMobile()
|
||||
}
|
||||
|
||||
LabelWithButtonType {
|
||||
|
||||
@@ -117,14 +117,12 @@ PageType {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
var item = containers.itemAtIndex(containers.currentIndex)
|
||||
if (item !== null) {
|
||||
var button = item.children[0].children[0]
|
||||
button.checked = true
|
||||
button.clicked()
|
||||
Component.onCompleted: {
|
||||
if (index === containers.currentIndex) {
|
||||
card.checked = true
|
||||
card.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ PageType {
|
||||
function onInstallServerFinished(finishedMessage) {
|
||||
if (!ConnectionController.isConnected) {
|
||||
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
|
||||
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
||||
}
|
||||
|
||||
PageController.goToStartPage()
|
||||
|
||||
@@ -26,7 +26,6 @@ PageType {
|
||||
function onImportFinished() {
|
||||
if (!ConnectionController.isConnected) {
|
||||
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
|
||||
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
||||
}
|
||||
|
||||
PageController.goToStartPage()
|
||||
|
||||
@@ -226,13 +226,13 @@ QStringList Utils::summarizeRoutes(const QStringList &ips, const QString cidr)
|
||||
QString Utils::openVpnExecPath()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
return Utils::executable("openvpn/openvpn", true);
|
||||
return Utils::executable("openvpn/ovpncli", true);
|
||||
#elif defined Q_OS_LINUX
|
||||
// We have service that runs OpenVPN on Linux. We need to make same
|
||||
// path for client and service.
|
||||
return Utils::executable("../../client/bin/openvpn", true);
|
||||
return Utils::executable("../../client/bin/ovpncli", true);
|
||||
#else
|
||||
return Utils::executable("/openvpn", true);
|
||||
return Utils::executable("/ovpncli", true);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+15
-18
@@ -64,26 +64,24 @@ void VpnConnection::onConnectionStateChanged(Vpn::ConnectionState state)
|
||||
IpcClient::Interface()->resetIpStack();
|
||||
IpcClient::Interface()->flushDns();
|
||||
|
||||
if (!m_vpnConfiguration.value(config_key::configVersion).toInt()) {
|
||||
if (m_settings->routeMode() != Settings::VpnAllSites) {
|
||||
IpcClient::Interface()->routeDeleteList(m_vpnProtocol->vpnGateway(), QStringList() << "0.0.0.0");
|
||||
// qDebug() << "VpnConnection::onConnectionStateChanged :: adding custom routes, count:" << forwardIps.size();
|
||||
}
|
||||
QString dns1 = m_vpnConfiguration.value(config_key::dns1).toString();
|
||||
QString dns2 = m_vpnConfiguration.value(config_key::dns2).toString();
|
||||
if (m_settings->routeMode() != Settings::VpnAllSites) {
|
||||
IpcClient::Interface()->routeDeleteList(m_vpnProtocol->vpnGateway(), QStringList() << "0.0.0.0");
|
||||
// qDebug() << "VpnConnection::onConnectionStateChanged :: adding custom routes, count:" << forwardIps.size();
|
||||
}
|
||||
QString dns1 = m_vpnConfiguration.value(config_key::dns1).toString();
|
||||
QString dns2 = m_vpnConfiguration.value(config_key::dns2).toString();
|
||||
|
||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), QStringList() << dns1 << dns2);
|
||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), QStringList() << dns1 << dns2);
|
||||
|
||||
if (m_settings->routeMode() == Settings::VpnOnlyForwardSites) {
|
||||
QTimer::singleShot(1000, m_vpnProtocol.data(),
|
||||
[this]() { addSitesRoutes(m_vpnProtocol->vpnGateway(), m_settings->routeMode()); });
|
||||
} else if (m_settings->routeMode() == Settings::VpnAllExceptSites) {
|
||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), QStringList() << "0.0.0.0/1");
|
||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), QStringList() << "128.0.0.0/1");
|
||||
if (m_settings->routeMode() == Settings::VpnOnlyForwardSites) {
|
||||
QTimer::singleShot(1000, m_vpnProtocol.data(),
|
||||
[this]() { addSitesRoutes(m_vpnProtocol->vpnGateway(), m_settings->routeMode()); });
|
||||
} else if (m_settings->routeMode() == Settings::VpnAllExceptSites) {
|
||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), QStringList() << "0.0.0.0/1");
|
||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), QStringList() << "128.0.0.0/1");
|
||||
|
||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->routeGateway(), QStringList() << remoteAddress());
|
||||
addSitesRoutes(m_vpnProtocol->routeGateway(), m_settings->routeMode());
|
||||
}
|
||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->routeGateway(), QStringList() << remoteAddress());
|
||||
addSitesRoutes(m_vpnProtocol->routeGateway(), m_settings->routeMode());
|
||||
}
|
||||
|
||||
} else if (state == Vpn::ConnectionState::Error) {
|
||||
@@ -298,7 +296,6 @@ QJsonObject VpnConnection::createVpnConfiguration(int serverIndex, const ServerC
|
||||
vpnConfiguration[config_key::hostName] = server.value(config_key::hostName).toString();
|
||||
vpnConfiguration[config_key::description] = server.value(config_key::description).toString();
|
||||
|
||||
vpnConfiguration[config_key::configVersion] = server.value(config_key::configVersion).toInt();
|
||||
// TODO: try to get hostName, port, description for 3rd party configs
|
||||
// vpnConfiguration[config_key::port] = ...;
|
||||
|
||||
|
||||
+10
-21
@@ -7,18 +7,15 @@ usage() {
|
||||
cat <<EOT
|
||||
|
||||
Usage:
|
||||
build_android [options] <artifact_types>
|
||||
build_android [options]
|
||||
|
||||
Build AmneziaVPN android client.
|
||||
|
||||
Artifact types:
|
||||
-u, --aab Build Android App Bundle (AAB)
|
||||
-a, --apk (<abi_list> | all) Build APKs for the specified ABIs or for all available ABIs
|
||||
Available ABIs: 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
||||
<abi_list> - list of ABIs delimited by ';'
|
||||
Build AmneziaVPN android client. By default, a signed Android App Bundle (AAB) is built.
|
||||
|
||||
Options:
|
||||
-d, --debug Build debug version
|
||||
-a, --apk (<abi_list> | all) Build APKs for the specified ABIs or for all available ABIs
|
||||
Available ABIs: 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
||||
<abi_list> - list of ABIs delimited by ';'
|
||||
-b, --build-platform <platform> The SDK platform used for building the Java code of the application
|
||||
By default, the latest available platform is used
|
||||
-m, --move Move the build result to the root of the build directory
|
||||
@@ -28,14 +25,14 @@ EOT
|
||||
}
|
||||
|
||||
BUILD_TYPE="release"
|
||||
AAB=1
|
||||
|
||||
opts=$(getopt -l debug,aab,apk:,build-platform:,move,help -o "dua:b:mh" -- "$@")
|
||||
opts=$(getopt -l debug,apk:,build-platform:,move,help -o "da:b:mh" -- "$@")
|
||||
eval set -- "$opts"
|
||||
while true; do
|
||||
case "$1" in
|
||||
-d | --debug) BUILD_TYPE="debug"; shift;;
|
||||
-u | --aab) AAB=1; shift;;
|
||||
-a | --apk) ABIS=$2; shift 2;;
|
||||
-a | --apk) ABIS=$2; unset AAB; shift 2;;
|
||||
-b | --build-platform) ANDROID_BUILD_PLATFORM=$2; shift 2;;
|
||||
-m | --move) MOVE_RESULT=1; shift;;
|
||||
-h | --help) usage; exit 0;;
|
||||
@@ -52,11 +49,6 @@ if [[ -v ABIS && \
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# At least one artifact type must be specified
|
||||
if [[ ! (-v AAB || -v ABIS) ]]; then
|
||||
usage; exit 0
|
||||
fi
|
||||
|
||||
echo "Build script started..."
|
||||
|
||||
PROJECT_DIR=$(pwd)
|
||||
@@ -145,8 +137,7 @@ gradle_opts=()
|
||||
|
||||
if [ -v AAB ]; then
|
||||
gradle_opts+=(bundle"${BUILD_TYPE^}")
|
||||
fi
|
||||
if [ -v ABIS ]; then
|
||||
else
|
||||
gradle_opts+=(assemble"${BUILD_TYPE^}")
|
||||
fi
|
||||
|
||||
@@ -160,9 +151,7 @@ if [[ -v CI || -v MOVE_RESULT ]]; then
|
||||
if [ -v AAB ]; then
|
||||
mv -u $OUT_APP_DIR/android-build/build/outputs/bundle/$BUILD_TYPE/AmneziaVPN-$BUILD_TYPE.aab \
|
||||
$PROJECT_DIR/deploy/build/
|
||||
fi
|
||||
|
||||
if [ -v ABIS ]; then
|
||||
else
|
||||
if [ "$ABIS" = "all" ]; then
|
||||
ABIS="x86;x86_64;armeabi-v7a;arm64-v8a"
|
||||
fi
|
||||
|
||||
@@ -83,4 +83,6 @@ ldd $CQTDEPLOYER_DIR/bin/binarycreator
|
||||
|
||||
cp -r $PROJECT_DIR/deploy/installer $BUILD_DIR
|
||||
|
||||
$CQTDEPLOYER_DIR/binarycreator.sh --offline-only -v -c $BUILD_DIR/installer/config/linux.xml -p $BUILD_DIR/installer/packages -f $PROJECT_DIR/deploy/AmneziaVPN_Linux_Installer.bin
|
||||
$CQTDEPLOYER_DIR/binarycreator.sh --offline-only -v -c $BUILD_DIR/installer/config/linux.xml -p $BUILD_DIR/installer/packages -f $PROJECT_DIR/deploy/AmneziaVPN_Linux_Installer
|
||||
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ QString TapController::getTapInstallPath()
|
||||
|
||||
QString TapController::getOpenVpnPath()
|
||||
{
|
||||
return qApp->applicationDirPath() + "\\openvpn\\openvpn.exe";
|
||||
return qApp->applicationDirPath() + "\\openvpn\\ovpncli.exe";
|
||||
}
|
||||
|
||||
QString TapController::getTapDriverDir()
|
||||
|
||||
Reference in New Issue
Block a user