fix singbox import

This commit is contained in:
mercury
2024-08-14 23:52:21 +04:00
parent ef3d40c098
commit 741f402ca1
2 changed files with 13 additions and 6 deletions
+7 -3
View File
@@ -4320,11 +4320,15 @@ DNS-over-HTTPS with IP:
}
if (!empty($_GET['r'])) {
$si = "$scheme://{$domain}/pac?h=$hash&t=si&s=$uid";
$si = "$scheme://{$domain}/pac/" . base64_encode(serialize([
'h' => $hash,
't' => 'si',
's' => $uid,
]));
$v2 = "$scheme://{$domain}/pac?h=$hash&t=s&s=$uid";
switch ($_GET['r']) {
case 'si':
header("Location: sing-box://import-remote-profile/?url=" . urlencode($si));
header("Location: sing-box://import-remote-profile/?url=" . $si);
exit;
case 'st':
header("Location: streisand://import/$v2");
@@ -4333,7 +4337,7 @@ DNS-over-HTTPS with IP:
header("Location: v2rayng://install-config?url=" . urlencode($v2));
exit;
case 'h':
header("Location: hiddify://install-config/?url=" . urlencode($si));
header("Location: hiddify://install-config/?url=" . $si);
exit;
case 'w':
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
+6 -3
View File
@@ -17,10 +17,13 @@ if ('POST' == $_SERVER['REQUEST_METHOD'] && $_GET['k'] == $c['key']) {
}
// pac
$type = $_GET['t'] ?? 'pac';
if (!empty($t = unserialize(base64_decode(explode('/', $_SERVER['REQUEST_URI'])[2])))) { // fix sing-box import
$_GET = array_merge($_GET, $t);
}
$type = $_GET['t'] ?? 'pac';
$address = $_GET['a'] ?: '127.0.0.1';
$port = $_GET['p'] ?: '1080';
$hash = $_GET['h'];
$port = $_GET['p'] ?: '1080';
$hash = $_GET['h'];
if ($hash == substr(md5($c['key']), 0, 8)) {
require __DIR__ . '/bot.php';
require __DIR__ . '/i18n.php';