-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathsort.php
More file actions
46 lines (40 loc) · 1.19 KB
/
Copy pathsort.php
File metadata and controls
46 lines (40 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
error_reporting(E_ERROR | E_PARSE);
require "functions.php";
@mkdir("subscriptions/xray/normal", 0777, true);
@mkdir("subscriptions/xray/base64", 0777, true);
$configsArray = explode("\n", file_get_contents("config.txt"));
$sortArray = [
"mix" => [],
"vmess" => [],
"vless" => [],
"reality" => [],
"trojan" => [],
"ss" => [],
"tuic" => [],
"hy2" => [],
];
foreach ($configsArray as $config) {
$config = trim($config);
if ($config === "") {
continue;
}
$decoded = urldecode($config);
$configType = detect_type($config);
if (!$configType) {
continue;
}
$sortArray["mix"][] = $decoded;
$sortArray[$configType][] = $decoded;
if ($configType === "vless" && is_reality($config)) {
$sortArray["reality"][] = $decoded;
}
}
foreach ($sortArray as $type => $sort) {
$tempConfigs = hiddifyHeader("SiNAVM | " . strtoupper($type)) . implode("\n", $sort);
file_put_contents("subscriptions/xray/normal/" . $type, $tempConfigs);
file_put_contents("subscriptions/xray/base64/" . $type, base64_encode($tempConfigs));
}
echo "Sorting Done!";