mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-05 12:40:52 +08:00
feat: add AnyTLS support and improve system functionality
- Add AnyTLS protocol support - Add system logs viewing in admin panel - Refactor client subscription delivery code - Refactor hook mechanism - Add plugin support for Shadowsocks protocol - Add CSV export option for batch user creation - Fix mobile admin login page width display issue
This commit is contained in:
@@ -2,24 +2,11 @@
|
||||
|
||||
namespace App\Protocols;
|
||||
|
||||
use App\Contracts\ProtocolInterface;
|
||||
use App\Support\AbstractProtocol;
|
||||
|
||||
class QuantumultX implements ProtocolInterface
|
||||
class QuantumultX extends AbstractProtocol
|
||||
{
|
||||
public $flags = ['quantumult%20x'];
|
||||
private $servers;
|
||||
private $user;
|
||||
|
||||
public function __construct($user, $servers)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->servers = $servers;
|
||||
}
|
||||
|
||||
public function getFlags(): array
|
||||
{
|
||||
return $this->flags;
|
||||
}
|
||||
public $flags = ['quantumult%20x', 'quantumult-x'];
|
||||
|
||||
public function handle()
|
||||
{
|
||||
@@ -53,6 +40,32 @@ class QuantumultX implements ProtocolInterface
|
||||
'udp-relay=true',
|
||||
"tag={$server['name']}"
|
||||
];
|
||||
if (data_get($protocol_settings, 'plugin') && data_get($protocol_settings, 'plugin_opts')) {
|
||||
$plugin = data_get($protocol_settings, 'plugin');
|
||||
$pluginOpts = data_get($protocol_settings, 'plugin_opts', '');
|
||||
// 解析插件选项
|
||||
$parsedOpts = collect(explode(';', $pluginOpts))
|
||||
->filter()
|
||||
->mapWithKeys(function ($pair) {
|
||||
if (!str_contains($pair, '=')) {
|
||||
return [];
|
||||
}
|
||||
[$key, $value] = explode('=', $pair, 2);
|
||||
return [trim($key) => trim($value)];
|
||||
})
|
||||
->all();
|
||||
switch ($plugin) {
|
||||
case 'obfs':
|
||||
$config[] = "obfs={$parsedOpts['obfs']}";
|
||||
if (isset($parsedOpts['obfs-host'])) {
|
||||
$config[] = "obfs-host={$parsedOpts['obfs-host']}";
|
||||
}
|
||||
if (isset($parsedOpts['path'])) {
|
||||
$config[] = "obfs-uri={$parsedOpts['path']}";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$uri = implode(',', $config);
|
||||
$uri .= "\r\n";
|
||||
return $uri;
|
||||
|
||||
Reference in New Issue
Block a user