mirror of
https://github.com/v2board/v2board.git
synced 2024-11-14 07:29:13 +08:00
feature: add vmess global rules
This commit is contained in:
parent
1b4d03044d
commit
1cf0ccb865
@ -108,7 +108,9 @@ class ConfigController extends Controller
|
|||||||
'server' => [
|
'server' => [
|
||||||
'server_token' => config('v2board.server_token'),
|
'server_token' => config('v2board.server_token'),
|
||||||
'server_license' => config('v2board.server_license'),
|
'server_license' => config('v2board.server_license'),
|
||||||
'server_log_level' => config('v2board.server_log_level', 'none')
|
'server_log_enable' => config('v2board.server_log_enable', 0),
|
||||||
|
'server_v2ray_domain' => config('v2board.server_v2ray_domain'),
|
||||||
|
'server_v2ray_protocol' => config('v2board.server_v2ray_protocol'),
|
||||||
],
|
],
|
||||||
'tutorial' => [
|
'tutorial' => [
|
||||||
'apple_id' => config('v2board.apple_id')
|
'apple_id' => config('v2board.apple_id')
|
||||||
|
@ -42,7 +42,9 @@ class ConfigSave extends FormRequest
|
|||||||
// server
|
// server
|
||||||
'server_token' => 'nullable|min:16',
|
'server_token' => 'nullable|min:16',
|
||||||
'server_license' => 'nullable',
|
'server_license' => 'nullable',
|
||||||
'server_log_level' => 'nullable|in:debug,info,warning,error,none',
|
'server_log_enable' => 'in:0,1',
|
||||||
|
'server_v2ray_domain' => '',
|
||||||
|
'server_v2ray_protocol' => '',
|
||||||
// alipay
|
// alipay
|
||||||
'alipay_enable' => 'in:0,1',
|
'alipay_enable' => 'in:0,1',
|
||||||
'alipay_appid' => 'nullable|integer|min:16',
|
'alipay_appid' => 'nullable|integer|min:16',
|
||||||
|
@ -171,31 +171,39 @@ class ServerService
|
|||||||
|
|
||||||
private function setRule(Server $server, object $json)
|
private function setRule(Server $server, object $json)
|
||||||
{
|
{
|
||||||
|
$domainRules = array_filter(explode(PHP_EOL, config('v2board.server_v2ray_domain')));
|
||||||
|
$protocolRules = array_filter(explode(PHP_EOL, config('v2board.server_v2ray_protocol')));
|
||||||
if ($server->ruleSettings) {
|
if ($server->ruleSettings) {
|
||||||
$rules = json_decode($server->ruleSettings);
|
$ruleSettings = json_decode($server->ruleSettings);
|
||||||
// domain
|
// domain
|
||||||
if (isset($rules->domain)) {
|
if (isset($ruleSettings->domain)) {
|
||||||
$rules->domain = array_filter($rules->domain);
|
$ruleSettings->domain = array_filter($ruleSettings->domain);
|
||||||
if (!empty($rules->domain)) {
|
if (!empty($ruleSettings->domain)) {
|
||||||
$domainObj = new \StdClass();
|
$domainRules = array_merge($domainRules, $ruleSettings->domain);
|
||||||
$domainObj->type = 'field';
|
|
||||||
$domainObj->domain = $rules->domain;
|
|
||||||
$domainObj->outboundTag = 'block';
|
|
||||||
array_push($json->routing->rules, $domainObj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// protocol
|
// protocol
|
||||||
if (isset($rules->protocol)) {
|
if (isset($ruleSettings->protocol)) {
|
||||||
$rules->protocol = array_filter($rules->protocol);
|
$ruleSettings->protocol = array_filter($ruleSettings->protocol);
|
||||||
if (!empty($rules->protocol)) {
|
if (!empty($ruleSettings->protocol)) {
|
||||||
$protocolObj = new \StdClass();
|
$protocolRules = array_merge($protocolRules, $ruleSettings->protocol);
|
||||||
$protocolObj->type = 'field';
|
|
||||||
$protocolObj->protocol = $rules->protocol;
|
|
||||||
$protocolObj->outboundTag = 'block';
|
|
||||||
array_push($json->routing->rules, $protocolObj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!empty($domainRules)) {
|
||||||
|
$domainObj = new \StdClass();
|
||||||
|
$domainObj->type = 'field';
|
||||||
|
$domainObj->domain = $domainRules;
|
||||||
|
$domainObj->outboundTag = 'block';
|
||||||
|
array_push($json->routing->rules, $domainObj);
|
||||||
|
}
|
||||||
|
if (!empty($protocolRules)) {
|
||||||
|
$protocolObj = new \StdClass();
|
||||||
|
$protocolObj->type = 'field';
|
||||||
|
$protocolObj->protocol = $protocolRules;
|
||||||
|
$protocolObj->outboundTag = 'block';
|
||||||
|
array_push($json->routing->rules, $protocolObj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setTls(Server $server, object $json)
|
private function setTls(Server $server, object $json)
|
||||||
|
2
public/assets/admin/umi.css
vendored
2
public/assets/admin/umi.css
vendored
File diff suppressed because one or more lines are too long
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user