From e745c2a5be6bc6eb92403f4f984fc9379ddfdcd5 Mon Sep 17 00:00:00 2001 From: v2board Date: Wed, 8 Mar 2023 02:26:10 +0800 Subject: [PATCH 1/2] update: clash remove proxies empty group --- app/Http/Controllers/Client/Protocols/Clash.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/Client/Protocols/Clash.php b/app/Http/Controllers/Client/Protocols/Clash.php index 03446b12..cd245c04 100644 --- a/app/Http/Controllers/Client/Protocols/Clash.php +++ b/app/Http/Controllers/Client/Protocols/Clash.php @@ -78,6 +78,10 @@ class Clash if ($isFilter) continue; $config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies); } + + $config['proxy-groups'] = array_filter($config['proxy-groups'], function($group) { + return $group['proxies']; + }); // Force the current subscription domain to be a direct rule $subsDomain = $_SERVER['HTTP_HOST']; if ($subsDomain) { From feb673cab3119896087bb44713acf87173e32629 Mon Sep 17 00:00:00 2001 From: v2board Date: Wed, 8 Mar 2023 02:26:33 +0800 Subject: [PATCH 2/2] update: clash remove proxies empty group --- app/Http/Controllers/Client/Protocols/ClashMeta.php | 3 +++ app/Http/Controllers/Client/Protocols/Stash.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/Http/Controllers/Client/Protocols/ClashMeta.php b/app/Http/Controllers/Client/Protocols/ClashMeta.php index e9e2ca7a..5de88301 100644 --- a/app/Http/Controllers/Client/Protocols/ClashMeta.php +++ b/app/Http/Controllers/Client/Protocols/ClashMeta.php @@ -68,6 +68,9 @@ class ClashMeta if ($isFilter) continue; $config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies); } + $config['proxy-groups'] = array_filter($config['proxy-groups'], function($group) { + return $group['proxies']; + }); // Force the current subscription domain to be a direct rule $subsDomain = $_SERVER['HTTP_HOST']; if ($subsDomain) { diff --git a/app/Http/Controllers/Client/Protocols/Stash.php b/app/Http/Controllers/Client/Protocols/Stash.php index 2ac494b8..5326636e 100644 --- a/app/Http/Controllers/Client/Protocols/Stash.php +++ b/app/Http/Controllers/Client/Protocols/Stash.php @@ -75,6 +75,9 @@ class Stash if ($isFilter) continue; $config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies); } + $config['proxy-groups'] = array_filter($config['proxy-groups'], function($group) { + return $group['proxies']; + }); // Force the current subscription domain to be a direct rule $subsDomain = $_SERVER['HTTP_HOST']; if ($subsDomain) {