MacOS NE dirty build

This commit is contained in:
Mykola Baibuz 2024-07-08 08:12:10 -07:00
parent 0612f70c06
commit 6f58f19958
43 changed files with 7454 additions and 3976 deletions

@ -1 +1 @@
Subproject commit ff8445c8aa1cda38497bb6f6cb0e520f5a3c8de0 Subproject commit eab32a8e63494517fdb5644fbd7235343b937052

@ -1 +1 @@
Subproject commit 7c821a8d5c1ad5ad94e0763b4f25a875b5a6fe1b Subproject commit b7d88501b1bb8bcb7088cdf927f2b401c130d4c7

View file

@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
set(PROJECT AmneziaVPN) set(PROJECT AmneziaVPN)
project(${PROJECT}) project(${PROJECT})
set(IOS 1)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "Autogen") set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "Autogen")
@ -384,4 +385,5 @@ if(NOT IOS AND NOT ANDROID)
endif() endif()
target_sources(${PROJECT} PRIVATE ${SOURCES} ${HEADERS} ${RESOURCES} ${QRC} ${I18NQRC}) target_sources(${PROJECT} PRIVATE ${SOURCES} ${HEADERS} ${RESOURCES} ${QRC} ${I18NQRC})
set(IOS 0)
qt_finalize_target(${PROJECT}) qt_finalize_target(${PROJECT})

View file

@ -217,7 +217,7 @@ void AmneziaApplication::registerTypes()
declareQmlProtocolEnum(); declareQmlProtocolEnum();
declareQmlContainerEnum(); declareQmlContainerEnum();
qmlRegisterType<QRCodeReader>("QRCodeReader", 1, 0, "QRCodeReader"); // qmlRegisterType<QRCodeReader>("QRCodeReader", 1, 0, "QRCodeReader");
m_containerProps.reset(new ContainerProps()); m_containerProps.reset(new ContainerProps());
qmlRegisterSingletonInstance("ContainerProps", 1, 0, "ContainerProps", m_containerProps.get()); qmlRegisterSingletonInstance("ContainerProps", 1, 0, "ContainerProps", m_containerProps.get());

View file

@ -1,6 +1,8 @@
#ifndef AMNEZIA_APPLICATION_H #ifndef AMNEZIA_APPLICATION_H
#define AMNEZIA_APPLICATION_H #define AMNEZIA_APPLICATION_H
#define Q_OS_IOS 1
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>

View file

