mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
update
This commit is contained in:
parent
15af0ae2de
commit
c69132cc4c
@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Models\Plan;
|
||||
use App\Models\Server;
|
||||
use App\Utils\Helper;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class ClientController extends Controller
|
||||
@ -75,22 +76,7 @@ class ClientController extends Controller
|
||||
private function origin ($user, $server) {
|
||||
$uri = '';
|
||||
foreach($server as $item) {
|
||||
$config = [
|
||||
"ps" => $item->name,
|
||||
"add" => $item->host,
|
||||
"port" => $item->port,
|
||||
"id" => $user->v2ray_uuid,
|
||||
"aid" => "2",
|
||||
"net" => $item->network,
|
||||
"type" => "chacha20-poly1305",
|
||||
"host" => "",
|
||||
"tls" => $item->tls?"tls":"",
|
||||
];
|
||||
if ($item->network == 'ws') {
|
||||
$wsSettings = json_decode($item->settings);
|
||||
if ($wsSettings->path) $config['path'] = $wsSettings->path;
|
||||
}
|
||||
$uri .= "vmess://".base64_encode(json_encode($config))."\r\n";
|
||||
$uri .= Helper::buildVmessLink($item, $user);
|
||||
}
|
||||
return base64_encode($uri);
|
||||
}
|
||||
|
@ -104,6 +104,9 @@ class UserController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i <= count($server); $i++) {
|
||||
$server[$i]['link'] = Helper::buildVmessLink($server[$i], $user);
|
||||
}
|
||||
$user['subscribe_url'] = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL'))) . '/api/v1/client/subscribe?token=' . $user['token'];
|
||||
return response([
|
||||
'data' => [
|
||||
|
@ -49,4 +49,23 @@ class Helper
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
public static function buildVmessLink($item, $user) {
|
||||
$config = [
|
||||
"ps" => $item->name,
|
||||
"add" => $item->host,
|
||||
"port" => $item->port,
|
||||
"id" => $user->v2ray_uuid,
|
||||
"aid" => "2",
|
||||
"net" => $item->network,
|
||||
"type" => "chacha20-poly1305",
|
||||
"host" => "",
|
||||
"tls" => $item->tls?"tls":"",
|
||||
];
|
||||
if ($item->network == 'ws') {
|
||||
$wsSettings = json_decode($item->settings);
|
||||
if ($wsSettings->path) $config['path'] = $wsSettings->path;
|
||||
}
|
||||
return "vmess://".base64_encode(json_encode($config))."\r\n";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user