added case for chrome proxy

This commit is contained in:
3bru 2023-03-20 18:33:00 +03:00
parent 0a8622f2f5
commit 99533487ff
3 changed files with 43 additions and 42 deletions

View file

@ -28,10 +28,11 @@ class Logout(AbstractPlugin):
def default_proxy_settings(self):
username = self.get_username()
if (self.execute("su - {0} -c 'gsettings get org.gnome.system.proxy mode'".format(self.username))) != 'none':
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(username))
@ -40,7 +41,7 @@ class Logout(AbstractPlugin):
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(username))
def handle_mode(context):

View file

@ -76,7 +76,7 @@ class BrowserChrome(AbstractPlugin):
def write_to_chrome_proxy(self):
self.default_proxy_settings()
#self.default_proxy_settings()
proxy_type = "0"
proxy_preferences = json.loads(self.data)
username = self.get_username()
@ -121,10 +121,11 @@ class BrowserChrome(AbstractPlugin):
username = self.get_username()
if username is None:
username = self.get_active_user()
if (self.execute("su - {0} -c 'gsettings get org.gnome.system.proxy mode'".format(self.username))) != 'none':
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(username))
@ -133,10 +134,8 @@ class BrowserChrome(AbstractPlugin):
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(username))
def handle_policy(profile_data, context):
browser = BrowserChrome(profile_data, context)
browser.handle_policy()

View file

@ -23,10 +23,11 @@ class Safe(AbstractPlugin):
self.default_proxy_settings()
def default_proxy_settings(self):
if (self.execute("su - {0} -c 'gsettings get org.gnome.system.proxy mode'".format(self.username))) != 'none':
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(self.username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(self.username))
@ -35,7 +36,7 @@ class Safe(AbstractPlugin):
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(self.username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(self.username))
def handle_mode(context):
init = Safe(context)