More UC Mode refactoring

This commit is contained in:
Michael Mintz 2023-08-23 02:44:24 -04:00
parent 369ab5085c
commit 471e7060ba
3 changed files with 21 additions and 17 deletions

View File

@ -855,11 +855,11 @@ def _set_chrome_options(
if is_using_uc(undetectable, browser_name):
chrome_options.add_argument("--disable-application-cache")
chrome_options.add_argument("--disable-setuid-sandbox")
if is_using_uc(undetectable, browser_name) and not binary_location:
br_app = "google-chrome"
binary_loc = detect_b_ver.get_binary_location(br_app, True)
if os.path.exists(binary_loc):
binary_location = binary_loc
if not binary_location:
br_app = "google-chrome"
binary_loc = detect_b_ver.get_binary_location(br_app, True)
if os.path.exists(binary_loc):
binary_location = binary_loc
if chromium_arg:
# Can be a comma-separated list of Chromium args
chromium_arg_list = chromium_arg.split(",")

View File

@ -99,18 +99,22 @@ def linux_browser_apps_to_cmd(*apps):
def chrome_on_linux_path(prefer_chromium=False):
if os_name() != "linux":
return ""
primary_chrome = "google-chrome"
secondary_chrome = "chromium"
if prefer_chromium:
primary_chrome = "chromium"
secondary_chrome = "google-chrome"
paths = ["/bin/chromium", "/bin/chromium-browser"]
for path in paths:
if os.path.exists(path) and os.access(path, os.X_OK):
return path
paths = ["/bin/google-chrome", "/bin/google-chrome-stable"]
for path in paths:
if os.path.exists(path) and os.access(path, os.X_OK):
return path
paths = os.environ["PATH"].split(os.pathsep)
binaries = []
binaries.append(primary_chrome)
binaries.append(secondary_chrome)
binaries.append("chromium-browser")
binaries.append("chrome")
binaries.append("google-chrome")
binaries.append("google-chrome-stable")
binaries.append("chrome")
binaries.append("chromium")
binaries.append("chromium-browser")
binaries.append("google-chrome-beta")
binaries.append("google-chrome-dev")
binaries.append("google-chrome-unstable")
@ -243,10 +247,10 @@ def get_browser_version_from_os(browser_type):
ChromeType.GOOGLE: {
OSType.LINUX: linux_browser_apps_to_cmd(
"google-chrome",
"google-chrome-stable",
"chrome",
"chromium",
"chromium-browser",
"chrome",
"google-chrome-stable",
"google-chrome-beta",
"google-chrome-dev",
"google-chrome-unstable",

View File

@ -361,10 +361,10 @@ class ValidBrowsers:
class ValidBinaries:
valid_chrome_binaries_on_linux = [
"google-chrome",
"google-chrome-stable",
"chrome",
"chromium",
"chromium-browser",
"chrome",
"google-chrome-stable",
"google-chrome-beta",
"google-chrome-dev",
"google-chrome-unstable",