This commit is contained in:
root 2019-10-26 18:54:38 +08:00
parent 1bb88780b5
commit 8bf727055b
3 changed files with 5 additions and 4 deletions

View File

@ -31,7 +31,7 @@ class ServerController extends Controller
$server->name = $request->input('name'); $server->name = $request->input('name');
$server->host = $request->input('host'); $server->host = $request->input('host');
$server->port = $request->input('port'); $server->port = $request->input('port');
$server->local_port = $request->input('local_port'); $server->server_port = $request->input('server_port');
$server->tls = $request->input('tls'); $server->tls = $request->input('tls');
$server->tags = json_encode($request->input('tags')); $server->tags = json_encode($request->input('tags'));
$server->rate = $request->input('rate'); $server->rate = $request->input('rate');

View File

@ -89,9 +89,10 @@ class DeepbworkController extends Controller
// 后端获取配置 // 后端获取配置
public function config (Request $request) { public function config (Request $request) {
$nodeId = $request->input('node_id'); $nodeId = $request->input('node_id');
$localPort = $request->input('local_port');
$server = Server::find($nodeId); $server = Server::find($nodeId);
$jsonData = json_decode(self::SERVER_CONFIG); $jsonData = json_decode(self::SERVER_CONFIG);
$jsonData->inboundDetour[0]->port = (int)$server->local_port; $jsonData->inboundDetour[0]->port = (int)$localPort;
$jsonData->inbound->port = (int)$server->port; $jsonData->inbound->port = (int)$server->port;
if ((int)$server->tls) { if ((int)$server->tls) {
$jsonData->inbound->streamSettings->security = "tls"; $jsonData->inbound->streamSettings->security = "tls";

View File

@ -18,7 +18,7 @@ class ServerSave extends FormRequest
'group_id' => 'required|array', 'group_id' => 'required|array',
'host' => 'required', 'host' => 'required',
'port' => 'required', 'port' => 'required',
'local_port' => 'required', 'server_port' => 'required',
'tls' => 'required', 'tls' => 'required',
'tags' => 'array', 'tags' => 'array',
'rate' => 'required|numeric' 'rate' => 'required|numeric'
@ -33,7 +33,7 @@ class ServerSave extends FormRequest
'group_id.array' => '权限组格式不正确', 'group_id.array' => '权限组格式不正确',
'host.required' => '节点地址不能为空', 'host.required' => '节点地址不能为空',
'port.required' => '连接端口不能为空', 'port.required' => '连接端口不能为空',
'local_port.required' => '后端服务端口不能为空', 'server_port.required' => '后端服务端口不能为空',
'tls.required' => 'TLS不能为空', 'tls.required' => 'TLS不能为空',
'tags.array' => '标签格式不正确', 'tags.array' => '标签格式不正确',
'rate.required' => '倍率不能为空', 'rate.required' => '倍率不能为空',