mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 18:48:14 -05:00
Compare commits
9 Commits
f9f1209750
...
1fb4406d15
Author | SHA1 | Date | |
---|---|---|---|
|
1fb4406d15 | ||
|
3a05281a9f | ||
|
74d93691b9 | ||
|
d743296392 | ||
|
024a9dfb54 | ||
|
a550fd1436 | ||
|
43bac89d3a | ||
|
e2262f1435 | ||
|
c8baf937dc |
@ -51,15 +51,16 @@ class MigrateFromV2b extends Command
|
|||||||
],
|
],
|
||||||
'1.7.3' => [
|
'1.7.3' => [
|
||||||
'ALTER TABLE `v2_stat_order` RENAME TO `v2_stat`;',
|
'ALTER TABLE `v2_stat_order` RENAME TO `v2_stat`;',
|
||||||
"ALTER TABLE `v2_stat` CHANGE COLUMN order_amount order_total INT COMMENT '订单合计';",
|
"ALTER TABLE `v2_stat` CHANGE COLUMN order_amount paid_total INT COMMENT '订单合计';",
|
||||||
|
"ALTER TABLE `v2_stat` CHANGE COLUMN order_count paid_count INT COMMENT '邀请佣金';",
|
||||||
"ALTER TABLE `v2_stat` CHANGE COLUMN commission_amount commission_total INT COMMENT '佣金合计';",
|
"ALTER TABLE `v2_stat` CHANGE COLUMN commission_amount commission_total INT COMMENT '佣金合计';",
|
||||||
"ALTER TABLE `v2_stat`
|
"ALTER TABLE `v2_stat`
|
||||||
ADD COLUMN paid_count INT NULL,
|
ADD COLUMN order_count INT NULL,
|
||||||
ADD COLUMN paid_total INT NULL,
|
ADD COLUMN order_total INT NULL,
|
||||||
ADD COLUMN register_count INT NULL,
|
ADD COLUMN register_count INT NULL,
|
||||||
ADD COLUMN invite_count INT NULL,
|
ADD COLUMN invite_count INT NULL,
|
||||||
ADD COLUMN transfer_used_total VARCHAR(32) NULL;
|
ADD COLUMN transfer_used_total VARCHAR(32) NULL;
|
||||||
",
|
",
|
||||||
"CREATE TABLE `v2_log` (
|
"CREATE TABLE `v2_log` (
|
||||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
`title` TEXT NOT NULL,
|
`title` TEXT NOT NULL,
|
||||||
|
@ -12,11 +12,17 @@ class UnBind extends Telegram {
|
|||||||
|
|
||||||
public function handle($message, $match = []) {
|
public function handle($message, $match = []) {
|
||||||
if (!$message->is_private) return;
|
if (!$message->is_private) return;
|
||||||
$user = User::where('telegram_id', $message->chat_id)->first();
|
if (!isset($message->args[0])) {
|
||||||
$telegramService = $this->telegramService;
|
$user = User::where('telegram_id', $message->chat_id)->first();
|
||||||
if (!$user) {
|
} else {
|
||||||
$telegramService->sendMessage($message->chat_id, '没有查询到您的用户信息,请先绑定账号', 'markdown');
|
$chat = User::where('telegram_id', $message->chat_id)->first();
|
||||||
return;
|
if (!$chat) return;
|
||||||
|
if (!($chat->is_admin || $chat->is_staff)) return;
|
||||||
|
if (strpos($message->args[0], '@') !== true) {
|
||||||
|
$user = User::where('email', $message->args[0])->first();
|
||||||
|
} else {
|
||||||
|
$user = User::where('telegram_id', $message->args[0])->first();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$user->telegram_id = NULL;
|
$user->telegram_id = NULL;
|
||||||
if (!$user->save()) {
|
if (!$user->save()) {
|
||||||
|
@ -52,10 +52,16 @@ class Stash
|
|||||||
array_push($proxy, self::buildVmess($user['uuid'], $item));
|
array_push($proxy, self::buildVmess($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
}
|
}
|
||||||
// if ($item['type'] === 'vless') {
|
if ($item['type'] === 'vless') {
|
||||||
// array_push($proxy, self::buildVless($user['uuid'], $item));
|
if ($item['flow'] === 'xtls-rprx-vision') {
|
||||||
// array_push($proxies, $item['name']);
|
continue;
|
||||||
// }
|
}
|
||||||
|
if ($item['tls'] === 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
array_push($proxy, self::buildVless($user['uuid'], $item));
|
||||||
|
array_push($proxies, $item['name']);
|
||||||
|
}
|
||||||
if ($item['type'] === 'hysteria') {
|
if ($item['type'] === 'hysteria') {
|
||||||
array_push($proxy, self::buildHysteria($user['uuid'], $item));
|
array_push($proxy, self::buildHysteria($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
@ -169,56 +175,50 @@ class Stash
|
|||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function buildVless($uuid, $server)
|
public static function buildVless($password, $server){
|
||||||
{
|
|
||||||
$array = [];
|
$array = [];
|
||||||
$array['name'] = $server['name'];
|
$array['name'] = $server['name'];
|
||||||
$array['type'] = 'vless';
|
$array['type'] = 'vless';
|
||||||
$array['server'] = $server['host'];
|
$array['server'] = $server['host'];
|
||||||
$array['port'] = $server['port'];
|
$array['port'] = $server['port'];
|
||||||
$array['uuid'] = $uuid;
|
$array['uuid'] = $password;
|
||||||
$array['flow'] = !empty($server['flow']) ? $server['flow']: "";
|
$array['alterId'] = 0;
|
||||||
|
$array['cipher'] = 'auto';
|
||||||
$array['udp'] = true;
|
$array['udp'] = true;
|
||||||
|
|
||||||
$fingerprints = ['chrome', 'firefox', 'safari', 'ios', 'edge', 'qq']; //随机客户端指纹
|
// XTLS流控算法
|
||||||
$array['client-fingerprint'] = $fingerprints[rand(0,count($fingerprints) - 1)];
|
if($server['flow']) ($array['flow'] = $server['flow']);
|
||||||
|
|
||||||
if ($server['tls']) {
|
if ($server['tls']) {
|
||||||
$array['tls'] = true;
|
|
||||||
switch($server['tls']){
|
switch($server['tls']){
|
||||||
case 1:
|
case 1: //开启TLS
|
||||||
|
$array['tls'] = true;
|
||||||
if ($server['tls_settings']) {
|
if ($server['tls_settings']) {
|
||||||
$tlsSettings = $server['tls_settings'];
|
$tlsSettings = $server['tls_settings'];
|
||||||
|
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
|
||||||
|
$array['skip-cert-verify'] = ($tlsSettings['allowInsecure'] ? true : false);
|
||||||
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
|
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
|
||||||
$array['servername'] = $tlsSettings['server_name'];
|
$array['servername'] = $tlsSettings['server_name'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: //开启reality
|
||||||
if (!isset($server['network_settings'])) break;
|
$array['tls'] = true;
|
||||||
$networkSettings = $server['network_settings'];
|
$tls_settings = $server['tls_settings'];
|
||||||
if (isset($networkSettings['reality-opts'])){
|
if (!empty($tls_settings['allowInsecure'])) $array['skip-cert-verify'] = (bool)$tls_settings['allowInsecure'];
|
||||||
$realitySettings = $networkSettings['reality-opts'];
|
|
||||||
$array['reality-opts'] = [];
|
if(($tls_settings['public_key'] ?? null)
|
||||||
$array['reality-opts']['public-key'] = $realitySettings['public-key'];
|
&& ($tls_settings['short_id'] ?? null)
|
||||||
$array['reality-opts']['short-id'] = $realitySettings['short-id'];
|
&& ($tls_settings['server_name'] ?? null)){
|
||||||
}
|
$array['servername'] = $tls_settings['server_name'];
|
||||||
|
$array['reality-opts'] = [
|
||||||
|
'public-key' => $tls_settings['public_key'],
|
||||||
|
'short-id' => $tls_settings['short_id']
|
||||||
|
];
|
||||||
|
$fingerprints = ['chrome', 'firefox', 'safari', 'ios', 'edge', 'qq']; //随机客户端指纹
|
||||||
|
$array['client-fingerprint'] = $fingerprints[rand(0,count($fingerprints) - 1)];
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($server['network'] === 'tcp') {
|
|
||||||
$tcpSettings = $server['networkSettings'];
|
|
||||||
if (isset($tcpSettings['header']['type']) && $tcpSettings['header']['type'] == 'http') {
|
|
||||||
$array['network'] = $tcpSettings['header']['type'];
|
|
||||||
if (isset($tcpSettings['header']['request']['headers']['Host'])){
|
|
||||||
$array['http-opts']['headers']['Host'] = $tcpSettings['header']['request']['headers']['Host'];
|
|
||||||
}
|
|
||||||
if (isset($tcpSettings['header']['request']['path'][0])){
|
|
||||||
$paths = $tcpSettings['header']['request']['path'];
|
|
||||||
$array['http-opts']['path'] = $paths[array_rand($paths)];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($server['network'] === 'ws') {
|
if ($server['network'] === 'ws') {
|
||||||
@ -241,7 +241,9 @@ class Stash
|
|||||||
if ($server['network_settings']) {
|
if ($server['network_settings']) {
|
||||||
$grpcSettings = $server['network_settings'];
|
$grpcSettings = $server['network_settings'];
|
||||||
$array['grpc-opts'] = [];
|
$array['grpc-opts'] = [];
|
||||||
if (isset($grpcSettings['serviceName'])) $array['grpc-opts']['grpc-service-name'] = $grpcSettings['serviceName'];
|
if (isset($grpcSettings['serviceName'])) {
|
||||||
|
$array['grpc-opts']['grpc-service-name'] = $grpcSettings['serviceName'];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,11 +110,20 @@ class Helper
|
|||||||
|
|
||||||
public static function getSubscribeUrl(string $token, $subscribeUrl = null)
|
public static function getSubscribeUrl(string $token, $subscribeUrl = null)
|
||||||
{
|
{
|
||||||
|
$strs = 'QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm';
|
||||||
|
$randstr = substr(str_shuffle($strs), 0, rand(4,8));
|
||||||
|
|
||||||
$path = route('client.subscribe', ['token' => $token], false);
|
$path = route('client.subscribe', ['token' => $token], false);
|
||||||
if(!$subscribeUrl){
|
if(!$subscribeUrl){
|
||||||
$subscribeUrls = explode(',', admin_setting('subscribe_url'));
|
$subscribeUrls = explode(',', admin_setting('subscribe_url'));
|
||||||
$subscribeUrl = \Arr::random($subscribeUrls);
|
$subscribeUrl = \Arr::random($subscribeUrls);
|
||||||
$subscribeUrl = self::replaceByPattern($subscribeUrl);
|
$subscribeUrl = self::replaceByPattern($subscribeUrl);
|
||||||
|
if (strpos($subscribeUrl, "*") !== false) {
|
||||||
|
$subscribeUrl = str_replace("*", $randstr, $subscribeUrl);
|
||||||
|
} elseif (strpos($subscribeUrl, '{uuid}') !== false) {
|
||||||
|
$user = User::where('token', $token)->first();
|
||||||
|
$subscribeUrl = str_replace('{uuid}', $user->uuid, $subscribeUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $subscribeUrl ? rtrim($subscribeUrl, '/') . $path : url($path);
|
return $subscribeUrl ? rtrim($subscribeUrl, '/') . $path : url($path);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ if ! command -v git &> /dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
git config --global --add safe.directory $(pwd)
|
git config --global --add safe.directory $(pwd)
|
||||||
git fetch --all && git reset --hard origin/dev && git pull origin dev
|
git fetch --all && git reset --hard origin/legacy && git pull origin legacy
|
||||||
rm -rf composer.lock composer.phar
|
rm -rf composer.lock composer.phar
|
||||||
wget https://github.com/composer/composer/releases/latest/download/composer.phar -O composer.phar
|
wget https://github.com/composer/composer/releases/latest/download/composer.phar -O composer.phar
|
||||||
php composer.phar update -vvv
|
php composer.phar update -vvv
|
||||||
|
Loading…
Reference in New Issue
Block a user