@ -38,12 +38,12 @@ elseif(APPLE AND NOT IOS)
set(OPENSSL_LIB_SSL_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libssl.a") set(OPENSSL_LIB_SSL_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libssl.a")
set(OPENSSL_LIB_CRYPTO_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libcrypto.a") set(OPENSSL_LIB_CRYPTO_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libcrypto.a")
elseif(IOS) elseif(IOS)
set(LIBSSH_INCLUDE_DIR "${LIBSSH_ROOT_DIR}/ios/arm64") set(LIBSSH_INCLUDE_DIR "${LIBSSH_ROOT_DIR}/macos/x86_64")
set(LIBSSH_LIB_PATH "${LIBSSH_ROOT_DIR}/ios/arm64/libssh.a") set(LIBSSH_LIB_PATH "${LIBSSH_ROOT_DIR}/macos/x86_64/libssh.a")
set(ZLIB_LIB_PATH "${LIBSSH_ROOT_DIR}/ios/arm64/libz.a") set(ZLIB_LIB_PATH "${LIBSSH_ROOT_DIR}/macos/x86_64/libz.a")
set(OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/ios/iphone/include") set(OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/macos/include")
set(OPENSSL_LIB_SSL_PATH "${OPENSSL_ROOT_DIR}/ios/iphone/lib/libssl.a") set(OPENSSL_LIB_SSL_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libssl.a")
set(OPENSSL_LIB_CRYPTO_PATH "${OPENSSL_ROOT_DIR}/ios/iphone/lib/libcrypto.a") set(OPENSSL_LIB_CRYPTO_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libcrypto.a")
elseif(ANDROID) elseif(ANDROID)
set(abi ${CMAKE_ANDROID_ARCH_ABI}) set(abi ${CMAKE_ANDROID_ARCH_ABI})
set(LIBSSH_INCLUDE_DIR "${LIBSSH_ROOT_DIR}/android/${abi}") set(LIBSSH_INCLUDE_DIR "${LIBSSH_ROOT_DIR}/android/${abi}")

View file

@ -37,7 +37,7 @@ while(IOS_TARGETS)
## I just want to say it's amazing this doesn't explode with syntax errors. ## I just want to say it's amazing this doesn't explode with syntax errors.
message("Patching architectures for ${TARGET_NAME}") message("Patching architectures for ${TARGET_NAME}")
set_target_properties(${TARGET_NAME} PROPERTIES set_target_properties(${TARGET_NAME} PROPERTIES
XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "arm64" XCODE_ATTRIBUTE_ARCHS[sdk=macosx*] "x86_64"
XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64" XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64"
) )
endwhile() endwhile()

View file

@ -11,7 +11,7 @@ find_package(Qt6 REQUIRED COMPONENTS ShaderTools)
set(LIBS ${LIBS} Qt6::ShaderTools) set(LIBS ${LIBS} Qt6::ShaderTools)
find_library(FW_AUTHENTICATIONSERVICES AuthenticationServices) find_library(FW_AUTHENTICATIONSERVICES AuthenticationServices)
find_library(FW_UIKIT UIKit) #find_library(FW_UIKIT UIKit)
find_library(FW_AVFOUNDATION AVFoundation) find_library(FW_AVFOUNDATION AVFoundation)
find_library(FW_FOUNDATION Foundation) find_library(FW_FOUNDATION Foundation)
find_library(FW_STOREKIT StoreKit) find_library(FW_STOREKIT StoreKit)
@ -20,7 +20,7 @@ find_library(FW_NETWORKEXTENSION NetworkExtension)
set(LIBS ${LIBS} set(LIBS ${LIBS}
${FW_AUTHENTICATIONSERVICES} ${FW_AUTHENTICATIONSERVICES}
${FW_UIKIT} # ${FW_UIKIT}
${FW_AVFOUNDATION} ${FW_AVFOUNDATION}
${FW_FOUNDATION} ${FW_FOUNDATION}
${FW_STOREKIT} ${FW_STOREKIT}

View file

@ -1,5 +1,7 @@
#include "openvpn_configurator.h" #include "openvpn_configurator.h"
#define Q_OS_IOS 1
#include <QDebug> #include <QDebug>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>

View file

@ -1,5 +1,7 @@
#include "ssh_configurator.h" #include "ssh_configurator.h"
#define Q_OS_IOS 1
#include <QDebug> #include <QDebug>
#include <QObject> #include <QObject>
#include <QProcess> #include <QProcess>
@ -101,8 +103,8 @@ QProcessEnvironment SshConfigurator::prepareEnv()
pathEnvVar.clear(); pathEnvVar.clear();
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\cygwin;"); pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\cygwin;");
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn;"); pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn;");
#elif defined(Q_OS_MACX) //#elif defined(Q_OS_MACX)
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS"); // pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS");
#endif #endif
env.insert("PATH", pathEnvVar); env.insert("PATH", pathEnvVar);

View file

@ -1,3 +1,5 @@
#define Q_OS_IOS 1
#include "apiController.h" #include "apiController.h"
#include <QEventLoop> #include <QEventLoop>

View file

@ -5,10 +5,12 @@
#include <QObject> #include <QObject>
#include "ipc.h" #include "ipc.h"
#include "rep_ipc_interface_replica.h" //#include "rep_ipc_interface_replica.h"
#include "privileged_process.h" #include "privileged_process.h"
/*
class IpcClient : public QObject class IpcClient : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -46,6 +48,6 @@ private:
bool m_isSocketConnected {false}; bool m_isSocketConnected {false};
static IpcClient *m_instance; static IpcClient *m_instance;
}; }; */
#endif // IPCCLIENT_H #endif // IPCCLIENT_H

View file

@ -3,21 +3,21 @@
#include <QObject> #include <QObject>
#include "rep_ipc_process_interface_replica.h" // #include "rep_ipc_process_interface_replica.h"
// This class is dangerous - instance of this class casted from base class, // This class is dangerous - instance of this class casted from base class,
// so it support only functions // so it support only functions
// Do not add any members into it // Do not add any members into it
// //
class PrivilegedProcess : public IpcProcessInterfaceReplica //class PrivilegedProcess : public IpcProcessInterfaceReplica
{ //{
Q_OBJECT // Q_OBJECT
public: //public:
PrivilegedProcess(); // PrivilegedProcess();
~PrivilegedProcess() override; // ~PrivilegedProcess() override;
void waitForFinished(int msecs); // void waitForFinished(int msecs);
}; //};
#endif // PRIVILEGED_PROCESS_H #endif // PRIVILEGED_PROCESS_H

View file

@ -52,9 +52,9 @@ find_library(FW_MOBILE_CORE MobileCoreServices)
find_library(FW_UI_KIT UIKit) find_library(FW_UI_KIT UIKit)
find_library(FW_LIBRESOLV libresolv.9.tbd) find_library(FW_LIBRESOLV libresolv.9.tbd)
target_link_libraries(networkextension PRIVATE ${FW_ASSETS_LIBRARY}) #target_link_libraries(networkextension PRIVATE ${FW_ASSETS_LIBRARY})
target_link_libraries(networkextension PRIVATE ${FW_MOBILE_CORE}) #target_link_libraries(networkextension PRIVATE ${FW_MOBILE_CORE})
target_link_libraries(networkextension PRIVATE ${FW_UI_KIT}) #target_link_libraries(networkextension PRIVATE ${FW_UI_KIT})
target_link_libraries(networkextension PRIVATE ${FW_LIBRESOLV}) target_link_libraries(networkextension PRIVATE ${FW_LIBRESOLV})
target_compile_options(networkextension PRIVATE -DGROUP_ID=\"${BUILD_IOS_GROUP_IDENTIFIER}\") target_compile_options(networkextension PRIVATE -DGROUP_ID=\"${BUILD_IOS_GROUP_IDENTIFIER}\")

View file

@ -11,7 +11,7 @@ EOF
cd 3rd/OpenVPNAdapter cd 3rd/OpenVPNAdapter
if $XCODEBUILD -scheme OpenVPNAdapter -configuration Release -xcconfig Configuration/amnezia.xcconfig -sdk iphoneos -destination 'generic/platform=iOS' -project OpenVPNAdapter.xcodeproj ; then if $XCODEBUILD -scheme OpenVPNAdapter -configuration Release -xcconfig Configuration/amnezia.xcconfig -sdk macosx14.2 -destination 'generic/platform=MacOS' -project OpenVPNAdapter.xcodeproj ; then
echo "OpenVPNAdapter built successfully" echo "OpenVPNAdapter built successfully"
else else
echo "OpenVPNAdapter build failed" echo "OpenVPNAdapter build failed"

View file

@ -8,14 +8,6 @@ class QRCodeReader: public QObject {
Q_OBJECT Q_OBJECT
public: public:
QRCodeReader();
QRect cameraSize();
public slots:
void startReading();
void stopReading();
void setCameraSize(QRect value);
signals: signals:
void codeReaded(QString code); void codeReaded(QString code);

View file

@ -1,12 +1,12 @@
#include "QRCodeReaderBase.h" #include "QRCodeReaderBase.h"
#import <UIKit/UIKit.h> //#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h> #import <AVFoundation/AVFoundation.h>
@interface QRCodeReaderImpl : UIViewController //@interface QRCodeReaderImpl : UIViewController
@end //@end
@interface QRCodeReaderImpl () <AVCaptureMetadataOutputObjectsDelegate> /*@interface QRCodeReaderImpl () <AVCaptureMetadataOutputObjectsDelegate>
@property (nonatomic) QRCodeReader* qrCodeReader; @property (nonatomic) QRCodeReader* qrCodeReader;
@property (nonatomic, strong) AVCaptureSession *captureSession; @property (nonatomic, strong) AVCaptureSession *captureSession;
@property (nonatomic, strong) AVCaptureVideoPreviewLayer *videoPreviewPlayer; @property (nonatomic, strong) AVCaptureVideoPreviewLayer *videoPreviewPlayer;
@ -15,15 +15,15 @@
@implementation QRCodeReaderImpl @implementation QRCodeReaderImpl
- (void)viewDidLoad { //- (void)viewDidLoad {
[super viewDidLoad]; // [super viewDidLoad];
_captureSession = nil; // _captureSession = nil;
} //}
- (void)setQrCodeReader: (QRCodeReader*)value { //- (void)setQrCodeReader: (QRCodeReader*)value {
_qrCodeReader = value; // _qrCodeReader = value;
} //}
- (BOOL)startReading { - (BOOL)startReading {
NSError *error; NSError *error;
@ -49,7 +49,7 @@
_videoPreviewPlayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession: _captureSession]; _videoPreviewPlayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession: _captureSession];
CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height; //CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
QRect cameraRect = _qrCodeReader->cameraSize(); QRect cameraRect = _qrCodeReader->cameraSize();
CGRect cameraCGRect = CGRectMake(cameraRect.x(), CGRect cameraCGRect = CGRectMake(cameraRect.x(),
@ -60,7 +60,7 @@
[_videoPreviewPlayer setVideoGravity: AVLayerVideoGravityResizeAspectFill]; [_videoPreviewPlayer setVideoGravity: AVLayerVideoGravityResizeAspectFill];
[_videoPreviewPlayer setFrame: cameraCGRect]; [_videoPreviewPlayer setFrame: cameraCGRect];
CALayer* layer = [UIApplication sharedApplication].keyWindow.layer; // CALayer* layer = [UIApplication sharedApplication].keyWindow.layer;
[layer addSublayer: _videoPreviewPlayer]; [layer addSublayer: _videoPreviewPlayer];
[_captureSession startRunning]; [_captureSession startRunning];
@ -107,4 +107,4 @@ void QRCodeReader::startReading() {
void QRCodeReader::stopReading() { void QRCodeReader::stopReading() {
[m_qrCodeReader stopReading]; [m_qrCodeReader stopReading];
} }*/

View file

@ -1,4 +1,4 @@
#import <UIKit/UIKit.h> //#import <UIKit/UIKit.h>
@interface QIOSApplicationDelegate @interface QIOSApplicationDelegate
@end @end

View file

@ -6,7 +6,7 @@
@implementation QIOSApplicationDelegate (AmneziaVPNDelegate) @implementation QIOSApplicationDelegate (AmneziaVPNDelegate)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions /*- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ {
[application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum]; [application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum];
// Override point for customization after application launch. // Override point for customization after application launch.
@ -56,6 +56,6 @@
return YES; return YES;
} }
return NO; return NO;
} }*/
@end @end

View file

@ -1,87 +1,10 @@
import UIKit //import UIKit
public func toggleScreenshots(_ isEnabled: Bool) { public func toggleScreenshots(_ isEnabled: Bool) {
let window = UIApplication.shared.keyWindows.first!
if isEnabled {
ScreenProtection.shared.disable(for: window.rootViewController!.view)
} else {
ScreenProtection.shared.enable(for: window.rootViewController!.view)
}
}
extension UIApplication {
var keyWindows: [UIWindow] {
connectedScenes
.compactMap {
if #available(iOS 15.0, *) {
($0 as? UIWindowScene)?.keyWindow
} else {
($0 as? UIWindowScene)?.windows.first { $0.isKeyWindow }
}
}
}
} }
class ScreenProtection { class ScreenProtection {
public static let shared = ScreenProtection()
var pairs = [ProtectionPair]()
private var blurView: UIVisualEffectView?
private var recordingObservation: NSKeyValueObservation?
public func enable(for view: UIView) {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
view.subviews.forEach {
self.pairs.append(ProtectionPair(from: $0))
}
}
}
public func disable(for view: UIView) {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
self.pairs.forEach {
$0.removeProtection()
}
self.pairs.removeAll()
}
}
}
struct ProtectionPair {
let textField: UITextField
let layer: CALayer
init(from view: UIView) {
let secureTextField = UITextField()
secureTextField.backgroundColor = .clear
secureTextField.translatesAutoresizingMaskIntoConstraints = false
secureTextField.isSecureTextEntry = true
view.insertSubview(secureTextField, at: 0)
secureTextField.isUserInteractionEnabled = false
view.layer.superlayer?.addSublayer(secureTextField.layer)
secureTextField.layer.sublayers?.last?.addSublayer(view.layer)
secureTextField.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
secureTextField.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = true
secureTextField.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true
secureTextField.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = true
self.init(textField: secureTextField, layer: view.layer)
}
init(textField: UITextField, layer: CALayer) {
self.textField = textField
self.layer = layer
}
func removeProtection() {
textField.superview?.superview?.layer.addSublayer(layer)
textField.layer.removeFromSuperlayer()
textField.removeFromSuperview()
}
} }

