From dca5011eb1c3a400b2044dd2d34bce248933ca44 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:29:06 +0800 Subject: [PATCH] Append HTTP Proxy to VPN setting https://github.com/2dust/v2rayNG/issues/4017 https://github.com/2dust/v2rayNG/issues/4045 --- V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt | 1 + .../src/main/java/com/v2ray/ang/service/V2RayVpnService.kt | 4 +++- .../app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt | 3 +++ .../main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt | 1 + V2rayNG/app/src/main/res/values-ar/strings.xml | 3 +++ V2rayNG/app/src/main/res/values-bn/strings.xml | 4 ++++ V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml | 3 +++ V2rayNG/app/src/main/res/values-fa/strings.xml | 3 +++ V2rayNG/app/src/main/res/values-ru/strings.xml | 3 +++ V2rayNG/app/src/main/res/values-vi/strings.xml | 3 +++ V2rayNG/app/src/main/res/values-zh-rCN/strings.xml | 3 +++ V2rayNG/app/src/main/res/values-zh-rTW/strings.xml | 3 +++ V2rayNG/app/src/main/res/values/strings.xml | 3 +++ V2rayNG/app/src/main/res/xml/pref_settings.xml | 5 +++++ 14 files changed, 41 insertions(+), 1 deletion(-) diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt index 65b757a4..37fa450b 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt @@ -22,6 +22,7 @@ object AppConfig { const val PREF_BYPASS_APPS = "pref_bypass_apps" const val PREF_LOCAL_DNS_ENABLED = "pref_local_dns_enabled" const val PREF_FAKE_DNS_ENABLED = "pref_fake_dns_enabled" + const val PREF_APPEND_HTTP_PROXY = "pref_append_http_proxy" const val PREF_LOCAL_DNS_PORT = "pref_local_dns_port" const val PREF_VPN_DNS = "pref_vpn_dns" const val PREF_ROUTING_DOMAIN_STRATEGY = "pref_routing_domain_strategy" diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/service/V2RayVpnService.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/service/V2RayVpnService.kt index 3faac3ed..53729aa1 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/service/V2RayVpnService.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/service/V2RayVpnService.kt @@ -191,7 +191,9 @@ class V2RayVpnService : VpnService(), ServiceControl { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { builder.setMetered(false) - builder.setHttpProxy(ProxyInfo.buildDirectProxy(LOOPBACK, SettingsManager.getHttpPort())) + if (MmkvManager.decodeSettingsBool(AppConfig.PREF_APPEND_HTTP_PROXY)) { + builder.setHttpProxy(ProxyInfo.buildDirectProxy(LOOPBACK, SettingsManager.getHttpPort())) + } } // Create a new interface using the builder and save the parameters. diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt index 8f743f33..6a92300b 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt @@ -40,6 +40,7 @@ class SettingsActivity : BaseActivity() { private val perAppProxy by lazy { findPreference(AppConfig.PREF_PER_APP_PROXY) } private val localDns by lazy { findPreference(AppConfig.PREF_LOCAL_DNS_ENABLED) } private val fakeDns by lazy { findPreference(AppConfig.PREF_FAKE_DNS_ENABLED) } + private val appendHttpProxy by lazy { findPreference(AppConfig.PREF_APPEND_HTTP_PROXY) } private val localDnsPort by lazy { findPreference(AppConfig.PREF_LOCAL_DNS_PORT) } private val vpnDns by lazy { findPreference(AppConfig.PREF_VPN_DNS) } @@ -175,6 +176,7 @@ class SettingsActivity : BaseActivity() { updateMode(MmkvManager.decodeSettingsString(AppConfig.PREF_MODE, VPN)) localDns?.isChecked = MmkvManager.decodeSettingsBool(AppConfig.PREF_LOCAL_DNS_ENABLED, false) fakeDns?.isChecked = MmkvManager.decodeSettingsBool(AppConfig.PREF_FAKE_DNS_ENABLED, false) + appendHttpProxy?.isChecked = MmkvManager.decodeSettingsBool(AppConfig.PREF_APPEND_HTTP_PROXY, false) localDnsPort?.summary = MmkvManager.decodeSettingsString(AppConfig.PREF_LOCAL_DNS_PORT, AppConfig.PORT_LOCAL_DNS) vpnDns?.summary = MmkvManager.decodeSettingsString(AppConfig.PREF_VPN_DNS, AppConfig.DNS_VPN) @@ -264,6 +266,7 @@ class SettingsActivity : BaseActivity() { perAppProxy?.isChecked = MmkvManager.decodeSettingsBool(AppConfig.PREF_PER_APP_PROXY, false) localDns?.isEnabled = vpn fakeDns?.isEnabled = vpn + appendHttpProxy?.isEnabled = vpn localDnsPort?.isEnabled = vpn vpnDns?.isEnabled = vpn if (vpn) { diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt index cc1cca4c..5f984b0c 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt @@ -54,6 +54,7 @@ class SettingsViewModel(application: Application) : AndroidViewModel(application AppConfig.PREF_PROXY_SHARING, AppConfig.PREF_LOCAL_DNS_ENABLED, AppConfig.PREF_FAKE_DNS_ENABLED, + AppConfig.PREF_APPEND_HTTP_PROXY, AppConfig.PREF_ALLOW_INSECURE, AppConfig.PREF_PREFER_IPV6, AppConfig.PREF_PER_APP_PROXY, diff --git a/V2rayNG/app/src/main/res/values-ar/strings.xml b/V2rayNG/app/src/main/res/values-ar/strings.xml index 92e43cce..04bfad8a 100644 --- a/V2rayNG/app/src/main/res/values-ar/strings.xml +++ b/V2rayNG/app/src/main/res/values-ar/strings.xml @@ -204,6 +204,9 @@ بدء المسح الضوئي على الفور افتح الكاميرا لمسح الرمز ضوئيًا على الفور عند بدء التشغيل، وإلا يمكنك اختيار مسح الرمز ضوئيًا أو تحديد صورة في شريط الأدوات + Append HTTP Proxy to VPN + HTTP proxy will be used directly from (browser/ some supported apps), without going through the virtual NIC device (Android 10+) + ملاحظات ملاحظات التحسينات أو الأخطاء إلى GitHub الانضمام إلى مجموعة Telegram diff --git a/V2rayNG/app/src/main/res/values-bn/strings.xml b/V2rayNG/app/src/main/res/values-bn/strings.xml index 60567766..9493008e 100644 --- a/V2rayNG/app/src/main/res/values-bn/strings.xml +++ b/V2rayNG/app/src/main/res/values-bn/strings.xml @@ -203,6 +203,10 @@ তাত্ক্ষণিক স্ক্যান শুরু করুন শুরুতে তাত্ক্ষণিকভাবে স্ক্যান করতে ক্যামেরা খুলুন, অন্যথায় আপনি কোড স্ক্যান বা টুলবারে একটি ছবি নির্বাচন করতে পারেন + + Append HTTP Proxy to VPN + HTTP proxy will be used directly from (browser/ some supported apps), without going through the virtual NIC device (Android 10+) + মতামত মতামত উন্নয়ন বা বাগগুলি GitHub-এ পাঠান টেলিগ্রাম গ্রুপে যোগদান করুন diff --git a/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml b/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml index 9dc9fb45..3f67a6ee 100644 --- a/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml +++ b/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml @@ -204,6 +204,9 @@ زی اسکنن ره ون شؽواتگرن سی اسکن، زی مجال ره وندن بۊگۊشین، اندی ترین کودن اسکن کۊنین یا شؽواتی ن منه نوار ٱوزار پسند کۊنین. + Append HTTP Proxy to VPN + HTTP proxy will be used directly from (browser/ some supported apps), without going through the virtual NIC device (Android 10+) + فشناڌن منشڌ فشناڌن منشڌ یا داسوو موشکلا من Github ٱووڌن من جرگه تلگرام diff --git a/V2rayNG/app/src/main/res/values-fa/strings.xml b/V2rayNG/app/src/main/res/values-fa/strings.xml index 4824e944..8581fb99 100644 --- a/V2rayNG/app/src/main/res/values-fa/strings.xml +++ b/V2rayNG/app/src/main/res/values-fa/strings.xml @@ -202,6 +202,9 @@ فورا اسکن را شروع کن دوربین را برای اسکن بلافاصله در هنگام راه اندازی باز کنید، در غیر این صورت می توانید کد را اسکن کنید یا عکسی را در نوار ابزار انتخاب کنید. + Append HTTP Proxy to VPN + HTTP proxy will be used directly from (browser/ some supported apps), without going through the virtual NIC device (Android 10+) + بازخورد بازخورد یا گزارش اشکالات در گیت‌ هاب عضویت در گروه تلگرام diff --git a/V2rayNG/app/src/main/res/values-ru/strings.xml b/V2rayNG/app/src/main/res/values-ru/strings.xml index 0bf1e2ad..2cd0c848 100644 --- a/V2rayNG/app/src/main/res/values-ru/strings.xml +++ b/V2rayNG/app/src/main/res/values-ru/strings.xml @@ -204,6 +204,9 @@ Сканирование при запуске Начинать сканирование сразу при запуске приложения или запускать функцию сканирования камерой или из изображения через панель инструментов + Append HTTP Proxy to VPN + HTTP proxy will be used directly from (browser/ some supported apps), without going through the virtual NIC device (Android 10+) + Обратная связь Предложить улучшение или сообщить об ошибке на GitHub Присоединиться к группе в Telegram diff --git a/V2rayNG/app/src/main/res/values-vi/strings.xml b/V2rayNG/app/src/main/res/values-vi/strings.xml index 9854892e..be7697df 100644 --- a/V2rayNG/app/src/main/res/values-vi/strings.xml +++ b/V2rayNG/app/src/main/res/values-vi/strings.xml @@ -203,6 +203,9 @@ Quét mã QR ngay lập tức Mở camera để quét mã QR ngay khi khởi động, nếu không, bạn cũng có thể chọn quét mã hoặc chọn ảnh từ thanh công cụ. + Append HTTP Proxy to VPN + HTTP proxy will be used directly from (browser/ some supported apps), without going through the virtual NIC device (Android 10+) + Phản hồi lỗi Phản hồi cải tiến hoặc lỗi lên GitHub Tham gia nhóm Telegram diff --git a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml index 213a945e..45d4edf5 100644 --- a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml @@ -200,6 +200,9 @@ 立即启动扫码 启动时立即打开相机扫描,否则可在工具栏选择扫码或选照片 + 追加 HTTP 代理至 VPN + 浏览器 / 一些支持的应用 将直接使用 HTTP 代理, 而不经过虚拟网卡设备 (Android 10+) + 反馈 反馈改进或漏洞至 GitHub 加入Telegram Group diff --git a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml index bc74f9b8..12eb38b8 100644 --- a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml @@ -202,6 +202,9 @@ 立即啟動掃碼 啟動時立即打開相機掃描,否則可在工具欄選擇掃碼或選照片 + 追加 HTTP 代理至 VPN + 瀏覽器 / 一些支援的應用 將直接使用 HTTP 代理, 而不經過虛擬網卡設備 (Android 10+) + 意見回饋 前往 GitHub 回報錯誤 加入 Telegram 群組 diff --git a/V2rayNG/app/src/main/res/values/strings.xml b/V2rayNG/app/src/main/res/values/strings.xml index 493d3d0a..46c76af3 100644 --- a/V2rayNG/app/src/main/res/values/strings.xml +++ b/V2rayNG/app/src/main/res/values/strings.xml @@ -207,6 +207,9 @@ Start scanning immediately Open the camera to scan immediately at startup, otherwise you can choose to scan the code or select a photo in the toolbar + Append HTTP Proxy to VPN + HTTP proxy will be used directly from (browser/ some supported apps), without going through the virtual NIC device (Android 10+) + Feedback Feedback enhancements or bugs to GitHub Join Telegram Group diff --git a/V2rayNG/app/src/main/res/xml/pref_settings.xml b/V2rayNG/app/src/main/res/xml/pref_settings.xml index 0649030f..773a7fe4 100644 --- a/V2rayNG/app/src/main/res/xml/pref_settings.xml +++ b/V2rayNG/app/src/main/res/xml/pref_settings.xml @@ -34,6 +34,11 @@ android:summary="@string/summary_pref_fake_dns_enabled" android:title="@string/title_pref_fake_dns_enabled" /> + +