mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2026-11-10 12:28:21 +00:00
Emit --disable-features once instead of letting the second discard the first (#1772)
This commit is contained in:
1 parent
4df093c62e
commit
9f6effd4a6
1 file changed
+31
-6
+31
-6
@@ -153,11 +153,34 @@ def get_webdriver(proxy: dict = None) -> WebDriver:
|
||||
options.add_argument('--disable-gpu-sandbox')
|
||||
options.add_argument('--ignore-certificate-errors')
|
||||
options.add_argument('--ignore-ssl-errors')
|
||||
# disable breaking popup
|
||||
options.add_argument("--disable-features=LocalNetworkAccessChecks")
|
||||
# disable AI model download
|
||||
options.add_argument("--disable-features=OptimizationGuideOnDeviceModel")
|
||||
options.add_argument("--disable-features=GlicActor,GlicActorUi,PromptAPIForGeminiNano,PromptAPIX,PromptAPINoTranslation,SummarizationAPIForGeminiNano,WriterAPIForGeminiNano,TranslationAPI,LanguageDetectionAPI,AIPromptAPI,AIRewriteAPI,AIWritingAssistant,AIGenerativeSuggestions,AIGeneratedFlags,AICompositionFeature,HistoryAI,TabOrganizer,SmartSuggestion")
|
||||
|
||||
# Chrome parses --disable-features as a single value: passing the switch a
|
||||
# second time keeps the last value and silently discards the earlier one
|
||||
# whole, along with every feature it named. Collect the names here and emit
|
||||
# one switch once, below, after every branch that may add to them.
|
||||
disabled_features = [
|
||||
'LocalNetworkAccessChecks', # disable breaking popup
|
||||
# disable AI model download
|
||||
'OptimizationGuideOnDeviceModel',
|
||||
'GlicActor',
|
||||
'GlicActorUi',
|
||||
'PromptAPIForGeminiNano',
|
||||
'PromptAPIX',
|
||||
'PromptAPINoTranslation',
|
||||
'SummarizationAPIForGeminiNano',
|
||||
'WriterAPIForGeminiNano',
|
||||
'TranslationAPI',
|
||||
'LanguageDetectionAPI',
|
||||
'AIPromptAPI',
|
||||
'AIRewriteAPI',
|
||||
'AIWritingAssistant',
|
||||
'AIGenerativeSuggestions',
|
||||
'AIGeneratedFlags',
|
||||
'AICompositionFeature',
|
||||
'HistoryAI',
|
||||
'TabOrganizer',
|
||||
'SmartSuggestion',
|
||||
]
|
||||
|
||||
language = os.environ.get('LANG', None)
|
||||
if language is not None:
|
||||
@@ -170,13 +193,15 @@ def get_webdriver(proxy: dict = None) -> WebDriver:
|
||||
proxy_extension_dir = None
|
||||
if proxy and all(key in proxy for key in ['url', 'username', 'password']):
|
||||
proxy_extension_dir = create_proxy_extension(proxy)
|
||||
options.add_argument("--disable-features=DisableLoadExtensionCommandLineSwitch")
|
||||
disabled_features.append('DisableLoadExtensionCommandLineSwitch')
|
||||
options.add_argument("--load-extension=%s" % os.path.abspath(proxy_extension_dir))
|
||||
elif proxy and 'url' in proxy:
|
||||
proxy_url = proxy['url']
|
||||
logging.debug("Using webdriver proxy: %s", proxy_url)
|
||||
options.add_argument('--proxy-server=%s' % proxy_url)
|
||||
|
||||
options.add_argument('--disable-features=%s' % ','.join(disabled_features))
|
||||
|
||||
# note: headless mode is detected (headless = True)
|
||||
# we launch the browser in head-full mode with the window hidden
|
||||
windows_headless = False
|
||||
|
||||
Reference in new issue
Block a user