View file

@ -27,15 +27,15 @@ const char* MessageKey::isOnDemand = "is-on-demand";
const char* MessageKey::SplitTunnelType = "SplitTunnelType"; const char* MessageKey::SplitTunnelType = "SplitTunnelType";
const char* MessageKey::SplitTunnelSites = "SplitTunnelSites"; const char* MessageKey::SplitTunnelSites = "SplitTunnelSites";
static UIViewController* getViewController() { //static UIViewController* getViewController() {
NSArray *windows = [[UIApplication sharedApplication]windows]; // NSArray *windows = [[UIApplication sharedApplication]windows];
for (UIWindow *window in windows) { // for (UIWindow *window in windows) {
if (window.isKeyWindow) { // if (window.isKeyWindow) {
return window.rootViewController; // return window.rootViewController;
} // }
} // }
return nil; // return nil;
} //}
Vpn::ConnectionState iosStatusToState(NEVPNStatus status) { Vpn::ConnectionState iosStatusToState(NEVPNStatus status) {
switch (status) { switch (status) {
@ -748,24 +748,24 @@ bool IosController::shareText(const QStringList& filesToSend) {
[sharingItems addObject:logFileUrl]; [sharingItems addObject:logFileUrl];
} }
UIViewController *qtController = getViewController(); // UIViewController *qtController = getViewController();
if (!qtController) return; // if (!qtController) return;
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil]; // UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];
__block bool isAccepted = false; __block bool isAccepted = false;
[activityController setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) { // [activityController setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
isAccepted = completed; // isAccepted = completed;
emit finished(); // emit finished();
}]; // }];
[qtController presentViewController:activityController animated:YES completion:nil]; // [qtController presentViewController:activityController animated:YES completion:nil];
UIPopoverPresentationController *popController = activityController.popoverPresentationController; // UIPopoverPresentationController *popController = activityController.popoverPresentationController;
if (popController) { // if (popController) {
popController.sourceView = qtController.view; // popController.sourceView = qtController.view;
popController.sourceRect = CGRectMake(100, 100, 100, 100); // popController.sourceRect = CGRectMake(100, 100, 100, 100);
} // }
QEventLoop wait; QEventLoop wait;
QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit); QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit);
@ -775,26 +775,26 @@ bool IosController::shareText(const QStringList& filesToSend) {
} }
QString IosController::openFile() { QString IosController::openFile() {
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.item"] inMode:UIDocumentPickerModeOpen]; // UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.item"] inMode:UIDocumentPickerModeOpen];
DocumentPickerDelegate *documentPickerDelegate = [[DocumentPickerDelegate alloc] init]; // DocumentPickerDelegate *documentPickerDelegate = [[DocumentPickerDelegate alloc] init];
documentPicker.delegate = documentPickerDelegate; // documentPicker.delegate = documentPickerDelegate;
UIViewController *qtController = getViewController(); // UIViewController *qtController = getViewController();
if (!qtController) return; // if (!qtController) return;
[qtController presentViewController:documentPicker animated:YES completion:nil]; // [qtController presentViewController:documentPicker animated:YES completion:nil];
__block QString filePath; __block QString filePath;
documentPickerDelegate.documentPickerClosedCallback = ^(NSString *path) { // documentPickerDelegate.documentPickerClosedCallback = ^(NSString *path) {
if (path) { // if (path) {
filePath = QString::fromUtf8(path.UTF8String); // filePath = QString::fromUtf8(path.UTF8String);
} else { // } else {
filePath = QString(); // filePath = QString();
} // }
emit finished(); // emit finished();
}; // };
QEventLoop wait; QEventLoop wait;
QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit); QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit);

