From f7974ea68bb78219bb2b3826637545b1527a536d Mon Sep 17 00:00:00 2001 From: Conner Vieira Date: Tue, 11 Jun 2024 20:38:50 -0400 Subject: [PATCH 1/2] Updated configuration support files --- assets/support/configdefault.json | 3 ++- assets/support/configoutline.json | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/support/configdefault.json b/assets/support/configdefault.json index 9803a73..db7cfe4 100755 --- a/assets/support/configdefault.json +++ b/assets/support/configdefault.json @@ -319,6 +319,7 @@ "print_timings": false, "dashcam_saving_queue_overflow": 2000, "dashcam_shortterm_framerate_interval": 0.25, - "hard_crash_on_error": false + "hard_crash_on_error": false, + "identify_to_remote_sources": true } } diff --git a/assets/support/configoutline.json b/assets/support/configoutline.json index e1c6218..29afcae 100755 --- a/assets/support/configoutline.json +++ b/assets/support/configoutline.json @@ -263,6 +263,8 @@ "kill_plate": "str", "print_timings": "bool", "dashcam_saving_queue_overflow": "+int", - "dashcam_shortterm_framerate_interval": "+float" + "dashcam_shortterm_framerate_interval": "+float", + "hard_crash_on_error": "bool", + "identify_to_remote_sources": "bool" } } From dca9e58b09247ae9f636204a813d8314c9887fce Mon Sep 17 00:00:00 2001 From: Conner Vieira Date: Thu, 13 Jun 2024 01:08:56 -0400 Subject: [PATCH 2/2] Updated status lighting behavior --- CHANGELOG.md | 4 +++- docs/CONFIGURE.md | 2 ++ lighting.py | 24 ++++++++++++++---------- main.py | 9 ++++++++- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ab6c3..1d7af3a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -478,7 +478,9 @@ This update focuses on improving the reliability of Predator, especially when op - Added the ability to disable capture devices without removing them from the configuration entirely. - Predator now changes the status light color when a video is being locked. - Dashcam video save events can now be triggered using buttons via GPIO pins. -- Moved the status lighting configuration to the "general" section. +- Updated status lighting. + - Moved the status lighting configuration to the "general" section. + - Network requests are only made to update the status lighting if it has changed since the last update. - Updated configuration back-end. - Predator can now automatically update the configuration file between versions when configuration values are added or removed. - Added an initial start-up sequence, where Predator shows some basic information before the normal start-up. diff --git a/docs/CONFIGURE.md b/docs/CONFIGURE.md index c6dc9d8..411789a 100755 --- a/docs/CONFIGURE.md +++ b/docs/CONFIGURE.md @@ -347,3 +347,5 @@ This document describes the configuration values found `config.json`. - This short-term frame-rate is currently only used for visual purposes, and does not effect output files. - `hard_crash_on_error` is a boolean that determines whether Predator will globally exit if an error is encountered. This is useful if you run Predator as an unmonitored headless service, and you want to force it to restart when an error is encountered. - Keep in mind that enabling this configuration option will cause Predator to boot-loop if the problem that caused the error isn't resolved between start-ups. + - `identify_to_remote_sources` determines whether Predator will attach its randomly generated identifier when fetching hot-lists from remote sources. This is helpful to allow administrators of remote hot-list sources to see how many clients are using their server. + - If you don't control the servers in your remote hot-list sources, you may consider disabling this feature to make it more difficult to identify you. diff --git a/lighting.py b/lighting.py index e7a671f..b5d63d2 100755 --- a/lighting.py +++ b/lighting.py @@ -36,15 +36,19 @@ exit() +current_status_light_id = "" def update_status_lighting(url_id): + global current_status_light_id debug_message("Updating status lighting") - if (config["general"]["status_lighting"]["enabled"] == True): # Only update the status lighting if it is enabled in the configuration. - status_lighting_update_url = str(config["general"]["status_lighting"]["values"][url_id]).replace("[U]", str(config["general"]["status_lighting"]["base_url"])) # Prepare the URL where a request will be sent in order to update the status lighting. - if (config["developer"]["offline"] == False): # Check to make sure offline mode is disabled before sending the network request to update the status lighting. - if (validators.url(status_lighting_update_url)): # Check to make sure the URL ID supplied actually resolves to a valid URL in the configuration database. - try: - response = requests.get(status_lighting_update_url, timeout=0.5) - except: - display_message("Failed to update status lighting. The request timed out.", 3) # Display a warning indicating that the status lighting request timed out. - else: - display_message("Unable to update status lighting. Invalid URL configured for " + url_id, 3) # Display a warning indicating that the URL was invalid, and no network request was sent. + if (url_id !== current_status_light_id): # Check to see if the status light URL ID is different from the current state of the lights. + current_status_light_id = url_id + if (config["general"]["status_lighting"]["enabled"] == True): # Only update the status lighting if it is enabled in the configuration. + status_lighting_update_url = str(config["general"]["status_lighting"]["values"][url_id]).replace("[U]", str(config["general"]["status_lighting"]["base_url"])) # Prepare the URL where a request will be sent in order to update the status lighting. + if (config["developer"]["offline"] == False): # Check to make sure offline mode is disabled before sending the network request to update the status lighting. + if (validators.url(status_lighting_update_url)): # Check to make sure the URL ID supplied actually resolves to a valid URL in the configuration database. + try: + response = requests.get(status_lighting_update_url, timeout=0.5) + except: + display_message("Failed to update status lighting. The request timed out.", 3) # Display a warning indicating that the status lighting request timed out. + else: + display_message("Unable to update status lighting. Invalid URL configured for " + url_id, 3) # Display a warning indicating that the URL was invalid, and no network request was sent. diff --git a/main.py b/main.py index 7a3953a..51c975e 100755 --- a/main.py +++ b/main.py @@ -99,7 +99,6 @@ print(" - Remotely-managed hot-lists and ignore-lists") print(" - Compiled data reports") print(" - Remote ALPR processing") - print() print("To learn more, don't hesitate to get in contact: " + style.underline + "https://v0lttech.com/contact.php\n" + style.end) input(style.faint + "Press enter to continue..." + style.end) @@ -111,6 +110,14 @@ print("For more information, see the `SECURITY.md` document.") input(style.faint + "Press enter to continue..." + style.end) + print("") + clear() + print(style.bold + style.red + "Privacy" + style.end) + print("Predator does not share telemetry or usage data with V0LT, or any other entity. However, by default, Predator will attach a random identifier to requests made to remote license plate list sources (as configured under `general>alerts>databases`). This identifier allows administrators of servers hosting license plate lists to roughly count how many clients are using their lists. If you're concerned about the administrator of one of your remote license plate lists using this unique identifier to derive information about how often you use Predator, you can disable this functionality using the `developer>identify_to_remote_sources` configuration value.") + print("For more information, see the `CONFIGURE.md` document.") + input(style.faint + "Press enter to continue..." + style.end) + + with open(predator_root_directory + "/install.json", 'w') as file: json.dump(install_data, file) del install_data