mirror of
https://github.com/v2board/v2board.git
synced 2025-01-10 16:19:10 +08:00
update
This commit is contained in:
parent
3df4e04605
commit
9b82df98f5
@ -114,7 +114,7 @@ class V2boardInstall extends Command
|
|||||||
abort(500, '管理员密码长度最小为8位字符');
|
abort(500, '管理员密码长度最小为8位字符');
|
||||||
}
|
}
|
||||||
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
||||||
$user->v2ray_uuid = Helper::guid(true);
|
$user->uuid = Helper::guid(true);
|
||||||
$user->token = Helper::guid();
|
$user->token = Helper::guid();
|
||||||
$user->is_admin = 1;
|
$user->is_admin = 1;
|
||||||
return $user->save();
|
return $user->save();
|
||||||
|
@ -74,7 +74,7 @@ class AppController extends Controller
|
|||||||
//other
|
//other
|
||||||
$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->v2ray_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)$user->v2ray_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;
|
||||||
|
@ -52,7 +52,7 @@ class ClientController extends Controller
|
|||||||
{
|
{
|
||||||
$uri = '';
|
$uri = '';
|
||||||
foreach ($server as $item) {
|
foreach ($server as $item) {
|
||||||
$uri .= "vmess=" . $item->host . ":" . $item->port . ", method=none, password=" . $user->v2ray_uuid . ", fast-open=false, udp-relay=false, tag=" . $item->name;
|
$uri .= "vmess=" . $item->host . ":" . $item->port . ", method=none, password=" . $user->uuid . ", fast-open=false, udp-relay=false, tag=" . $item->name;
|
||||||
if ($item->tls) {
|
if ($item->tls) {
|
||||||
$tlsSettings = json_decode($item->tlsSettings);
|
$tlsSettings = json_decode($item->tlsSettings);
|
||||||
if ($item->network === 'tcp') $uri .= ', obfs=over-tls';
|
if ($item->network === 'tcp') $uri .= ', obfs=over-tls';
|
||||||
@ -83,7 +83,7 @@ class ClientController extends Controller
|
|||||||
header('subscription-userinfo: upload=' . $user->u . '; download=' . $user->d . ';total=' . $user->transfer_enable);
|
header('subscription-userinfo: upload=' . $user->u . '; download=' . $user->d . ';total=' . $user->transfer_enable);
|
||||||
foreach ($server as $item) {
|
foreach ($server as $item) {
|
||||||
$str = '';
|
$str = '';
|
||||||
$str .= $item->name . '= vmess, ' . $item->host . ', ' . $item->port . ', chacha20-ietf-poly1305, "' . $user->v2ray_uuid . '", over-tls=' . ($item->tls ? "true" : "false") . ', certificate=0, group=' . config('v2board.app_name', 'V2Board');
|
$str .= $item->name . '= vmess, ' . $item->host . ', ' . $item->port . ', chacha20-ietf-poly1305, "' . $user->uuid . '", over-tls=' . ($item->tls ? "true" : "false") . ', certificate=0, group=' . config('v2board.app_name', 'V2Board');
|
||||||
if ($item->network === 'ws') {
|
if ($item->network === 'ws') {
|
||||||
$str .= ', obfs=ws';
|
$str .= ', obfs=ws';
|
||||||
if ($item->networkSettings) {
|
if ($item->networkSettings) {
|
||||||
@ -112,7 +112,7 @@ class ClientController extends Controller
|
|||||||
$proxyGroup = '';
|
$proxyGroup = '';
|
||||||
foreach ($server as $item) {
|
foreach ($server as $item) {
|
||||||
// [Proxy]
|
// [Proxy]
|
||||||
$proxies .= $item->name . ' = vmess, ' . $item->host . ', ' . $item->port . ', username=' . $user->v2ray_uuid . ', tfo=true';
|
$proxies .= $item->name . ' = vmess, ' . $item->host . ', ' . $item->port . ', username=' . $user->uuid . ', tfo=true';
|
||||||
if ($item->tls) {
|
if ($item->tls) {
|
||||||
$tlsSettings = json_decode($item->tlsSettings);
|
$tlsSettings = json_decode($item->tlsSettings);
|
||||||
$proxies .= ', tls=' . ($item->tls ? "true" : "false");
|
$proxies .= ', tls=' . ($item->tls ? "true" : "false");
|
||||||
@ -165,7 +165,7 @@ class ClientController extends Controller
|
|||||||
$proxyGroup = '';
|
$proxyGroup = '';
|
||||||
foreach ($server as $item) {
|
foreach ($server as $item) {
|
||||||
// [Proxy]
|
// [Proxy]
|
||||||
$proxies .= $item->name . ' = vmess, ' . $item->host . ', ' . $item->port . ', username=' . $user->v2ray_uuid;
|
$proxies .= $item->name . ' = vmess, ' . $item->host . ', ' . $item->port . ', username=' . $user->uuid;
|
||||||
if ($item->tls) {
|
if ($item->tls) {
|
||||||
$tlsSettings = json_decode($item->tlsSettings);
|
$tlsSettings = json_decode($item->tlsSettings);
|
||||||
$proxies .= ', tls=' . ($item->tls ? "true" : "false");
|
$proxies .= ', tls=' . ($item->tls ? "true" : "false");
|
||||||
@ -229,7 +229,7 @@ class ClientController extends Controller
|
|||||||
$array['type'] = 'vmess';
|
$array['type'] = 'vmess';
|
||||||
$array['server'] = $item->host;
|
$array['server'] = $item->host;
|
||||||
$array['port'] = $item->port;
|
$array['port'] = $item->port;
|
||||||
$array['uuid'] = $user->v2ray_uuid;
|
$array['uuid'] = $user->uuid;
|
||||||
$array['alterId'] = $user->v2ray_alter_id;
|
$array['alterId'] = $user->v2ray_alter_id;
|
||||||
$array['cipher'] = 'auto';
|
$array['cipher'] = 'auto';
|
||||||
if ($item->tls) {
|
if ($item->tls) {
|
||||||
|
@ -58,7 +58,7 @@ class AuthController extends Controller
|
|||||||
$user = new User();
|
$user = new User();
|
||||||
$user->email = $email;
|
$user->email = $email;
|
||||||
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
||||||
$user->v2ray_uuid = Helper::guid(true);
|
$user->uuid = Helper::guid(true);
|
||||||
$user->token = Helper::guid();
|
$user->token = Helper::guid();
|
||||||
if ($request->input('invite_code')) {
|
if ($request->input('invite_code')) {
|
||||||
$inviteCode = InviteCode::where('code', $request->input('invite_code'))
|
$inviteCode = InviteCode::where('code', $request->input('invite_code'))
|
||||||
|
@ -43,12 +43,12 @@ class DeepbworkController extends Controller
|
|||||||
$result = [];
|
$result = [];
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$user->v2ray_user = [
|
$user->v2ray_user = [
|
||||||
"uuid" => $user->v2ray_uuid,
|
"uuid" => $user->uuid,
|
||||||
"email" => sprintf("%s@v2board.user", $user->v2ray_uuid),
|
"email" => sprintf("%s@v2board.user", $user->uuid),
|
||||||
"alter_id" => $user->v2ray_alter_id,
|
"alter_id" => $user->v2ray_alter_id,
|
||||||
"level" => $user->v2ray_level,
|
"level" => $user->v2ray_level,
|
||||||
];
|
];
|
||||||
unset($user['v2ray_uuid']);
|
unset($user['uuid']);
|
||||||
unset($user['v2ray_alter_id']);
|
unset($user['v2ray_alter_id']);
|
||||||
unset($user['v2ray_level']);
|
unset($user['v2ray_level']);
|
||||||
array_push($result, $user);
|
array_push($result, $user);
|
||||||
|
@ -41,12 +41,12 @@ class PoseidonController extends Controller
|
|||||||
$result = [];
|
$result = [];
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$user->v2ray_user = [
|
$user->v2ray_user = [
|
||||||
"uuid" => $user->v2ray_uuid,
|
"uuid" => $user->uuid,
|
||||||
"email" => sprintf("%s@v2board.user", $user->v2ray_uuid),
|
"email" => sprintf("%s@v2board.user", $user->uuid),
|
||||||
"alter_id" => $user->v2ray_alter_id,
|
"alter_id" => $user->v2ray_alter_id,
|
||||||
"level" => $user->v2ray_level,
|
"level" => $user->v2ray_level,
|
||||||
];
|
];
|
||||||
unset($user['v2ray_uuid']);
|
unset($user['uuid']);
|
||||||
unset($user['v2ray_alter_id']);
|
unset($user['v2ray_alter_id']);
|
||||||
unset($user['v2ray_level']);
|
unset($user['v2ray_level']);
|
||||||
array_push($result, $user);
|
array_push($result, $user);
|
||||||
|
@ -107,7 +107,7 @@ class UserController extends Controller
|
|||||||
public function resetSecurity(Request $request)
|
public function resetSecurity(Request $request)
|
||||||
{
|
{
|
||||||
$user = User::find($request->session()->get('id'));
|
$user = User::find($request->session()->get('id'));
|
||||||
$user->v2ray_uuid = Helper::guid(true);
|
$user->uuid = Helper::guid(true);
|
||||||
$user->token = Helper::guid();
|
$user->token = Helper::guid();
|
||||||
if (!$user->save()) {
|
if (!$user->save()) {
|
||||||
abort(500, '重置失败');
|
abort(500, '重置失败');
|
||||||
|
@ -27,7 +27,7 @@ class ServerService
|
|||||||
'u',
|
'u',
|
||||||
'd',
|
'd',
|
||||||
'transfer_enable',
|
'transfer_enable',
|
||||||
'v2ray_uuid',
|
'uuid',
|
||||||
'v2ray_alter_id',
|
'v2ray_alter_id',
|
||||||
'v2ray_level'
|
'v2ray_level'
|
||||||
])
|
])
|
||||||
|
@ -63,7 +63,7 @@ class Helper
|
|||||||
"ps" => $server->name,
|
"ps" => $server->name,
|
||||||
"add" => $server->host,
|
"add" => $server->host,
|
||||||
"port" => $server->port,
|
"port" => $server->port,
|
||||||
"id" => $user->v2ray_uuid,
|
"id" => $user->uuid,
|
||||||
"aid" => "2",
|
"aid" => "2",
|
||||||
"net" => $server->network,
|
"net" => $server->network,
|
||||||
"type" => "none",
|
"type" => "none",
|
||||||
|
@ -179,12 +179,27 @@ CREATE TABLE `v2_server_stat` (
|
|||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(11) NOT NULL,
|
||||||
`u` varchar(255) NOT NULL,
|
`u` varchar(255) NOT NULL,
|
||||||
`d` varchar(255) NOT NULL,
|
`d` varchar(255) NOT NULL,
|
||||||
`online` int(11) NOT NULL,
|
|
||||||
`created_at` int(11) NOT NULL,
|
`created_at` int(11) NOT NULL,
|
||||||
`updated_at` int(11) NOT NULL,
|
`updated_at` int(11) NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `created_at` (`created_at`)
|
KEY `created_at` (`created_at`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `v2_server_trojan`;
|
||||||
|
CREATE TABLE `v2_server_trojan` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`group_id` varchar(255) NOT NULL,
|
||||||
|
`tags` varchar(255) DEFAULT NULL,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`host` varchar(255) NOT NULL,
|
||||||
|
`port` int(11) NOT NULL,
|
||||||
|
`show` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`sort` int(11) DEFAULT NULL,
|
||||||
|
`created_at` int(11) NOT NULL,
|
||||||
|
`updated_at` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='trojan伺服器表';
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `v2_ticket`;
|
DROP TABLE IF EXISTS `v2_ticket`;
|
||||||
@ -243,11 +258,12 @@ CREATE TABLE `v2_user` (
|
|||||||
`u` bigint(20) NOT NULL DEFAULT '0',
|
`u` bigint(20) NOT NULL DEFAULT '0',
|
||||||
`d` bigint(20) NOT NULL DEFAULT '0',
|
`d` bigint(20) NOT NULL DEFAULT '0',
|
||||||
`transfer_enable` bigint(20) NOT NULL DEFAULT '0',
|
`transfer_enable` bigint(20) NOT NULL DEFAULT '0',
|
||||||
|
`enable` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
`banned` tinyint(1) NOT NULL DEFAULT '0',
|
`banned` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`is_admin` tinyint(1) NOT NULL DEFAULT '0',
|
`is_admin` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`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,
|
||||||
`v2ray_uuid` varchar(36) NOT NULL,
|
`uuid` varchar(36) NOT NULL,
|
||||||
`v2ray_alter_id` tinyint(4) NOT NULL DEFAULT '2',
|
`v2ray_alter_id` tinyint(4) NOT NULL DEFAULT '2',
|
||||||
`v2ray_level` tinyint(4) NOT NULL DEFAULT '0',
|
`v2ray_level` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
`group_id` int(11) DEFAULT NULL,
|
`group_id` int(11) DEFAULT NULL,
|
||||||
@ -263,4 +279,4 @@ CREATE TABLE `v2_user` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
-- 2020-06-04 15:23:25
|
-- 2020-06-07 17:06:55
|
||||||
|
@ -262,3 +262,23 @@ ADD `online` int(11) NOT NULL AFTER `d`;
|
|||||||
|
|
||||||
ALTER TABLE `v2_server_stat`
|
ALTER TABLE `v2_server_stat`
|
||||||
ADD INDEX `created_at` (`created_at`);
|
ADD INDEX `created_at` (`created_at`);
|
||||||
|
|
||||||
|
CREATE TABLE `v2_server_trojan` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`group_id` varchar(255) NOT NULL,
|
||||||
|
`tags` varchar(255) NULL,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`host` varchar(255) NOT NULL,
|
||||||
|
`port` int(11) NOT NULL,
|
||||||
|
`show` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`sort` int(11) NULL,
|
||||||
|
`created_at` int(11) NOT NULL,
|
||||||
|
`updated_at` int(11) NOT NULL
|
||||||
|
) COMMENT='trojan伺服器表' COLLATE 'utf8mb4_general_ci';
|
||||||
|
|
||||||
|
ALTER TABLE `v2_server_stat`
|
||||||
|
CHANGE `d` `d` varchar(255) COLLATE 'utf8_general_ci' NOT NULL AFTER `u`,
|
||||||
|
DROP `online`;
|
||||||
|
|
||||||
|
ALTER TABLE `v2_user`
|
||||||
|
CHANGE `v2ray_uuid` `uuid` varchar(36) COLLATE 'utf8_general_ci' NOT NULL AFTER `last_login_ip`;
|
||||||
|
@ -23,6 +23,9 @@ class PayTaro
|
|||||||
$curl = new Curl();
|
$curl = new Curl();
|
||||||
$curl->post('https://api.paytaro.com/v1/gateway/fetch', http_build_query($params));
|
$curl->post('https://api.paytaro.com/v1/gateway/fetch', http_build_query($params));
|
||||||
$result = $curl->response;
|
$result = $curl->response;
|
||||||
|
if (!$result) {
|
||||||
|
abort(500, '网络异常');
|
||||||
|
}
|
||||||
if ($curl->error) {
|
if ($curl->error) {
|
||||||
$errors = (array)$result->errors;
|
$errors = (array)$result->errors;
|
||||||
abort(500, $errors[array_keys($errors)[0]][0]);
|
abort(500, $errors[array_keys($errors)[0]][0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user