View file

@ -1,7 +1,7 @@
#import <NetworkExtension/NetworkExtension.h> #import <NetworkExtension/NetworkExtension.h>
#import <NetworkExtension/NETunnelProviderSession.h> #import <NetworkExtension/NETunnelProviderSession.h>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <UIKit/UIKit.h> //#include <UIKit/UIKit.h>
#include <Security/Security.h> #include <Security/Security.h>
class IosController; class IosController;
@ -18,8 +18,8 @@ class IosController;
typedef void (^DocumentPickerClosedCallback)(NSString *path); typedef void (^DocumentPickerClosedCallback)(NSString *path);
@interface DocumentPickerDelegate : NSObject <UIDocumentPickerDelegate> //@interface DocumentPickerDelegate : NSObject <UIDocumentPickerDelegate>
@property (nonatomic, copy) DocumentPickerClosedCallback documentPickerClosedCallback; //@property (nonatomic, copy) DocumentPickerClosedCallback documentPickerClosedCallback;
@end //@end

View file

@ -26,20 +26,20 @@
@end @end
@implementation DocumentPickerDelegate //@implementation DocumentPickerDelegate
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls { //- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
for (NSURL *url in urls) { // for (NSURL *url in urls) {
if (self.documentPickerClosedCallback) { // if (self.documentPickerClosedCallback) {
self.documentPickerClosedCallback([url path]); // self.documentPickerClosedCallback([url path]);
} // }
} // }
} //}
- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller { //- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller {
if (self.documentPickerClosedCallback) { // if (self.documentPickerClosedCallback) {
self.documentPickerClosedCallback(nil); // self.documentPickerClosedCallback(nil);
} // }
} //}
@end //@end

