feat: optimize settings management and admin functionality

- Add system log cleanup functionality with batch processing
- Optimize v2_settings table performance by unifying value storage
- Add comprehensive client support list for one-click subscription
- Fix QR code subscription links for specific node types
- Fix route addition issues in admin management panel
- Enhance admin system controller with log management APIs
This commit is contained in:
xboard
2025-06-21 12:11:27 +08:00
parent 895a870dfc
commit 272dbd2107
29 changed files with 1759 additions and 1392 deletions
+3 -2
View File
@@ -18,9 +18,10 @@ class Clash extends AbstractProtocol
$user = $this->user;
$appName = admin_setting('app_name', 'XBoard');
$template = File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
// 优先从数据库配置中获取模板
$template = admin_setting('subscribe_template_clash', File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
? File::get(base_path(self::CUSTOM_TEMPLATE_FILE))
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE));
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE)));
$config = Yaml::parse($template);
$proxy = [];
+2 -2
View File
@@ -65,13 +65,13 @@ class ClashMeta extends AbstractProtocol
$user = $this->user;
$appName = admin_setting('app_name', 'XBoard');
$template = File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
$template = admin_setting('subscribe_template_clashmeta', File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
? File::get(base_path(self::CUSTOM_TEMPLATE_FILE))
: (
File::exists(base_path(self::CUSTOM_CLASH_TEMPLATE_FILE))
? File::get(base_path(self::CUSTOM_CLASH_TEMPLATE_FILE))
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE))
);
));
$config = Yaml::parse($template);
$proxy = [];
+3 -3
View File
@@ -72,11 +72,11 @@ class SingBox extends AbstractProtocol
protected function loadConfig()
{
$jsonData = File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
$jsonData = admin_setting('subscribe_template_singbox', File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
? File::get(base_path(self::CUSTOM_TEMPLATE_FILE))
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE));
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE)));
return json_decode($jsonData, true);
return is_array($jsonData) ? $jsonData : json_decode($jsonData, true);
}
protected function buildOutbounds()
+2 -2
View File
@@ -67,13 +67,13 @@ class Stash extends AbstractProtocol
$user = $this->user;
$appName = admin_setting('app_name', 'XBoard');
$template = File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
$template = admin_setting('subscribe_template_stash', File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
? File::get(base_path(self::CUSTOM_TEMPLATE_FILE))
: (
File::exists(base_path(self::CUSTOM_CLASH_TEMPLATE_FILE))
? File::get(base_path(self::CUSTOM_CLASH_TEMPLATE_FILE))
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE))
);
));
$config = Yaml::parse($template);
$proxy = [];
+2 -2
View File
@@ -52,9 +52,9 @@ class Surfboard extends AbstractProtocol
}
}
$config = File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
$config = admin_setting('subscribe_template_surfboard', File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
? File::get(base_path(self::CUSTOM_TEMPLATE_FILE))
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE));
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE)));
// Subscription link
$subsURL = Helper::getSubscribeUrl($user['token']);
$subsDomain = request()->header('Host');
+9 -3
View File
@@ -60,9 +60,9 @@ class Surge extends AbstractProtocol
}
$config = File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
$config = admin_setting('subscribe_template_surge', File::exists(base_path(self::CUSTOM_TEMPLATE_FILE))
? File::get(base_path(self::CUSTOM_TEMPLATE_FILE))
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE));
: File::get(base_path(self::DEFAULT_TEMPLATE_FILE)));
// Subscription link
$subsDomain = request()->header('Host');
@@ -83,6 +83,7 @@ class Surge extends AbstractProtocol
$config = str_replace('$subscribe_info', $subscribeInfo, $config);
return response($config, 200)
->header('content-type', 'application/octet-stream')
->header('content-disposition', "attachment;filename*=UTF-8''" . rawurlencode($appName) . ".conf");
}
@@ -202,11 +203,16 @@ class Surge extends AbstractProtocol
"{$server['host']}",
"{$server['port']}",
"password={$password}",
"download-bandwidth={$protocol_settings['bandwidth']['up']}",
$protocol_settings['tls']['server_name'] ? "sni={$protocol_settings['tls']['server_name']}" : "",
// 'tfo=true',
'udp-relay=true'
];
if (data_get($protocol_settings, 'bandwidth.up')) {
$config[] = "upload-bandwidth={$protocol_settings['bandwidth']['up']}";
}
if (data_get($protocol_settings, 'bandwidth.down')) {
$config[] = "download-bandwidth={$protocol_settings['bandwidth']['down']}";
}
if (data_get($protocol_settings, 'tls.allow_insecure')) {
$config[] = !!data_get($protocol_settings, 'tls.allow_insecure') ? 'skip-cert-verify=true' : 'skip-cert-verify=false';
}