diff --git a/.github/workflows/unit.yaml b/.github/workflows/unit.yaml index 9d3ab26cd6..3b0d8ef12f 100644 --- a/.github/workflows/unit.yaml +++ b/.github/workflows/unit.yaml @@ -21,7 +21,7 @@ jobs: php: - '**/*.php' - php8.2: + php82: needs: php-file-changed if: ${{ needs.php-file-changed.outputs.php == 'true' }} runs-on: ubuntu-latest @@ -34,7 +34,7 @@ jobs: composer install --no-interaction --no-progress --no-suggest --quiet php vendor/bin/phpunit - php8.3: + php83: needs: php-file-changed if: ${{ needs.php-file-changed.outputs.php == 'true' }} runs-on: ubuntu-latest diff --git a/config/appprofile.example.php b/config/appprofile.example.php index d8b96c7ba2..59d577d22d 100644 --- a/config/appprofile.example.php +++ b/config/appprofile.example.php @@ -70,6 +70,10 @@ 'strategy' => 'prefer_ipv6', 'detour' => 'select', ], + [ + 'tag' => 'fakeip', + 'address' => 'fakeip', + ], [ 'tag' => 'block', 'address' => 'rcode://refused', @@ -81,19 +85,20 @@ 'server' => 'local', ], [ - 'clash_mode' => 'Global', + 'rule_set' => 'geosite-geolocation-!cn', 'server' => 'cloudflare', ], [ 'rule_set' => 'geosite-cn', - 'server' => 'local', - ], - [ - 'clash_mode' => 'Direct', - 'server' => 'local', + 'server' => 'fakeip', ], ], 'final' => 'cloudflare', + 'fakeip' => [ + 'enabled' => true, + 'inet4_range' => '198.18.0.0/15', + 'inet6_range' => 'fc00::/18', + ], 'disable_cache' => true, 'independent_cache' => true, ], @@ -109,7 +114,6 @@ 'strict_route' => true, 'udp_timeout' => 60, 'stack' => 'mixed', - 'sniff_override_destination' => true, ], ], 'outbounds' => [ @@ -149,11 +153,9 @@ 'action' => 'hijack-dns', ], [ - 'clash_mode' => 'Direct', - 'outbound' => 'direct', - ], - [ - 'clash_mode' => 'Global', + 'rule_set' => [ + 'geosite-geolocation-!cn', + ], 'outbound' => 'select', ], [ @@ -179,7 +181,7 @@ 'type' => 'remote', 'format' => 'binary', 'url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/SagerNet/sing-geoip@rule-set/geoip-cn.srs', - 'download_detour' => 'select', + 'download_detour' => 'auto', 'update_interval' => '1d', ], [ @@ -187,7 +189,15 @@ 'type' => 'remote', 'format' => 'binary', 'url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/SagerNet/sing-geosite@rule-set/geosite-cn.srs', - 'download_detour' => 'select', + 'download_detour' => 'auto', + 'update_interval' => '1d', + ], + [ + 'tag' => 'geosite-geolocation-!cn', + 'type' => 'remote', + 'format' => 'binary', + 'url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/SagerNet/sing-geosite@rule-set/geosite-geolocation-!cn.srs', + 'download_detour' => 'auto', 'update_interval' => '1d', ], ], @@ -201,9 +211,6 @@ 'cache_id' => '', 'path' => 'cache.db', ], - 'clash_api' => [ - 'external_controller' => '127.0.0.1:9090', - ], ], ]; diff --git a/src/Controllers/Admin/OrderController.php b/src/Controllers/Admin/OrderController.php index 7b696055fc..d72c556ef4 100644 --- a/src/Controllers/Admin/OrderController.php +++ b/src/Controllers/Admin/OrderController.php @@ -47,14 +47,14 @@ public function index(ServerRequest $request, Response $response, array $args): ); } - public function search(ServerRequest $request, Response $response, array $args): ResponseInterface + public function search(ServerRequest $request, Response $response, array $args): ResponseInterface { $out_order_id = $request->getParam('gateway_order_id'); $paylist = (new Paylist())->where('tradeno', $out_order_id)->first(); $invoice = (new Invoice())->where('id', $paylist?->invoice_id)->first(); $order = (new Order())->where('id', $invoice?->order_id)->first(); - if ($order == null) { + if ($order === null) { return $response->withJson([ 'ret' => 0, 'msg' => '未找到订单', diff --git a/src/Services/Gateway/Smogate.php b/src/Services/Gateway/Smogate.php index 5c0cd1d158..886eb55e9c 100644 --- a/src/Services/Gateway/Smogate.php +++ b/src/Services/Gateway/Smogate.php @@ -4,11 +4,11 @@ namespace App\Services\Gateway; -use App\Models\Paylist; use App\Models\Config; +use App\Models\Paylist; use App\Services\Auth; use App\Services\View; -use Exception; +// use Exception; use Psr\Http\Message\ResponseInterface; use Slim\Http\Response; use Slim\Http\ServerRequest; @@ -33,7 +33,7 @@ public static function _readableName(): string public function post($data) { $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, "https://" . Config::obtain('smogate_app_id') . ".vless.org/v1/gateway/pay"); + curl_setopt($curl, CURLOPT_URL, 'https://' . Config::obtain('smogate_app_id') . '.vless.org/v1/gateway/pay'); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); @@ -69,7 +69,7 @@ public function purchase(ServerRequest $request, Response $response, array $args { $amount = $this->antiXss->xss_clean($request->getParam('amount')); $invoice_id = $this->antiXss->xss_clean($request->getParam('invoice_id')); - + $user = Auth::getUser(); if ($amount === '') { return $response->withJson([ @@ -90,8 +90,8 @@ public function purchase(ServerRequest $request, Response $response, array $args 'method' => 'alipay', 'app_id' => Config::obtain('smogate_app_id'), 'out_trade_no' => $pl->tradeno, - 'total_amount' => (int)($pl->total * 100), - 'notify_url' => self::getCallbackUrl() + 'total_amount' => (int) ($pl->total * 100), + 'notify_url' => self::getCallbackUrl(), ]; $params = $this->prepareSign($data); $data['sign'] = $this->sign($params); @@ -119,15 +119,9 @@ public function purchase(ServerRequest $request, Response $response, array $args ]); } - - private function isMobile() - { - return strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') !== false; - } - public function notify($request, $response, $args): ResponseInterface { - if (!$this->verify($request->getParams(), $request->getParam('sign'))) { + if (! $this->verify($request->getParams(), $request->getParam('sign'))) { die('FAIL'); } $this->postPayment($request->getParam('out_trade_no'), 'smogate'); @@ -138,4 +132,9 @@ public static function getPurchaseHTML(): string { return View::getSmarty()->fetch('gateway/smogate.tpl'); } -} \ No newline at end of file + + private function isMobile() + { + return strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') !== false; + } +} diff --git a/src/Services/Mail.php b/src/Services/Mail.php index d6386e48fb..9f8b0731ba 100644 --- a/src/Services/Mail.php +++ b/src/Services/Mail.php @@ -10,10 +10,10 @@ use App\Services\Mail\Mailgun; use App\Services\Mail\NullMail; use App\Services\Mail\Postal; +use App\Services\Mail\Postmark; use App\Services\Mail\SendGrid; use App\Services\Mail\Ses; use App\Services\Mail\Smtp; -use App\Services\Mail\Postmark; use Exception; use Psr\Http\Client\ClientExceptionInterface; use Smarty\Smarty;