fix server rules maybe not defined

This commit is contained in:
Tokumeikoi 2020-02-16 16:51:25 +08:00
parent 557f6bc0c2
commit 0446e7d99f
2 changed files with 15 additions and 14 deletions

View File

@ -146,20 +146,21 @@ class DeepbworkController extends Controller
if ($server->rules) { if ($server->rules) {
$rules = json_decode($server->rules); $rules = json_decode($server->rules);
// domain // domain
if (isset($rules->domain)) {
$domainObj = new \StdClass(); $domainObj = new \StdClass();
$domainObj->type = 'field'; $domainObj->type = 'field';
$domainObj->domain = $rules->domain; $domainObj->domain = $rules->domain;
$domainObj->outboundTag = 'block'; $domainObj->outboundTag = 'block';
array_push($json->routing->settings->rules, $domainObj);
}
// protocol // protocol
if (isset($rules->protocol)) {
$protocolObj = new \StdClass(); $protocolObj = new \StdClass();
$protocolObj->type = 'field'; $protocolObj->type = 'field';
$protocolObj->protocol = $rules->protocol; $protocolObj->protocol = $rules->protocol;
$protocolObj->outboundTag = 'block'; $protocolObj->outboundTag = 'block';
array_push( array_push($json->routing->settings->rules, $protocolObj);
$json->routing->settings->rules, }
$domainObj,
$protocolObj
);
} }
if ((int)$server->tls) { if ((int)$server->tls) {

File diff suppressed because one or more lines are too long