feat(admin): Add subscription template configuration and fix minor issues

This commit is contained in:
xboard
2025-02-16 18:05:03 +08:00
parent 30a140f2d8
commit 8098cf3ee2
14 changed files with 682 additions and 499 deletions

View File

@@ -39,6 +39,12 @@ class SingBox implements ProtocolInterface
protected function loadConfig()
{
// 优先从 admin_setting 获取模板
$template = admin_setting('subscribe_template_singbox');
if (!empty($template)) {
return is_array($template) ? $template : json_decode($template, true);
}
$defaultConfig = base_path('resources/rules/default.sing-box.json');
$customConfig = base_path('resources/rules/custom.sing-box.json');
$jsonData = file_exists($customConfig) ? file_get_contents($customConfig) : file_get_contents($defaultConfig);