Merge pull request #13 from Pardus-LiderAhenk/feature-chrome-settings

edited code
This commit is contained in:
Ebru Arslan 2023-03-07 01:22:44 +03:00 committed by GitHub
commit 6294b6a824
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,17 +88,23 @@ class BrowserChrome(AbstractPlugin):
def write_to_chrome_proxy(self):
proxy_full_path = self.local_settings_proxy_profile + self.local_settings_proxy_file
self.silent_remove(proxy_full_path)
# proxy preference lenght bak varsa çalıştır yoksa passs
# if len(proxy_preferences) > 0:
self.create_file(proxy_full_path)
proxy_preferences = json.loads(self.data)
content = " "
if len(proxy_preferences) > 0:
for proxy in proxy_preferences["proxyListChrome"]:
line = ""
line += str(proxy["preferenceName"])
content += line
self.write_file(proxy_full_path, content)
if len(proxy_preferences) > 0:
proxy_data = proxy_preferences["proxyListChrome"]
self.logger.debug(proxy_data)
if proxy_data[0].get('value') == '0' :
line = proxy_data[1].get('preferenceName')
elif proxy_data[0].get('value') == '1':
for proxy in proxy_data[1:5]:
line += str(proxy['preferenceName'] + "\n")
elif proxy_data[0].get('value') == '2':
line = proxy_data[1].get('preferenceName')
self.write_file(proxy_full_path, line)
self.execute_script(proxy_full_path)
else:
self.logger.debug("Proxy preferences files is empty!!")