From b4771f63a71f1895e5d28634892c5367b3285510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 26 Oct 2021 10:47:02 -0400 Subject: [PATCH] new: config option to make capture private by default, better working on capture page Related #279 --- config/generic.json.sample | 4 +++- website/web/__init__.py | 1 + website/web/templates/capture.html | 12 +++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/config/generic.json.sample b/config/generic.json.sample index ab75bd18..e0b4617c 100644 --- a/config/generic.json.sample +++ b/config/generic.json.sample @@ -7,8 +7,9 @@ "website_listen_ip": "0.0.0.0", "website_listen_port": 5100, "systemd_service_name": "lookyloo", + "default_public": true, "splash_url": "http://127.0.0.1:8050", - "default_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36", + "default_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36", "users": {}, "time_delta_on_index": { "weeks": 1, @@ -54,6 +55,7 @@ "website_listen_ip": "IP Flask will listen on. Defaults to 0.0.0.0, meaning all interfaces.", "website_listen_port": "Port Flask will listen on.", "systemd_service_name": "(Optional) Name of the systemd service if your project has one.", + "default_public": "If true, the capture is public and will be visible on the index page by default (can be unticked on the capture page)." "splash_url": "URL to connect to splash", "default_user_agent": "Ultimate fallback if the capture form, or the asynchronous submission, doesn't provide a user agent.", "users": "It is some kind of an admin accounts. Format: {username: password}", diff --git a/website/web/__init__.py b/website/web/__init__.py index dacb9031..1b94561c 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -805,6 +805,7 @@ def _prepare_capture_template(user_ua: Optional[str], predefined_url: Optional[s flash('The request will be enqueued, but capturing may take a while and require the administrator to wake up.', 'error') return render_template('capture.html', user_agents=user_agents, default=default_ua, max_depth=max_depth, personal_ua=user_ua, + default_public=get_config('generic', 'default_public'), predefined_url_to_capture=predefined_url if predefined_url else '') diff --git a/website/web/templates/capture.html b/website/web/templates/capture.html index 8d92bd11..471139ac 100644 --- a/website/web/templates/capture.html +++ b/website/web/templates/capture.html @@ -35,7 +35,7 @@
- +
@@ -89,7 +89,7 @@
-
@@ -144,7 +144,13 @@ {% endfor%}
- By default, the capture is public. If you do not want that, untick the box at the top of the form. + + {% if default_public %} + By default, the capture is public. If you do not want that, untick the box at the top of the form. + {% else %} + By default, the capture is private (not visible on the index page). If you want it to be public tick the box at the top of the form. + {% endif %} +