mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-08-24 23:27:20 +00:00
Small tidyup
This commit is contained in:
@@ -25,6 +25,8 @@ def construct_blueprint(datastore: ChangeDetectionStore):
|
||||
browser_profile_form.fetch_backend.choices = fetcher_choices
|
||||
|
||||
fetcher_supports_screenshots = {name: True for name, _ in fetcher_choices}
|
||||
fetcher_requires_connection_url = {name: True for name, cls in cf.FETCHERS.items()
|
||||
if getattr(cls, 'requires_connection_url', False)}
|
||||
|
||||
# Table shows default built-in profiles first, then user-created profiles
|
||||
store_profiles = datastore.data['settings']['application'].get('browser_profiles', {})
|
||||
@@ -44,6 +46,7 @@ def construct_blueprint(datastore: ChangeDetectionStore):
|
||||
reserved_browser_profile_names=RESERVED_MACHINE_NAMES,
|
||||
fetcher_choices=fetcher_choices,
|
||||
fetcher_supports_screenshots=fetcher_supports_screenshots,
|
||||
fetcher_requires_connection_url=fetcher_requires_connection_url,
|
||||
current_default_profile=current_default,
|
||||
editing_machine_name=editing_machine_name,
|
||||
)
|
||||
|
||||
+6
-1
@@ -80,7 +80,7 @@
|
||||
<div class="pure-control-group inline-radio">
|
||||
{{ render_field(browser_profile_form.fetch_backend, id="profile-fetch-backend") }}
|
||||
</div>
|
||||
<div class="pure-control-group browser-only-field">
|
||||
<div class="pure-control-group browser-only-field cdp-only-field">
|
||||
{{ render_field(browser_profile_form.browser_connection_url) }}
|
||||
<span class="pure-form-message-inline">{{ _('Optional — override the system CDP/WebSocket URL for this profile only (e.g.') }} <code>ws://my-chrome:3000</code>).</span>
|
||||
</div>
|
||||
@@ -128,13 +128,18 @@ function setDefaultProfile(machineName) {
|
||||
}
|
||||
|
||||
const fetcherSupportsBrowser = {{ fetcher_supports_screenshots | tojson }};
|
||||
const fetcherRequiresConnectionUrl = {{ fetcher_requires_connection_url | tojson }};
|
||||
|
||||
function updateBrowserFieldVisibility() {
|
||||
const fetchBackend = document.getElementById('profile-fetch-backend').value;
|
||||
const isBrowser = !!fetcherSupportsBrowser[fetchBackend];
|
||||
const isCdp = !!fetcherRequiresConnectionUrl[fetchBackend];
|
||||
document.querySelectorAll('.browser-only-field').forEach(function(el) {
|
||||
el.style.display = isBrowser ? '' : 'none';
|
||||
});
|
||||
document.querySelectorAll('.cdp-only-field').forEach(function(el) {
|
||||
el.style.display = isCdp ? '' : 'none';
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
@@ -89,10 +89,6 @@ def _register_default_browser_profiles():
|
||||
# Populate the registry at module load time
|
||||
_load_fetchers()
|
||||
|
||||
# Backwards-compat alias: stored data may reference 'playwright' (pre-refactor name).
|
||||
# Map it to playwright_cdp which is the CDP-based fetcher that replaced it.
|
||||
if 'playwright_cdp' in FETCHERS and 'playwright' not in FETCHERS:
|
||||
FETCHERS['playwright'] = FETCHERS['playwright_cdp']
|
||||
|
||||
_register_default_browser_profiles()
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ from changedetectionio.content_fetchers.playwright import PlaywrightBaseFetcher
|
||||
|
||||
class fetcher(PlaywrightBaseFetcher):
|
||||
fetcher_description = "Playwright Chrome (CDP/Remote)"
|
||||
requires_connection_url = True
|
||||
|
||||
def __init__(self, proxy_override=None, custom_browser_connection_url=None, **kwargs):
|
||||
super().__init__(proxy_override=proxy_override, custom_browser_connection_url=custom_browser_connection_url, **kwargs)
|
||||
|
||||
@@ -168,6 +168,7 @@ async def capture_full_page(page, screenshot_format='JPEG', watch_uuid=None, loc
|
||||
|
||||
class fetcher(Fetcher):
|
||||
fetcher_description = "Puppeteer Chromium"
|
||||
requires_connection_url = True
|
||||
|
||||
browser = None
|
||||
browser_type = ''
|
||||
|
||||
@@ -9,6 +9,7 @@ from changedetectionio.pluggy_interface import hookimpl
|
||||
|
||||
class fetcher(Fetcher):
|
||||
fetcher_description = "Selenium WebDriver Chrome"
|
||||
requires_connection_url = True
|
||||
|
||||
proxy = None
|
||||
proxy_url = None
|
||||
|
||||
Reference in New Issue
Block a user