View file

@ -6,8 +6,9 @@
#import <UserNotifications/UserNotifications.h> #import <UserNotifications/UserNotifications.h>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h> //#import <UIKit/UIKit.h>
/*
@interface IOSNotificationDelegate @interface IOSNotificationDelegate
: UIResponder <UIApplicationDelegate, UNUserNotificationCenterDelegate> { : UIResponder <UIApplicationDelegate, UNUserNotificationCenterDelegate> {
IOSNotificationHandler* m_iosNotificationHandler; IOSNotificationHandler* m_iosNotificationHandler;
@ -86,4 +87,4 @@ void IOSNotificationHandler::notify(NotificationHandler::Message type, const QSt
NSLog(@"Local Notification failed"); NSLog(@"Local Notification failed");
} }
}]; }];
} }*/

View file

@ -26,7 +26,7 @@ private:
#ifndef Q_OS_IOS #ifndef Q_OS_IOS
QProcess m_ckProcess; QProcess m_ckProcess;
#endif #endif
QTemporaryFile m_cloakCfgFile; // QTemporaryFile m_cloakCfgFile;
QMetaObject::Connection m_errorHandlerConnection; QMetaObject::Connection m_errorHandlerConnection;
}; };

View file

@ -45,7 +45,7 @@ private:
ManagementServer m_managementServer; ManagementServer m_managementServer;
QString m_configFileName; QString m_configFileName;
QJsonObject m_configData; QJsonObject m_configData;
QTemporaryFile m_configFile; // QTemporaryFile m_configFile;
uint selectMgmtPort(); uint selectMgmtPort();
@ -53,7 +53,7 @@ private:
void updateRouteGateway(QString line); void updateRouteGateway(QString line);
void updateVpnGateway(const QString &line); void updateVpnGateway(const QString &line);
QSharedPointer<PrivilegedProcess> m_openVpnProcess; // QSharedPointer<PrivilegedProcess> m_openVpnProcess;
}; };
#endif // OPENVPNPROTOCOL_H #endif // OPENVPNPROTOCOL_H

