From d5a236943ba76cd2c8a0ed2566b11a89a7729ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A2?= <2711452309@qq.com> Date: Sat, 13 Jun 2026 00:52:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=98=B2=E7=81=AB=E5=A2=99?= =?UTF-8?q?=E8=87=B3=E4=B8=8D=E6=94=AF=E6=8C=81=E7=9A=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=20=E7=AD=89=E5=BE=85Claude=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mofang/clicd.php | 8 + Mofang/templates/firewall.html | 1122 +++++++++++++++++++++----------- 2 files changed, 737 insertions(+), 393 deletions(-) diff --git a/Mofang/clicd.php b/Mofang/clicd.php index d7c313a..7c0282a 100644 --- a/Mofang/clicd.php +++ b/Mofang/clicd.php @@ -1445,6 +1445,7 @@ function clicd_firewallUpdate($params) $input = clicd_json_input(); $enabled = clicd_param_value($input, 'enabled', 'true'); $enabled = filter_var($enabled, FILTER_VALIDATE_BOOLEAN); + $defaultAction = strtoupper(trim((string)clicd_param_value($input, 'default_action', ''))); $rules = clicd_param_value($input, 'rules', '[]'); if (is_string($rules)) { @@ -1461,6 +1462,9 @@ function clicd_firewallUpdate($params) 'enabled' => $enabled, 'rules' => $rules, ]; + if (in_array($defaultAction, ['ACCEPT', 'DROP'], true)) { + $payload['default_action'] = $defaultAction; + } $container = []; $containerId = clicd_container_api_id($params, $container); @@ -1526,6 +1530,7 @@ function clicd_firewall_ajax($params) // update $enabled = clicd_param_value($input, 'enabled', 'true'); $enabled = filter_var($enabled, FILTER_VALIDATE_BOOLEAN); + $defaultAction = strtoupper(trim((string)clicd_param_value($input, 'default_action', ''))); $rules = clicd_param_value($input, 'rules', '[]'); if (is_string($rules)) { @@ -1542,6 +1547,9 @@ function clicd_firewall_ajax($params) 'enabled' => $enabled, 'rules' => $rules, ]; + if (in_array($defaultAction, ['ACCEPT', 'DROP'], true)) { + $payload['default_action'] = $defaultAction; + } $call = clicd_request_debug($params, '/api/v1/containers/' . rawurlencode($containerId) . '/firewall', $payload, 'PUT', 30); $debug[] = $call['debug']; diff --git a/Mofang/templates/firewall.html b/Mofang/templates/firewall.html index 4ca45e4..29c0ae5 100644 --- a/Mofang/templates/firewall.html +++ b/Mofang/templates/firewall.html @@ -1,52 +1,370 @@