Compare commits

...

7 Commits

Author SHA1 Message Date
Roc
9344041256
Merge 2fdffab3c6 into 74d93691b9 2025-01-17 23:36:20 +08:00
Xboard
74d93691b9
Merge pull request #313 from elysias123/dev
Some checks failed
Docker Build and Publish / build (push) Has been cancelled
allow admin/staff unbind a user and better subscription domain names
2025-01-17 11:59:11 +08:00
Elysia
a550fd1436
feat: Replace with a random string when the subscription domain contains *&Replace with the user uuid when the subscription domain contains {uuid} 2025-01-14 13:54:26 +08:00
Elysia
43bac89d3a
Merge branch 'cedar2025:dev' into dev 2025-01-13 21:35:45 +08:00
Elysia
e2262f1435
feat: allow admin/staff unbind a user 2025-01-12 15:31:51 +08:00
Cp0204
2fdffab3c6
Merge branch 'cedar2025:dev' into adapted-allowInsecure 2024-12-16 22:44:19 +08:00
Cp0204
603b240733
feat: 适配 allowInsecure 字段 2024-05-29 13:01:48 +08:00
10 changed files with 46 additions and 7 deletions

View File

@ -12,11 +12,17 @@ class UnBind extends Telegram {
public function handle($message, $match = []) {
if (!$message->is_private) return;
$user = User::where('telegram_id', $message->chat_id)->first();
$telegramService = $this->telegramService;
if (!$user) {
$telegramService->sendMessage($message->chat_id, '没有查询到您的用户信息,请先绑定账号', 'markdown');
return;
if (!isset($message->args[0])) {
$user = User::where('telegram_id', $message->chat_id)->first();
} else {
$chat = User::where('telegram_id', $message->chat_id)->first();
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;
if (!$user->save()) {

View File

@ -74,6 +74,8 @@ class General
$tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
}
}
if ((string)$server['network'] === 'tcp') {
@ -122,6 +124,8 @@ class General
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
}
break;
case 2: //reality

View File

@ -72,6 +72,8 @@ class Passwall
$tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
}
}
if ((string)$server['network'] === 'tcp') {
@ -120,6 +122,8 @@ class Passwall
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
}
break;
case 2: //reality

View File

@ -72,6 +72,8 @@ class SSRPlus
$tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
}
}
if ((string)$server['network'] === 'ws') {
@ -108,6 +110,8 @@ class SSRPlus
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
}
break;
case 2: //reality

View File

@ -70,6 +70,8 @@ class SagerNet
$tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = urlencode($tlsSettings['serverName']);
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
}
}
if ((string)$server['network'] === 'tcp') {

View File

@ -150,8 +150,8 @@ class Shadowrocket
$config['tls'] = 1;
if ($server['tls_settings']) {
$tlsSettings = $server['tls_settings'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = (int)$tlsSettings['allowInsecure'];
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = (int)$tlsSettings['allow_insecure'];
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['peer'] = $tlsSettings['server_name'];
}

View File

@ -189,6 +189,8 @@ class Stash
case 1:
if ($server['tls_settings']) {
$tlsSettings = $server['tls_settings'];
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$array['skip-cert-verify'] = ($tlsSettings['allow_insecure'] ? true : false);
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$array['servername'] = $tlsSettings['server_name'];
}

View File

@ -75,6 +75,8 @@ class V2rayN
$tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
}
}
if ((string)$server['network'] === 'tcp') {
@ -123,6 +125,8 @@ class V2rayN
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
}
break;
case 2: //reality

View File

@ -76,6 +76,8 @@ class V2rayNG
$tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
}
}
if ((string)$server['network'] === 'tcp') {
@ -124,6 +126,8 @@ class V2rayNG
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
}
break;
case 2: //reality

View File

@ -110,11 +110,20 @@ class Helper
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);
if(!$subscribeUrl){
$subscribeUrls = explode(',', admin_setting('subscribe_url'));
$subscribeUrl = \Arr::random($subscribeUrls);
$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);
}