diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 54c02804..a9f66f37 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -610,6 +610,8 @@ def changedetection_app(config=None, datastore_o=None): # For the form widget tag uuid lookup form.tags.datastore = datastore # in _value + for p in datastore.extra_browsers: + form.fetch_backend.choices.append(p) form.fetch_backend.choices.append(("system", 'System settings default')) diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index e8c35cb8..16ffd0b0 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -496,6 +496,12 @@ class SingleExtraProxy(Form): proxy_url = StringField('Proxy URL', [validators.Optional()], render_kw={"placeholder": "socks5:// or regular proxy http://user:pass@...:3128", "size":50}) # @todo do the validation here instead +class SingleExtraBrowser(Form): + browser_name = StringField('Name', [validators.Optional()], render_kw={"placeholder": "Name"}) + browser_connection_url = StringField('Browser connection URL', [validators.Optional()], render_kw={"placeholder": "wss://brightdata... wss://oxylabs etc", "size":50}) + # @todo do the validation here instead + + # datastore.data['settings']['requests'].. class globalSettingsRequestForm(Form): time_between_check = FormField(TimeBetweenCheckForm) @@ -504,6 +510,7 @@ class globalSettingsRequestForm(Form): render_kw={"style": "width: 5em;"}, validators=[validators.NumberRange(min=0, message="Should contain zero or more seconds")]) extra_proxies = FieldList(FormField(SingleExtraProxy), min_entries=5) + extra_browsers = FieldList(FormField(SingleExtraBrowser), min_entries=5) def validate_extra_proxies(self, extra_validators=None): for e in self.data['extra_proxies']: diff --git a/changedetectionio/model/App.py b/changedetectionio/model/App.py index 697d0d00..1202d5db 100644 --- a/changedetectionio/model/App.py +++ b/changedetectionio/model/App.py @@ -16,6 +16,7 @@ class model(dict): }, 'requests': { 'extra_proxies': [], # Configurable extra proxies via the UI + 'extra_browsers': [], # Configurable extra proxies via the UI 'jitter_seconds': 0, 'proxy': None, # Preferred proxy connection 'time_between_check': {'weeks': None, 'days': None, 'hours': 3, 'minutes': None, 'seconds': None}, diff --git a/changedetectionio/processors/__init__.py b/changedetectionio/processors/__init__.py index 225e9c8a..b4cb00c6 100644 --- a/changedetectionio/processors/__init__.py +++ b/changedetectionio/processors/__init__.py @@ -4,7 +4,6 @@ import hashlib class difference_detection_processor(): - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/changedetectionio/static/styles/scss/parts/_extra_browsers.scss b/changedetectionio/static/styles/scss/parts/_extra_browsers.scss new file mode 100644 index 00000000..da0204ad --- /dev/null +++ b/changedetectionio/static/styles/scss/parts/_extra_browsers.scss @@ -0,0 +1,24 @@ +ul#requests-extra_browsers { + list-style: none; + /* tidy up the table to look more "inline" */ + li { + > label { + display: none; + } + + } + + /* each proxy entry is a `table` */ + table { + tr { + display: inline; + } + } +} + +#extra-browsers-setting { + border: 1px solid var(--color-grey-800); + border-radius: 4px; + margin: 1em; + padding: 1em; +} \ No newline at end of file diff --git a/changedetectionio/static/styles/scss/parts/_extra_proxies.scss b/changedetectionio/static/styles/scss/parts/_extra_proxies.scss index 756dd9b9..ed6de397 100644 --- a/changedetectionio/static/styles/scss/parts/_extra_proxies.scss +++ b/changedetectionio/static/styles/scss/parts/_extra_proxies.scss @@ -60,3 +60,10 @@ body.proxy-check-active { padding-bottom: 1em; } + +#extra-proxies-setting { + border: 1px solid var(--color-grey-800); + border-radius: 4px; + margin: 1em; + padding: 1em; +} diff --git a/changedetectionio/static/styles/scss/styles.scss b/changedetectionio/static/styles/scss/styles.scss index f5ae8a9f..77cee346 100644 --- a/changedetectionio/static/styles/scss/styles.scss +++ b/changedetectionio/static/styles/scss/styles.scss @@ -5,6 +5,7 @@ @import "parts/_arrows"; @import "parts/_browser-steps"; @import "parts/_extra_proxies"; +@import "parts/_extra_browsers"; @import "parts/_pagination"; @import "parts/_spinners"; @import "parts/_variables"; diff --git a/changedetectionio/static/styles/styles.css b/changedetectionio/static/styles/styles.css index 33071546..3431d250 100644 --- a/changedetectionio/static/styles/styles.css +++ b/changedetectionio/static/styles/styles.css @@ -128,6 +128,27 @@ body.proxy-check-active #request .proxy-timing { border-radius: 4px; padding: 1em; } +#extra-proxies-setting { + border: 1px solid var(--color-grey-800); + border-radius: 4px; + margin: 1em; + padding: 1em; } + +ul#requests-extra_browsers { + list-style: none; + /* tidy up the table to look more "inline" */ + /* each proxy entry is a `table` */ } + ul#requests-extra_browsers li > label { + display: none; } + ul#requests-extra_browsers table tr { + display: inline; } + +#extra-browsers-setting { + border: 1px solid var(--color-grey-800); + border-radius: 4px; + margin: 1em; + padding: 1em; } + .pagination-page-info { color: #fff; font-size: 0.85rem; diff --git a/changedetectionio/store.py b/changedetectionio/store.py index 6306a391..c00018c4 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -633,6 +633,18 @@ class ChangeDetectionStore: return {} + @property + def extra_browsers(self): + res = [] + p = list(filter( + lambda s: (s.get('browser_name') and s.get('browser_connection_url')), + self.__data['settings']['requests'].get('extra_browsers', []))) + if p: + for i in p: + res.append(("extra_browser_"+i['browser_name'], i['browser_name'])) + + return res + def tag_exists_by_name(self, tag_name): return any(v.get('title', '').lower() == tag_name.lower() for k, v in self.__data['settings']['application']['tags'].items()) diff --git a/changedetectionio/templates/settings.html b/changedetectionio/templates/settings.html index 31fa576f..bc9ac1f5 100644 --- a/changedetectionio/templates/settings.html +++ b/changedetectionio/templates/settings.html @@ -227,11 +227,15 @@ nav

Tip: "Residential" and "Mobile" proxy type can be more successfull than "Data Center" for blocked websites. -

+
{{ render_field(form.requests.form.extra_proxies) }} "Name" will be used for selecting the proxy in the Watch Edit settings
SOCKS5 proxies with authentication are only supported with 'plain requests' fetcher, for other fetchers you should whitelist the IP access instead
+
+ Extra Browsers allow changedetection.io to communicate with a different web-browser.
+ {{ render_field(form.requests.form.extra_browsers) }} +