update: custom v2ray alter id

This commit is contained in:
Tokumeikoi 2020-11-17 21:23:16 +08:00
parent ad98651f93
commit fb9465b5a6
7 changed files with 16 additions and 13 deletions

View File

@ -87,7 +87,7 @@ class AppController extends Controller
$json->outbound->settings->vnext[0]->address = (string)$server->host; $json->outbound->settings->vnext[0]->address = (string)$server->host;
$json->outbound->settings->vnext[0]->port = (int)$server->port; $json->outbound->settings->vnext[0]->port = (int)$server->port;
$json->outbound->settings->vnext[0]->users[0]->id = (string)$user->uuid; $json->outbound->settings->vnext[0]->users[0]->id = (string)$user->uuid;
$json->outbound->settings->vnext[0]->users[0]->alterId = (int)$user->v2ray_alter_id; $json->outbound->settings->vnext[0]->users[0]->alterId = (int)$server->alter_id;
$json->outbound->settings->vnext[0]->remark = (string)$server->name; $json->outbound->settings->vnext[0]->remark = (string)$server->name;
$json->outbound->streamSettings->network = $server->network; $json->outbound->streamSettings->network = $server->network;
if ($server->networkSettings) { if ($server->networkSettings) {

View File

@ -47,12 +47,11 @@ class DeepbworkController extends Controller
$user->v2ray_user = [ $user->v2ray_user = [
"uuid" => $user->uuid, "uuid" => $user->uuid,
"email" => sprintf("%s@v2board.user", $user->uuid), "email" => sprintf("%s@v2board.user", $user->uuid),
"alter_id" => $user->v2ray_alter_id, "alter_id" => $server->alter_id,
"level" => $user->v2ray_level, "level" => 0,
]; ];
unset($user['uuid']); unset($user['uuid']);
unset($user['v2ray_alter_id']); unset($user['email']);
unset($user['v2ray_level']);
array_push($result, $user); array_push($result, $user);
} }
return response([ return response([

View File

@ -48,8 +48,7 @@ class TrojanTidalabController extends Controller
"password" => $user->uuid, "password" => $user->uuid,
]; ];
unset($user['uuid']); unset($user['uuid']);
unset($user['v2ray_alter_id']); unset($user['email']);
unset($user['v2ray_level']);
array_push($result, $user); array_push($result, $user);
} }
return response([ return response([

View File

@ -24,6 +24,7 @@ class ServerV2raySave extends FormRequest
'tls' => 'required', 'tls' => 'required',
'tags' => 'nullable|array', 'tags' => 'nullable|array',
'rate' => 'required|numeric', 'rate' => 'required|numeric',
'alert_id' => 'required|integer',
'network' => 'required|in:tcp,kcp,ws,http,domainsocket,quic', 'network' => 'required|in:tcp,kcp,ws,http,domainsocket,quic',
'networkSettings' => '', 'networkSettings' => '',
'ruleSettings' => '', 'ruleSettings' => '',

View File

@ -121,9 +121,7 @@ class ServerService
'u', 'u',
'd', 'd',
'transfer_enable', 'transfer_enable',
'uuid', 'uuid'
'v2ray_alter_id',
'v2ray_level'
]) ])
->get(); ->get();
} }

View File

@ -152,6 +152,7 @@ CREATE TABLE `v2_server` (
`tags` varchar(255) DEFAULT NULL, `tags` varchar(255) DEFAULT NULL,
`rate` varchar(11) NOT NULL, `rate` varchar(11) NOT NULL,
`network` text NOT NULL, `network` text NOT NULL,
`alter_id` int(11) NOT NULL DEFAULT '1',
`settings` text, `settings` text,
`rules` text, `rules` text,
`networkSettings` text, `networkSettings` text,
@ -296,8 +297,6 @@ CREATE TABLE `v2_user` (
`last_login_at` int(11) DEFAULT NULL, `last_login_at` int(11) DEFAULT NULL,
`last_login_ip` int(11) DEFAULT NULL, `last_login_ip` int(11) DEFAULT NULL,
`uuid` varchar(36) NOT NULL, `uuid` varchar(36) NOT NULL,
`v2ray_alter_id` tinyint(4) NOT NULL DEFAULT '2',
`v2ray_level` tinyint(4) NOT NULL DEFAULT '0',
`group_id` int(11) DEFAULT NULL, `group_id` int(11) DEFAULT NULL,
`plan_id` int(11) DEFAULT NULL, `plan_id` int(11) DEFAULT NULL,
`remind_expire` tinyint(4) DEFAULT '1', `remind_expire` tinyint(4) DEFAULT '1',
@ -311,4 +310,4 @@ CREATE TABLE `v2_user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 2020-11-17 08:48:00 -- 2020-11-17 10:46:49

View File

@ -345,3 +345,10 @@ ADD `coupon_id` int(11) NULL AFTER `plan_id`;
ALTER TABLE `v2_server_stat` ALTER TABLE `v2_server_stat`
ADD `method` varchar(255) NOT NULL AFTER `server_id`; ADD `method` varchar(255) NOT NULL AFTER `server_id`;
ALTER TABLE `v2_server`
ADD `alter_id` int(11) NOT NULL DEFAULT '1' AFTER `network`;
ALTER TABLE `v2_user`
DROP `v2ray_alter_id`,
DROP `v2ray_level`;