From 2f8e9d9ca12d2951f541100018e8aa1a88ca6a25 Mon Sep 17 00:00:00 2001 From: bobokun Date: Tue, 16 Sep 2025 22:18:49 -0400 Subject: [PATCH] feat(webhooks): add validation mode support and enhance start notifications Add a validation_mode flag to prevent sending start webhooks during config validation. Enhance webhook payload with enabled commands and execution options for better notification details. --- VERSION | 2 +- modules/web_api.py | 1 + modules/webhooks.py | 27 ++++++++++++++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index d1fc29e..640adc6 100755 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.6.3-develop14 +4.6.3-develop15 diff --git a/modules/web_api.py b/modules/web_api.py index c7b14b2..a38815f 100755 --- a/modules/web_api.py +++ b/modules/web_api.py @@ -901,6 +901,7 @@ class WebAPI: temp_args = self.args.copy() temp_args["config_file"] = temp_config_path.name # Use temp file name temp_args["_from_web_api"] = True + temp_args["validation_mode"] = True # Flag to indicate this is validation, not a real run temp_args["time"] = now.strftime("%H:%M") temp_args["time_obj"] = now temp_args["run"] = True diff --git a/modules/webhooks.py b/modules/webhooks.py index 14a75eb..25d1879 100755 --- a/modules/webhooks.py +++ b/modules/webhooks.py @@ -100,12 +100,35 @@ class Webhooks: def start_time_hooks(self, start_time): """Send a webhook to notify that the run has started.""" - if self.run_start_webhooks: + # Skip sending start notifications during config validation + if self.run_start_webhooks and not self.config.args.get("validation_mode", False): dry_run = self.config.commands["dry_run"] if dry_run: start_type = "Dry-" else: start_type = "" + + # Get enabled commands + enabled_commands = [ + cmd + for cmd in [ + "recheck", + "cat_update", + "tag_update", + "rem_unregistered", + "tag_tracker_error", + "rem_orphaned", + "tag_nohardlinks", + "share_limits", + ] + if self.config.commands.get(cmd, False) + ] + + # Get execution options + execution_options = [ + opt for opt in ["skip_cleanup", "dry_run", "skip_qb_version_check"] if self.config.commands.get(opt, False) + ] + self._request( self.run_start_webhooks, { @@ -115,6 +138,8 @@ class Webhooks: "start_time": start_time.strftime("%Y-%m-%d %H:%M:%S"), "dry_run": self.config.commands["dry_run"], "web_api_used": self.web_api_used, + "commands": enabled_commands, + "execution_options": execution_options, }, )