recovery quantumult, next month delete.

This commit is contained in:
Tokumeikoi 2020-06-20 22:50:43 +08:00
parent 4f277097f6
commit 976dfd2d98

View File

@ -29,6 +29,9 @@ class ClientController extends Controller
if (strpos($_SERVER['HTTP_USER_AGENT'], 'quantumult%20x') !== false) { if (strpos($_SERVER['HTTP_USER_AGENT'], 'quantumult%20x') !== false) {
die($this->quantumultX($user, $servers['vmess'], $servers['trojan'])); die($this->quantumultX($user, $servers['vmess'], $servers['trojan']));
} }
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Quantumult') !== false) {
die($this->quantumult($user, $servers['vmess']));
}
if (strpos($_SERVER['HTTP_USER_AGENT'], 'clash') !== false) { if (strpos($_SERVER['HTTP_USER_AGENT'], 'clash') !== false) {
die($this->clash($user, $servers['vmess'], $servers['trojan'])); die($this->clash($user, $servers['vmess'], $servers['trojan']));
} }
@ -42,6 +45,26 @@ class ClientController extends Controller
die($this->origin($user, $servers['vmess'], $servers['trojan'])); die($this->origin($user, $servers['vmess'], $servers['trojan']));
} }
} }
// TODO: Ready to stop support
private function quantumult($user, $vmess = [])
{
$uri = '';
header('subscription-userinfo: upload=' . $user->u . '; download=' . $user->d . ';total=' . $user->transfer_enable);
foreach ($vmess as $item) {
$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');
if ($item->network === 'ws') {
$str .= ', obfs=ws';
if ($item->networkSettings) {
$wsSettings = json_decode($item->networkSettings);
if (isset($wsSettings->path)) $str .= ', obfs-path="' . $wsSettings->path . '"';
if (isset($wsSettings->headers->Host)) $str .= ', obfs-header="Host:' . $wsSettings->headers->Host . '"';
}
}
$uri .= "vmess://" . base64_encode($str) . "\r\n";
}
return base64_encode($uri);
}
private function quantumultX($user, $vmess = [], $trojan = []) private function quantumultX($user, $vmess = [], $trojan = [])
{ {