mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-10-26 04:56:59 +09:00
* feat: move amnezia hardcode from sources to cmake * feat: move amnezia hardcode from sources to cmake * refactor: remove prem v1 migration * chore: move more branding * fix: use host-matching architecture for iOS simulator builds x86_64 was hardcoded; Apple Silicon Macs run arm64 simulators and Xcode 26 has no Rosetta simulator destinations, so simulators showed as unsupported. * fix: mark the branded media assets catalog as a bundle resource MACOSX_PACKAGE_LOCATION was set on the upstream Media.xcassets path while target_sources uses CLIENT_IOS_MEDIA_ASSETS_PATH, so a branded catalog was never compiled by actool and the app got a blank icon. * fix: parametrize the Swift app-group identifier used by Log.swift Log.swift hardcoded Amnezia's own app-group instead of the branded one, since Swift -D flags can't carry the string value like the ObjC++ side does. Generate a small Swift constants file instead, same pattern as version.h.in, wired into all four targets that compile Log.swift. * fix: use APPLICATION_NAME instead of hardcoded Amnezia in log line format Every log line printed "Amnezia" regardless of branding; the log file name two lines above this already used APPLICATION_NAME correctly. * fix: restore branding fixes dropped by rebase, rename swiftInterop to swiftBridge * fix: move more branding variables to cmake * feat: move macOS branding from sources to cmake - macos/app/Info.plist.in: app group, camera usage text, UTI ids and descriptions now come from CLIENT_APPLICATION_NAME / BUILD_* variables, mirroring ios/app/Info.plist.in - macos/networkextension/Info.plist.in: bundle names and app group ids are templated; the plist is configured by CMake into the binary dir because Xcode only expands its own $(...) settings - new knobs: CLIENT_MACOS_MEDIA_ASSETS_PATH, CLIENT_MACOS_APP_ICNS_PATH, CLIENT_MACOS_PROVISIONING_PROFILE_SPECIFIER(_DEBUG), CLIENT_MACOS_NE_PROVISIONING_PROFILE_SPECIFIER(_DEBUG) * fix: resolve macOS pf template paths relative to the client source dir CMAKE_SOURCE_DIR points at the wrapper project when the client is built as a subproject, so the pf template lookup failed there. * chore: separate brandings defaults --------- Co-authored-by: vkamn <vk@amnezia.org>
97 lines
2.3 KiB
C++
97 lines
2.3 KiB
C++
#include <QDebug>
|
|
#include <QTimer>
|
|
#include <libssh/libssh.h>
|
|
#include <openssl/ssl.h>
|
|
|
|
#include "amneziaApplication.h"
|
|
#include "core/utils/osSignalHandler.h"
|
|
#include "core/utils/migrations.h"
|
|
#include "core/utils/appUiConfig.h"
|
|
#include "version.h"
|
|
|
|
|
|
// use openssl symbols to prevent linker throwing-off the OpenSSL dependency
|
|
void anchorOpenSSL() {
|
|
SSL_CTX_free(SSL_CTX_new(TLS_method()));
|
|
}
|
|
|
|
#ifdef Q_OS_WIN
|
|
#include "Windows.h"
|
|
#endif
|
|
|
|
#if defined(Q_OS_IOS)
|
|
#include "platforms/ios/QtAppDelegate-C-Interface.h"
|
|
#endif
|
|
|
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
|
bool isAnotherInstanceRunning()
|
|
{
|
|
QLocalSocket socket;
|
|
socket.connectToServer(APP_INSTANCE_NAME);
|
|
if (socket.waitForConnected(500)) {
|
|
qWarning() << APPLICATION_NAME << "is already running";
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
#endif
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
Migrations migrationsManager;
|
|
migrationsManager.doMigrations();
|
|
|
|
#ifdef Q_OS_WIN
|
|
AllowSetForegroundWindow(ASFW_ANY);
|
|
#endif
|
|
|
|
#ifdef Q_OS_ANDROID
|
|
// QTBUG-95974 QTBUG-95764 QTBUG-102168
|
|
qputenv("QT_ANDROID_DISABLE_ACCESSIBILITY", "1");
|
|
qputenv("ANDROID_OPENSSL_SUFFIX", "_3");
|
|
#endif
|
|
|
|
AmneziaApplication app(argc, argv);
|
|
OsSignalHandler::setup();
|
|
|
|
anchorOpenSSL();
|
|
|
|
ssh_init();
|
|
QObject::connect(&app, &QCoreApplication::aboutToQuit, []() {
|
|
ssh_finalize();
|
|
});
|
|
|
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
|
if (isAnotherInstanceRunning()) {
|
|
QTimer::singleShot(1000, &app, [&]() { app.quit(); });
|
|
return app.exec();
|
|
}
|
|
app.startLocalServer();
|
|
#endif
|
|
|
|
// Allow to raise app window if secondary instance launched
|
|
#ifdef Q_OS_WIN
|
|
AllowSetForegroundWindow(0);
|
|
#endif
|
|
|
|
app.registerTypes();
|
|
|
|
app.setApplicationName(APPLICATION_NAME);
|
|
app.setOrganizationName(ORGANIZATION_NAME);
|
|
app.setApplicationDisplayName(APPLICATION_NAME);
|
|
|
|
app.loadFonts();
|
|
|
|
bool doExec = app.parseCommands();
|
|
|
|
if (doExec) {
|
|
app.init();
|
|
|
|
qInfo().noquote() << QString("Started %1 version %2 %3").arg(APPLICATION_NAME, APP_VERSION, GIT_COMMIT_HASH);
|
|
qInfo().noquote() << QString("%1 (%2)").arg(QSysInfo::prettyProductName(), QSysInfo::currentCpuArchitecture());
|
|
|
|
return app.exec();
|
|
}
|
|
return 0;
|
|
}
|