mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-04 19:49:16 +00:00
fix #107
This commit is contained in:
@@ -16,7 +16,7 @@ class QuantumultX
|
||||
];
|
||||
$config = array_filter($config);
|
||||
|
||||
return implode(',', $config)."\r\n";
|
||||
return implode(',', $config).PHP_EOL;
|
||||
}
|
||||
|
||||
public static function buildShadowsocksr($server)
|
||||
@@ -35,7 +35,7 @@ class QuantumultX
|
||||
];
|
||||
$config = array_filter($config);
|
||||
|
||||
return implode(',', $config)."\r\n";
|
||||
return implode(',', $config).PHP_EOL;
|
||||
}
|
||||
|
||||
public static function buildVmess($server)
|
||||
@@ -73,7 +73,7 @@ class QuantumultX
|
||||
$config[] = "obfs-host={$server['v2_host']}";
|
||||
}
|
||||
|
||||
return implode(',', $config)."\r\n";
|
||||
return implode(',', $config).PHP_EOL;
|
||||
}
|
||||
|
||||
public static function buildTrojan($server)
|
||||
@@ -91,6 +91,6 @@ class QuantumultX
|
||||
];
|
||||
$config = array_filter($config);
|
||||
|
||||
return implode(',', $config)."\r\n";
|
||||
return implode(',', $config).PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class Surfboard
|
||||
];
|
||||
$config = array_filter($config);
|
||||
|
||||
return implode(',', $config)."\r\n";
|
||||
return implode(',', $config).PHP_EOL;
|
||||
}
|
||||
|
||||
public static function buildVmess($server)
|
||||
@@ -42,6 +42,6 @@ class Surfboard
|
||||
$config[] = "ws-headers=Host:{$server['v2_host']}";
|
||||
}
|
||||
|
||||
return implode(',', $config)."\r\n";
|
||||
return implode(',', $config).PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class Surge
|
||||
];
|
||||
$config = array_filter($config);
|
||||
|
||||
return implode(',', $config)."\r\n";
|
||||
return implode(',', $config).PHP_EOL;
|
||||
}
|
||||
|
||||
public static function buildVmess($server)
|
||||
@@ -41,7 +41,7 @@ class Surge
|
||||
$config[] = "ws-headers=Host:{$server['v2_host']}";
|
||||
}
|
||||
|
||||
return implode(',', $config)."\r\n";
|
||||
return implode(',', $config).PHP_EOL;
|
||||
}
|
||||
|
||||
public static function buildTrojan($server)
|
||||
@@ -58,6 +58,6 @@ class Surge
|
||||
|
||||
$config = array_filter($config);
|
||||
|
||||
return implode(',', $config)."\r\n";
|
||||
return implode(',', $config).PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@ class URLSchemes
|
||||
$name = rawurlencode($server['name']);
|
||||
$str = base64url_encode("{$server['method']}:{$server['method']}");
|
||||
|
||||
return "ss://{$str}@{$server['host']}:{$server['port']}#{$name}\r\n";
|
||||
return "ss://{$str}@{$server['host']}:{$server['port']}#{$name}".PHP_EOL;
|
||||
}
|
||||
|
||||
public static function buildShadowsocksr($server)
|
||||
{
|
||||
$setting = "{$server['host']}:{$server['port']}:{$server['protocol']}:{$server['method']}:{$server['obfs']}:";
|
||||
|
||||
return 'ssr://'.base64url_encode($setting.base64url_encode($server['passwd']).'/?obfsparam='.base64url_encode($server['obfs_param']).'&protoparam='.base64url_encode($server['protocol_param']).'&remarks='.base64url_encode($server['name']).'&group='.base64url_encode($server['group']).'&udpport='.$server['udp'].'&uot=0').'\r\n';
|
||||
return 'ssr://'.base64url_encode($setting.base64url_encode($server['passwd']).'/?obfsparam='.base64url_encode($server['obfs_param']).'&protoparam='.base64url_encode($server['protocol_param']).'&remarks='.base64url_encode($server['name']).'&group='.base64url_encode($server['group']).'&udpport='.$server['udp'].'&uot=0').PHP_EOL;
|
||||
}
|
||||
|
||||
// TODO: More study required about id usage https://shadowsocks.org/en/wiki/SIP008-Online-Configuration-Delivery.html
|
||||
@@ -52,7 +52,7 @@ class URLSchemes
|
||||
'tls' => $server['v2_tls'],
|
||||
];
|
||||
|
||||
return 'vmess://'.base64_encode(json_encode($config))."\r\n";
|
||||
return 'vmess://'.base64_encode(json_encode($config)).PHP_EOL;
|
||||
}
|
||||
|
||||
public static function buildTrojan($server)
|
||||
@@ -63,6 +63,6 @@ class URLSchemes
|
||||
$query = "?sni={$server['relay_server']}";
|
||||
}
|
||||
|
||||
return "trojan://{$server['passwd']}@{$server['host']}:{$server['port']}{$query}#{$name}\r\n";
|
||||
return "trojan://{$server['passwd']}@{$server['host']}:{$server['port']}{$query}#{$name}".PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class SubscribeController extends Controller
|
||||
}
|
||||
|
||||
if ($target) {
|
||||
if (strpos($target, 'quantumult x') !== false) {
|
||||
if (strpos($target, 'quantumult%20x') !== false) {
|
||||
exit($this->quantumultX($user, $servers));
|
||||
}
|
||||
if (strpos($target, 'quantumult') !== false) {
|
||||
@@ -123,9 +123,9 @@ class SubscribeController extends Controller
|
||||
if (strpos($target, 'shadowrocket') !== false) {
|
||||
exit($this->shadowrocket($user, $servers));
|
||||
}
|
||||
if (strpos($target, 'shadowsocks') !== false) {
|
||||
exit($this->shaodowsocksSIP008($servers));
|
||||
}
|
||||
// if (strpos($target, 'shadowsocks') !== false) {
|
||||
// exit($this->shaodowsocksSIP008($servers));
|
||||
// }
|
||||
}
|
||||
exit($this->origin($servers));
|
||||
}
|
||||
@@ -196,10 +196,9 @@ class SubscribeController extends Controller
|
||||
|
||||
private function quantumult(User $user, array $servers = []): string
|
||||
{
|
||||
header('subscription-userinfo: upload='.$user->u.'; download='.$user->d.';total='.$user->transfer_enable).'; expire='.strtotime($user->expired_at);
|
||||
$uri = $this->origin($servers);
|
||||
header('subscription-userinfo: upload='.$user->u.'; download='.$user->d.';total='.$user->transfer_enable.'; expire='.strtotime($user->expired_at));
|
||||
|
||||
return base64_encode($uri);
|
||||
return $this->origin($servers);
|
||||
}
|
||||
|
||||
private function origin(array $servers = [], bool $encode = true): string
|
||||
|
||||
@@ -165,12 +165,12 @@
|
||||
<select class="form-control" id="client" name="client" data-plugin="selectpicker" data-style="btn-outline btn-primary">
|
||||
<option value="" hidden>默 认</option>
|
||||
<option value="quantumult">圈 - Quantumult</option>
|
||||
<option value="quantumult x">圈X - QuantumultX</option>
|
||||
<option value="quantumult%20x">圈X - QuantumultX</option>
|
||||
<option value="clash">Clash</option>
|
||||
<option value="surfboard">Surfboard</option>
|
||||
<option value="surge">Surge</option>
|
||||
<option value="shadowrocket">小火箭 - Shadowrocket</option>
|
||||
<option value="shadowsocks">SS路由器</option>
|
||||
{{-- <option value="shadowsocks">SS路由器</option>--}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user