Passed
Push — main ( 72b417...516af1 )
by YeBeKhe
02:02
created
modules/singbox.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 header("Content-type: application/json;");
4 4
 
5 5
 function create_tehran_timestamp_tomorrow() {
6
-  date_default_timezone_set('Asia/Tehran');
7
-  $dateTomorrow = new DateTime('tomorrow');
8
-  $timestampTomorrow = strtotime($dateTomorrow->format('Y-m-d H:i:s'));
9
-  return $timestampTomorrow;
6
+    date_default_timezone_set('Asia/Tehran');
7
+    $dateTomorrow = new DateTime('tomorrow');
8
+    $timestampTomorrow = strtotime($dateTomorrow->format('Y-m-d H:i:s'));
9
+    return $timestampTomorrow;
10 10
 }
11 11
 
12 12
 function isEvenLength($str) {
@@ -22,27 +22,27 @@  discard block
 block discarded – undo
22 22
 function extract_names($input){
23 23
     foreach($input as $config){
24 24
         if ($config['tag'] !== ""){
25
-             $locationNames[] = $config['tag'];
25
+                $locationNames[] = $config['tag'];
26 26
         }
27 27
     }
28 28
     return $locationNames;
29 29
 }
30 30
 
31 31
 function processWsPath($input) {
32
-  if (strpos($input, '/') === 0) {
32
+    if (strpos($input, '/') === 0) {
33 33
     $input = substr($input, 1);
34
-  }
35
-  $max_early_data = 0;
36
-  if (strpos($input, '?ed=2048') !== false) {
34
+    }
35
+    $max_early_data = 0;
36
+    if (strpos($input, '?ed=2048') !== false) {
37 37
     $input = str_replace('?ed=2048', '', $input);
38 38
     $max_early_data = 2048;
39
-  }
40
-  $output = [
41
-      "path" => "/" . $input,
42
-      "max_early_data" => $max_early_data
43
-  ];
39
+    }
40
+    $output = [
41
+        "path" => "/" . $input,
42
+        "max_early_data" => $max_early_data
43
+    ];
44 44
   
45
-  return $output;
45
+    return $output;
46 46
 }
47 47
 
48 48
 function VmessSingbox($VmessUrl)
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             ],
328 328
         ];
329 329
     if (!isset($decodedTuic['params']['alpn']) || is_null($decodedTuic['params']['alpn']) || $decodedTuic['params']['alpn'] === "") {
330
-      unset($configResult['tls']["alpn"]);
330
+        unset($configResult['tls']["alpn"]);
331 331
     }
332 332
 
333 333
     return $configResult;
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
     return $length % 2 == 0;
15 15
 }
16 16
 
17
-function process_jsons($input, $locationNames){
17
+function process_jsons($input, $locationNames) {
18 18
     $input[0]['outbounds'] = array_merge($input[0]['outbounds'], array_filter($locationNames));
19 19
     return $input;
20 20
 }
21 21
 
22
-function extract_names($input){
23
-    foreach($input as $config){
24
-        if ($config['tag'] !== ""){
22
+function extract_names($input) {
23
+    foreach ($input as $config) {
24
+        if ($config['tag'] !== "") {
25 25
              $locationNames[] = $config['tag'];
26 26
         }
27 27
     }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
 function ShadowsocksSingbox($ShadowsocksUrl) {
276 276
     $decoded_shadowsocks = ParseShadowsocks($ShadowsocksUrl);
277
-    if (is_null($decoded_shadowsocks['name']) || $decoded_shadowsocks['name'] === ""){
277
+    if (is_null($decoded_shadowsocks['name']) || $decoded_shadowsocks['name'] === "") {
278 278
         return null;
279 279
     }
280 280
     if ($decoded_shadowsocks['encryption_method'] === "chacha20-poly1305") {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     return $configResult;
334 334
 }
335 335
 
336
-function GenerateConfig($input, $output, $theType){
336
+function GenerateConfig($input, $output, $theType) {
337 337
     $outbound = [];
338 338
     $v2ray_subscription = str_replace(" ", "%20", $input);
339 339
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     foreach ($configArray as $config) {
342 342
         $configType = detect_type($config);
343 343
         $config = str_replace("%20", " ", $config);
344
-        switch($configType) {
344
+        switch ($configType) {
345 345
             case "vmess":
346 346
                 $configSingbox = VmessSingbox($config);
347 347
                 break;
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
                 $configSingbox = ShadowsocksSingbox($config);
359 359
                 break;
360 360
         }
361
-        if (!is_null($configSingbox)){
361
+        if (!is_null($configSingbox)) {
362 362
             $configName = $configSingbox['tag'];
363
-            if (stripos($configName, "RELAY
Please login to merge, or discard this patch.