Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Uim] (sing-box)add geosite-geolocation-!cn #2482

Merged
merged 8 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
41 changes: 24 additions & 17 deletions config/appprofile.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
'strategy' => 'prefer_ipv6',
'detour' => 'select',
],
[
'tag' => 'fakeip',
'address' => 'fakeip',
],
[
'tag' => 'block',
'address' => 'rcode://refused',
Expand All @@ -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,
],
Expand All @@ -109,7 +114,6 @@
'strict_route' => true,
'udp_timeout' => 60,
'stack' => 'mixed',
'sniff_override_destination' => true,
],
],
'outbounds' => [
Expand Down Expand Up @@ -149,11 +153,9 @@
'action' => 'hijack-dns',
],
[
'clash_mode' => 'Direct',
'outbound' => 'direct',
],
[
'clash_mode' => 'Global',
'rule_set' => [
'geosite-geolocation-!cn',
],
'outbound' => 'select',
],
[
Expand All @@ -179,15 +181,23 @@
'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',
],
[
'tag' => 'geosite-cn',
'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',
],
],
Expand All @@ -201,9 +211,6 @@
'cache_id' => '',
'path' => 'cache.db',
],
'clash_api' => [
'external_controller' => '127.0.0.1:9090',
],
],
];

Expand Down
4 changes: 2 additions & 2 deletions src/Controllers/Admin/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '未找到订单',
Expand Down
27 changes: 13 additions & 14 deletions src/Services/Gateway/Smogate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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([
Expand All @@ -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);
Expand Down Expand Up @@ -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');
Expand All @@ -138,4 +132,9 @@ public static function getPurchaseHTML(): string
{
return View::getSmarty()->fetch('gateway/smogate.tpl');
}
}

private function isMobile()
{
return strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') !== false;
}
}
2 changes: 1 addition & 1 deletion src/Services/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down