From 9ac379264ee4d6d79eb3b4bf1911f593ce40b7d1 Mon Sep 17 00:00:00 2001 From: Evgeny Volferts Date: Tue, 19 May 2026 13:19:32 +0300 Subject: [PATCH] Add option to disable sending DNS requests via SOCKS proxy --- omega-locales/en_US/LC_MESSAGES/omega-web.po | 6 ++++++ .../src/js/omega_webext_proxy_script.js | 5 +++-- .../src/module/proxy/proxy_impl_firefox.coffee | 9 ++++----- .../src/module/proxy/proxy_impl_listener.coffee | 7 +++---- omega-web/src/omega/controllers/fixed_profile.coffee | 8 ++++++++ omega-web/src/partials/profile_fixed.jade | 8 ++++++++ 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/omega-locales/en_US/LC_MESSAGES/omega-web.po b/omega-locales/en_US/LC_MESSAGES/omega-web.po index e4398df9..018d0d3c 100644 --- a/omega-locales/en_US/LC_MESSAGES/omega-web.po +++ b/omega-locales/en_US/LC_MESSAGES/omega-web.po @@ -641,6 +641,12 @@ msgstr "Use the proxy above for all protocols." msgid "options_proxy_expand" msgstr "Show Advanced" +msgid "options_proxy_proxyDNS" +msgstr "Proxy DNS requests via SOCKS proxy." + +msgid "options_proxy_proxyDNSHelp" +msgstr "This should be disabled if you use DNS-over-HTTPS in Firefox-based browsers." + msgid "options_group_bypassList" msgstr "Bypass List" diff --git a/omega-target-chromium-extension/src/js/omega_webext_proxy_script.js b/omega-target-chromium-extension/src/js/omega_webext_proxy_script.js index 0a653c73..34dc99a3 100644 --- a/omega-target-chromium-extension/src/js/omega_webext_proxy_script.js +++ b/omega-target-chromium-extension/src/js/omega_webext_proxy_script.js @@ -48,8 +48,9 @@ FindProxyForURL = (function () { // https://dxr.mozilla.org/mozilla-central/rev/ffe6cc09ccf38cca6f0e727837bbc6cb722d1e71/toolkit/components/extensions/ProxyScriptContext.jsm#51 proxyInfo.type = 'socks'; // Enable SOCKS5 remote DNS. - // TODO(catus): Maybe allow the users to configure this? - proxyInfo.proxyDNS = true; + if (profile.proxyDNS) { + proxyInfo.proxyDNS = true; + } } if (auth) { proxyInfo.username = auth.username; diff --git a/omega-target-chromium-extension/src/module/proxy/proxy_impl_firefox.coffee b/omega-target-chromium-extension/src/module/proxy/proxy_impl_firefox.coffee index d5379978..549852fa 100644 --- a/omega-target-chromium-extension/src/module/proxy/proxy_impl_firefox.coffee +++ b/omega-target-chromium-extension/src/module/proxy/proxy_impl_firefox.coffee @@ -48,7 +48,7 @@ class FirefoxProxyImpl extends ProxyImpl blobUrl = URL.createObjectURL(blob) browser.proxy.settings.set({ value: { - proxyDNS: true, + proxyDNS: profile.proxyDNS, proxyType: 'autoConfig', autoConfigUrl: blobUrl } @@ -81,7 +81,7 @@ class FirefoxProxyImpl extends ProxyImpl if Array.isArray(result) proxy = result[2] auth = result[3] - return @proxyInfo(proxy, auth) if proxy + return @proxyInfo(proxy, auth, profile.proxyDNS) if proxy next = result[0] else if result.profileName next = OmegaPac.Profiles.nameAsKey(result.profileName) @@ -93,7 +93,7 @@ class FirefoxProxyImpl extends ProxyImpl )) onError: (error) -> @log.error(error) - proxyInfo: (proxy, auth) -> + proxyInfo: (proxy, auth, proxyDNS) -> proxyInfo = type: proxy.scheme host: proxy.host @@ -108,9 +108,8 @@ class FirefoxProxyImpl extends ProxyImpl # HTTP proxy auth must be handled via webRequest.onAuthRequired. proxyInfo.username = auth.username proxyInfo.password = auth.password - if proxyInfo.type == 'socks' + if proxyInfo.type == 'socks' and proxyDNS # Enable SOCKS remote DNS. - # TODO(catus): Maybe allow the users to configure this? proxyInfo.proxyDNS = true # TODO(catus): Maybe allow proxyDNS for socks4? Server may support SOCKS4a. diff --git a/omega-target-chromium-extension/src/module/proxy/proxy_impl_listener.coffee b/omega-target-chromium-extension/src/module/proxy/proxy_impl_listener.coffee index cfccc4e6..3dec0804 100644 --- a/omega-target-chromium-extension/src/module/proxy/proxy_impl_listener.coffee +++ b/omega-target-chromium-extension/src/module/proxy/proxy_impl_listener.coffee @@ -45,7 +45,7 @@ class ListenerProxyImpl extends ProxyImpl if Array.isArray(result) proxy = result[2] auth = result[3] - return @proxyInfo(proxy, auth) if proxy + return @proxyInfo(proxy, auth, profile.proxyDNS) if proxy next = result[0] else if result.profileName next = OmegaPac.Profiles.nameAsKey(result.profileName) @@ -57,7 +57,7 @@ class ListenerProxyImpl extends ProxyImpl )) onError: (error) -> @log.error(error) - proxyInfo: (proxy, auth) -> + proxyInfo: (proxy, auth, proxyDNS) -> proxyInfo = type: proxy.scheme host: proxy.host @@ -72,9 +72,8 @@ class ListenerProxyImpl extends ProxyImpl # HTTP proxy auth must be handled via webRequest.onAuthRequired. proxyInfo.username = auth.username proxyInfo.password = auth.password - if proxyInfo.type == 'socks' + if proxyInfo.type == 'socks' and proxyDNS # Enable SOCKS remote DNS. - # TODO(catus): Maybe allow the users to configure this? proxyInfo.proxyDNS = true # TODO(catus): Maybe allow proxyDNS for socks4? Server may support SOCKS4a. diff --git a/omega-web/src/omega/controllers/fixed_profile.coffee b/omega-web/src/omega/controllers/fixed_profile.coffee index 04f0792c..8c2f5642 100644 --- a/omega-web/src/omega/controllers/fixed_profile.coffee +++ b/omega-web/src/omega/controllers/fixed_profile.coffee @@ -21,6 +21,8 @@ angular.module('omega').controller 'FixedProfileCtrl', ($scope, $modal, $scope.showAdvanced = false + $scope.proxyDNS = $scope.profile.proxyDNS ? true + $scope.optionsForScheme = {} for scheme in $scope.urlSchemes defaultLabel = @@ -95,6 +97,12 @@ angular.module('omega').controller 'FixedProfileCtrl', ($scope, $modal, $scope.$watch 'profile.bypassList', onBypassListChange, true + onProxyDNSChange = (proxyDNS) -> + $scope.profile.proxyDNS = proxyDNS + $scope.proxyDNS = proxyDNS + + $scope.$watch 'proxyDNS', onProxyDNSChange, true + $scope.$watch 'bypassList', (bypassList, oldList) -> return if not bypassList? or bypassList == oldList $scope.profile.bypassList = diff --git a/omega-web/src/partials/profile_fixed.jade b/omega-web/src/partials/profile_fixed.jade index 0b0a4e4e..802ad169 100644 --- a/omega-web/src/partials/profile_fixed.jade +++ b/omega-web/src/partials/profile_fixed.jade @@ -35,6 +35,14 @@ div(ng-controller='FixedProfileCtrl') td(colspan='7') button.btn.btn-link(ng-click='showAdvanced = true') | #[span.glyphicon.glyphicon-chevron-down] {{'options_proxy_expand' | tr}} + tbody + tr + td(colspan='7') + div.checkbox + label + input(type='checkbox' ng-model='proxyDNS') + span {{'options_proxy_proxyDNS' | tr}} + p.help-block(omega-html="'options_proxy_proxyDNSHelp' | tr") section.settings-group h3 {{'options_group_bypassList' | tr}} p.help-block {{'options_bypassListHelp' | tr}}