View file

@ -5,6 +5,8 @@
#include "QProcess" #include "QProcess"
#include "containers/containers_defs.h" #include "containers/containers_defs.h"
#define Q_OS_IOS 1
class ShadowSocksVpnProtocol : public OpenVpnProtocol class ShadowSocksVpnProtocol : public OpenVpnProtocol
{ {
public: public:
@ -27,7 +29,7 @@ private:
#ifndef Q_OS_IOS #ifndef Q_OS_IOS
QProcess m_ssProcess; QProcess m_ssProcess;
#endif #endif
QTemporaryFile m_shadowSocksCfgFile; // QTemporaryFile m_shadowSocksCfgFile;
}; };
#endif // SHADOWSOCKSVPNPROTOCOL_H #endif // SHADOWSOCKSVPNPROTOCOL_H

View file

@ -1,16 +1,11 @@
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
#define Q_OS_IOS 1
#include "core/errorstrings.h" #include "core/errorstrings.h"
#include "vpnprotocol.h" #include "vpnprotocol.h"
#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
#include "openvpnovercloakprotocol.h"
#include "openvpnprotocol.h"
#include "shadowsocksvpnprotocol.h"
#include "wireguardprotocol.h"
#include "xrayprotocol.h"
#endif
#ifdef Q_OS_WINDOWS #ifdef Q_OS_WINDOWS
#include "ikev2_vpn_protocol_windows.h" #include "ikev2_vpn_protocol_windows.h"
@ -108,15 +103,6 @@ VpnProtocol *VpnProtocol::factory(DockerContainer container, const QJsonObject &
switch (container) { switch (container) {
#if defined(Q_OS_WINDOWS) #if defined(Q_OS_WINDOWS)
case DockerContainer::Ipsec: return new Ikev2Protocol(configuration); case DockerContainer::Ipsec: return new Ikev2Protocol(configuration);
#endif
#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
case DockerContainer::OpenVpn: return new OpenVpnProtocol(configuration);
case DockerContainer::Cloak: return new OpenVpnOverCloakProtocol(configuration);
case DockerContainer::ShadowSocks: return new ShadowSocksVpnProtocol(configuration);
case DockerContainer::WireGuard: return new WireguardProtocol(configuration);
case DockerContainer::Awg: return new WireguardProtocol(configuration);
case DockerContainer::Xray: return new XrayProtocol(configuration);
case DockerContainer::SSXray: return new XrayProtocol(configuration);
#endif #endif
default: return nullptr; default: return nullptr;
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,7 @@
#include "connectionController.h" #include "connectionController.h"
#define Q_OS_IOS 1
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
#include <QGuiApplication> #include <QGuiApplication>
#else #else

View file

@ -2,6 +2,8 @@
#include "utils/converter.h" #include "utils/converter.h"
#include "core/errorstrings.h" #include "core/errorstrings.h"
#define Q_OS_IOS 1
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
#include <QGuiApplication> #include <QGuiApplication>
#else #else
@ -37,8 +39,8 @@ PageController::PageController(const QSharedPointer<ServersModel> &serversModel,
#endif #endif
#if defined Q_OS_MACX #if defined Q_OS_MACX
connect(this, &PageController::raiseMainWindow, []() { setDockIconVisible(true); }); // connect(this, &PageController::raiseMainWindow, []() { setDockIconVisible(true); });
connect(this, &PageController::hideMainWindow, []() { setDockIconVisible(false); }); // connect(this, &PageController::hideMainWindow, []() { setDockIconVisible(false); });
#endif #endif
connect(this, qOverload<ErrorCode>(&PageController::showErrorMessage), this, &PageController::onShowErrorMessage); connect(this, qOverload<ErrorCode>(&PageController::showErrorMessage), this, &PageController::onShowErrorMessage);
@ -134,7 +136,7 @@ void PageController::showOnStartup()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
emit hideMainWindow(); emit hideMainWindow();
#elif defined Q_OS_MACX #elif defined Q_OS_MACX
setDockIconVisible(false); // setDockIconVisible(false);
#endif #endif
} }
} }

