update: protocol match rule

This commit is contained in:
v2board 2023-03-08 02:31:46 +08:00
commit 4c06c0cd51
4 changed files with 11 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class ClientController extends Controller
$servers = $serverService->getAvailableServers($user); $servers = $serverService->getAvailableServers($user);
$this->setSubscribeInfoToServers($servers, $user); $this->setSubscribeInfoToServers($servers, $user);
if ($flag) { if ($flag) {
foreach (glob(app_path('Http//Controllers//Client//Protocols') . '/*.php') as $file) { foreach (array_reverse(glob(app_path('Http//Controllers//Client//Protocols') . '/*.php')) as $file) {
$file = 'App\\Http\\Controllers\\Client\\Protocols\\' . basename($file, '.php'); $file = 'App\\Http\\Controllers\\Client\\Protocols\\' . basename($file, '.php');
$class = new $file($user, $servers); $class = new $file($user, $servers);
if (strpos($flag, $class->flag) !== false) { if (strpos($flag, $class->flag) !== false) {

View File

@ -78,6 +78,10 @@ class Clash
if ($isFilter) continue; if ($isFilter) continue;
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies); $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 // Force the current subscription domain to be a direct rule
$subsDomain = $_SERVER['HTTP_HOST']; $subsDomain = $_SERVER['HTTP_HOST'];
if ($subsDomain) { if ($subsDomain) {

View File

@ -68,6 +68,9 @@ class ClashMeta
if ($isFilter) continue; if ($isFilter) continue;
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies); $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 // Force the current subscription domain to be a direct rule
$subsDomain = $_SERVER['HTTP_HOST']; $subsDomain = $_SERVER['HTTP_HOST'];
if ($subsDomain) { if ($subsDomain) {

View File

@ -75,6 +75,9 @@ class Stash
if ($isFilter) continue; if ($isFilter) continue;
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies); $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 // Force the current subscription domain to be a direct rule
$subsDomain = $_SERVER['HTTP_HOST']; $subsDomain = $_SERVER['HTTP_HOST'];
if ($subsDomain) { if ($subsDomain) {