🤬
  • ■ ■ ■ ■ ■ ■
    changedetectionio/__init__.py
    skipped 660 lines
    661 661   
    662 662   default = deepcopy(datastore.data['settings'])
    663 663   if datastore.proxy_list is not None:
     664 + available_proxies = list(datastore.proxy_list.keys())
    664 665   # When enabled
    665 666   system_proxy = datastore.data['settings']['requests']['proxy']
    666 667   # In the case it doesnt exist anymore
    667  - if not any([system_proxy in tup for tup in datastore.proxy_list]):
     668 + if not system_proxy in available_proxies:
    668 669   system_proxy = None
    669 670   
    670  - default['requests']['proxy'] = system_proxy if system_proxy is not None else datastore.proxy_list[0][0]
     671 + default['requests']['proxy'] = system_proxy if system_proxy is not None else available_proxies[0]
    671 672   # Used by the form handler to keep or remove the proxy settings
    672  - default['proxy_list'] = datastore.proxy_list
     673 + default['proxy_list'] = available_proxies[0]
    673 674   
    674 675   
    675 676   # Don't use form.data on POST so that it doesnt overrid the checkbox status from the POST status
    skipped 8 lines
    684 685   # @todo - Couldn't get setattr() etc dynamic addition working, so remove it instead
    685 686   del form.requests.form.proxy
    686 687   else:
    687  - form.requests.form.proxy.choices = datastore.proxy_list
     688 + form.requests.form.proxy.choices = []
     689 + for p in datastore.proxy_list:
     690 + form.requests.form.proxy.choices.append(tuple((p, datastore.proxy_list[p]['label'])))
     691 + 
    688 692   
    689 693   if request.method == 'POST':
    690 694   # Password unset is a GET, but we can lock the session to a salted env password to always need the password
    skipped 750 lines
    1441 1445   
    1442 1446   # Proxies can be set to have a limit on seconds between which they can be called
    1443 1447   watch_proxy = watch.get('proxy')
    1444  - if watch_proxy and any([watch_proxy in p for p in datastore.proxy_list]):
     1448 + if not watch_proxy:
     1449 + watch_proxy = datastore.data['settings']['requests']['proxy']
     1450 + if not watch_proxy:
     1451 + watch_proxy = list(datastore.proxy_list.keys())[0]
     1452 + 
     1453 + if watch_proxy and watch_proxy in list(datastore.proxy_list.keys()):
    1445 1454   # Proxy may also have some threshold minimum
    1446 1455   proxy_list_reuse_time_minimum = int(datastore.proxy_list.get(watch_proxy, {}).get('reuse_time_minimum', 0))
    1447 1456   if proxy_list_reuse_time_minimum:
    skipped 32 lines
  • ■ ■ ■ ■ ■ ■
    changedetectionio/fetch_site_status.py
    skipped 32 lines
    33 33   return None
    34 34   
    35 35   # If its a valid one
    36  - if any([watch['proxy'] in p for p in self.datastore.proxy_list]):
     36 + if watch['proxy'] and watch['proxy'] in list(self.datastore.proxy_list.keys()):
    37 37   proxy_args = self.datastore.proxy_list.get(watch['proxy']).get('url')
    38 38   
    39 39   # not valid (including None), try the system one
    40 40   else:
    41 41   system_proxy = self.datastore.data['settings']['requests']['proxy']
    42 42   # Is not None and exists
    43  - if self.datastore.proxy_list.get():
     43 + if self.datastore.proxy_list.get(system_proxy):
    44 44   proxy_args = self.datastore.proxy_list.get(system_proxy).get('url')
    45 45   
    46 46   # Fallback - Did not resolve anything, use the first available
    skipped 278 lines
Please wait...
Page is in error, reload to recover