diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 67489ebb..f713222d 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -413,19 +413,9 @@ endif() target_sources(${PROJECT} PRIVATE ${SOURCES} ${HEADERS} ${RESOURCES} ${QRC} ${I18NQRC}) if(MACOS_NE) message("Copy MacOS Network Extension files") - # if(CMAKE_BUILD_TYPE STREQUAL "Release") - # add_custom_command(TARGET ${PROJECT} POST_BUILD - # COMMAND codesign --force --sign 'Apple Distribution: Privacy Technologies OU (X7UJ388FXK)' --timestamp --options runtime - # ${CMAKE_SOURCE_DIR}/client/3rd/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework - # ) - # endif() - add_custom_command(TARGET ${PROJECT} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory $/Contents/Frameworks - # COMMAND ${CMAKE_COMMAND} -E copy_directory - # $ENV{QT_MACOS_ROOT_DIR}/lib/QtConcurrent.framework - # $/Contents/Frameworks/QtConcurrent.framework COMMAND ${CMAKE_COMMAND} -E echo "Copying OpenVPNAdapter.framework..." COMMAND ${CMAKE_COMMAND} -E copy_directory diff --git a/client/amnezia_application.cpp b/client/amnezia_application.cpp index ed64f52c..9a80777a 100644 --- a/client/amnezia_application.cpp +++ b/client/amnezia_application.cpp @@ -270,30 +270,6 @@ bool AmneziaApplication::parseCommands() QCommandLineOption c_cleanup { { "c", "cleanup" }, "Cleanup logs" }; m_parser.addOption(c_cleanup); -#if defined(MACOS_NE) - // Handle positional arguments for MacOS NE - QStringList rawArgs = arguments(); // Get the full list of arguments - QStringList positionalArgs; - - for (int i = 1; i < rawArgs.size(); ++i) { - if (!rawArgs[i].startsWith("-")) { - positionalArgs << rawArgs[i]; // Collect non-option arguments - } - } - - if (!positionalArgs.isEmpty()) { - QString mode = positionalArgs.first(); - qInfo() << "Running in mode:" << mode; - - if (mode == "DebugMode") { - qInfo() << "Debug Mode activated for MacOS NE"; - // Do something specific for DebugMode - } else { - qWarning() << "Unknown mode for MacOS NE:" << mode; - } - } -#endif - m_parser.process(*this); if (m_parser.isSet(c_cleanup)) { diff --git a/client/configurators/ssh_configurator.cpp b/client/configurators/ssh_configurator.cpp index 31983ab9..ced5287c 100644 --- a/client/configurators/ssh_configurator.cpp +++ b/client/configurators/ssh_configurator.cpp @@ -67,6 +67,7 @@ QString SshConfigurator::convertOpenSShKey(const QString &key) #endif } +// DEAD CODE. void SshConfigurator::openSshTerminal(const ServerCredentials &credentials) { #if !defined(Q_OS_IOS) && !defined(MACOS_NE) @@ -101,10 +102,8 @@ QProcessEnvironment SshConfigurator::prepareEnv() pathEnvVar.clear(); pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\cygwin;"); pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn;"); -#elif defined(Q_OS_MAC) -#if !defined(MACOS_NE) +#elif defined(Q_OS_MAC) !defined(MACOS_NE) pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS"); -#endif #endif env.insert("PATH", pathEnvVar); diff --git a/client/macos/networkextension/AmneziaVPNNetworkExtension.entitlements b/client/macos/networkextension/AmneziaVPNNetworkExtension.entitlements index 724cf1bf..91243908 100644 --- a/client/macos/networkextension/AmneziaVPNNetworkExtension.entitlements +++ b/client/macos/networkextension/AmneziaVPNNetworkExtension.entitlements @@ -3,56 +3,34 @@ com.apple.application-identifier - X7UJ388FXK.org.amnezia.AmneziaVPN.network-extension + $(AppIdentifierPrefix)org.amnezia.AmneziaVPN.network-extension com.apple.developer.networking.networkextension packet-tunnel-provider com.apple.developer.team-identifier - X7UJ388FXK + $(AppIdentifierPrefix) com.apple.security.app-sandbox com.apple.security.application-groups group.org.amnezia.AmneziaVPN - com.apple.security.assets.movies.read-write - - com.apple.security.assets.music.read-write - - com.apple.security.assets.pictures.read-write - - com.apple.security.device.audio-input - - com.apple.security.device.bluetooth - com.apple.security.device.camera - com.apple.security.device.usb - com.apple.security.files.downloads.read-write com.apple.security.files.user-selected.read-write com.apple.security.network.client - com.apple.security.network.server - - - com.apple.security.personal-information.addressbook - - com.apple.security.personal-information.calendars - - com.apple.security.personal-information.location - - com.apple.security.print - + com.apple.developer.networking.networkextension + + packet-tunnel-provider + keychain-access-groups $(AppIdentifierPrefix)org.amnezia.AmneziaVPN.network-extension - diff --git a/client/platforms/ios/PacketTunnelProvider+OpenVPN.swift b/client/platforms/ios/PacketTunnelProvider+OpenVPN.swift index 34a19fe5..bfd1165f 100644 --- a/client/platforms/ios/PacketTunnelProvider+OpenVPN.swift +++ b/client/platforms/ios/PacketTunnelProvider+OpenVPN.swift @@ -47,7 +47,7 @@ extension PacketTunnelProvider { let configuration = OpenVPNConfiguration() configuration.fileContent = ovpnConfiguration if str.contains("cloak") { - configuration.setPTCloak() + configuration.setPTCloak() } let evaluation: OpenVPNConfigurationEvaluation? @@ -73,7 +73,7 @@ extension PacketTunnelProvider { startHandler = completionHandler ovpnAdapter?.connect(using: packetFlow) } - + func handleOpenVPNStatusMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) { guard let completionHandler = completionHandler else { return } let bytesin = ovpnAdapter?.transportStatistics.bytesIn diff --git a/client/platforms/ios/PacketTunnelProvider+WireGuard.swift b/client/platforms/ios/PacketTunnelProvider+WireGuard.swift index 8e66b4e0..5d6e66de 100644 --- a/client/platforms/ios/PacketTunnelProvider+WireGuard.swift +++ b/client/platforms/ios/PacketTunnelProvider+WireGuard.swift @@ -111,14 +111,14 @@ extension PacketTunnelProvider { settingsDictionary[pair[0]] = pair[1] } } - + let lastHandshakeString = settingsDictionary["last_handshake_time_sec"] let lastHandshake: Int64 - + if let lastHandshakeValue = lastHandshakeString, let handshakeValue = Int64(lastHandshakeValue) { lastHandshake = handshakeValue } else { - lastHandshake = -2 // Trả về lỗi nếu không có giá trị last_handshake_time_sec + lastHandshake = -2 // Return an error if there is no value for `last_handshake_time_sec` } let response: [String: Any] = [ @@ -194,4 +194,4 @@ extension PacketTunnelProvider { #endif } } -} \ No newline at end of file +} diff --git a/client/platforms/ios/QRCodeReaderBase.mm b/client/platforms/ios/QRCodeReaderBase.mm index 963c35a8..af879e2f 100644 --- a/client/platforms/ios/QRCodeReaderBase.mm +++ b/client/platforms/ios/QRCodeReaderBase.mm @@ -1,4 +1,3 @@ -#if !MACOS_NE #include "QRCodeReaderBase.h" #import @@ -109,19 +108,3 @@ void QRCodeReader::startReading() { void QRCodeReader::stopReading() { [m_qrCodeReader stopReading]; } -#else -#include "QRCodeReaderBase.h" - -QRCodeReader::QRCodeReader() -{ - -} - -QRect QRCodeReader::cameraSize() { - return QRect(); -} - -void QRCodeReader::startReading() {} -void QRCodeReader::stopReading() {} -void QRCodeReader::setCameraSize(QRect) {} -#endif diff --git a/client/platforms/ios/ScreenProtection.swift b/client/platforms/ios/ScreenProtection.swift index a2b5d7a3..1355dc13 100644 --- a/client/platforms/ios/ScreenProtection.swift +++ b/client/platforms/ios/ScreenProtection.swift @@ -1,13 +1,3 @@ -#if MACOS_NE -public func toggleScreenshots(_ isEnabled: Bool) { - -} - -class ScreenProtection { - - -} -#else import UIKit public func toggleScreenshots(_ isEnabled: Bool) { @@ -95,4 +85,3 @@ struct ProtectionPair { textField.removeFromSuperview() } } -#endif