View file

@ -5,6 +5,8 @@
#include <QDebug> #include <QDebug>
#include "notificationhandler.h" #include "notificationhandler.h"
#define Q_OS_IOS 1
#if defined(Q_OS_IOS) #if defined(Q_OS_IOS)
# include "platforms/ios/iosnotificationhandler.h" # include "platforms/ios/iosnotificationhandler.h"
#else #else
@ -14,7 +16,7 @@
// static // static
NotificationHandler* NotificationHandler::create(QObject* parent) { NotificationHandler* NotificationHandler::create(QObject* parent) {
#if defined(Q_OS_IOS) #if defined(Q_OS_IOS)
return new IOSNotificationHandler(parent); return nullptr;//new IOSNotificationHandler(parent);
#else #else
# if defined(Q_OS_LINUX) # if defined(Q_OS_LINUX)

View file

@ -4,7 +4,6 @@ import QtQuick.Layouts
import QtQuick.Dialogs import QtQuick.Dialogs
import PageEnum 1.0 import PageEnum 1.0
import QRCodeReader 1.0
import "./" import "./"
import "../Controls2" import "../Controls2"
@ -63,23 +62,5 @@ PageType {
color: "transparent" color: "transparent"
//radius: 16 //radius: 16
QRCodeReader {
id: qrCodeReader
onCodeReaded: function(code) {
ImportController.parseQrCodeChunk(code)
progressBar.value = ImportController.getQrCodeScanProgressBarValue()
header.progressString = ImportController.getQrCodeScanProgressString()
}
Component.onCompleted: {
qrCodeReader.setCameraSize(Qt.rect(qrCodeRectange.x,
qrCodeRectange.y,
qrCodeRectange.width,
qrCodeRectange.height))
qrCodeReader.startReading()
}
Component.onDestruction: qrCodeReader.stopReading()
}
} }
} }

View file

@ -7,9 +7,6 @@
#include "notificationhandler.h" #include "notificationhandler.h"
#include <QMenu>
#include <QSystemTrayIcon>
class SystemTrayNotificationHandler : public NotificationHandler { class SystemTrayNotificationHandler : public NotificationHandler {
Q_OBJECT Q_OBJECT

View file

@ -12,6 +12,8 @@
#include <configurators/wireguard_configurator.h> #include <configurators/wireguard_configurator.h>
#include "core/controllers/serverController.h" #include "core/controllers/serverController.h"
#define Q_OS_IOS 1
#ifdef AMNEZIA_DESKTOP #ifdef AMNEZIA_DESKTOP
#include "core/ipcclient.h" #include "core/ipcclient.h"
#include "ipc.h" #include "ipc.h"

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>packet-tunnel-provider</string>
</array>
<key>com.apple.security.application-groups</key>
<array>
<string>group.org.amnezia.AmneziaVPN</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)group.org.amnezia.AmneziaVPN</string>
</array>
</dict>
</plist>