mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-03-14 08:48:13 -04:00
Merge branch 'cedar2025:master' into master
This commit is contained in:
commit
d41909d564
15
Dockerfile
15
Dockerfile
@ -1,11 +1,16 @@
|
||||
FROM phpswoole/swoole:php8.2-alpine
|
||||
|
||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||
RUN install-php-extensions pcntl bcmath zip redis \
|
||||
&& apk --no-cache add shadow sqlite mysql-client mysql-client mysql-dev mariadb-connector-c git patch supervisor redis \
|
||||
&& addgroup -S -g 1000 www && adduser -S -G www -u 1000 www \
|
||||
&& (getent group redis || addgroup -S redis) \
|
||||
&& (getent passwd redis || adduser -S -G redis -H -h /data redis)
|
||||
|
||||
# Install PHP extensions one by one with lower optimization level for ARM64 compatibility
|
||||
RUN CFLAGS="-O1" install-php-extensions pcntl && \
|
||||
CFLAGS="-O1" install-php-extensions bcmath && \
|
||||
install-php-extensions zip && \
|
||||
install-php-extensions redis && \
|
||||
apk --no-cache add shadow sqlite mysql-client mysql-dev mariadb-connector-c git patch supervisor redis && \
|
||||
addgroup -S -g 1000 www && adduser -S -G www -u 1000 www && \
|
||||
(getent group redis || addgroup -S redis) && \
|
||||
(getent passwd redis || adduser -S -G redis -H -h /data redis)
|
||||
|
||||
WORKDIR /www
|
||||
COPY .docker /
|
||||
|
@ -134,16 +134,11 @@ class PluginController extends Controller
|
||||
'code' => 'required|string'
|
||||
]);
|
||||
|
||||
try {
|
||||
$this->pluginManager->disable($request->input('code'));
|
||||
return response()->json([
|
||||
'message' => '插件禁用成功'
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => '插件禁用失败:' . $e->getMessage()
|
||||
], 400);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,9 +45,9 @@ class HookManager
|
||||
* @param mixed ...$args 其他参数
|
||||
* @return mixed
|
||||
*/
|
||||
public static function filter(string $hook, mixed $value, mixed ...$args): mixed
|
||||
public static function filter(string $hook, mixed $value): mixed
|
||||
{
|
||||
return Eventy::filter($hook, $value, ...$args);
|
||||
return Eventy::filter($hook, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@ use App\Jobs\TrafficFetchJob;
|
||||
use App\Models\Order;
|
||||
use App\Models\Plan;
|
||||
use App\Models\User;
|
||||
use App\Services\Plugin\HookManager;
|
||||
|
||||
class UserService
|
||||
{
|
||||
@ -172,6 +173,11 @@ class UserService
|
||||
|
||||
public function trafficFetch(array $server, string $protocol, array $data)
|
||||
{
|
||||
list($server, $protocol, $data) = HookManager::filter('traffic.before_process', [
|
||||
$server,
|
||||
$protocol,
|
||||
$data
|
||||
]);
|
||||
|
||||
$timestamp = strtotime(date('Y-m-d'));
|
||||
collect($data)->chunk(1000)->each(function ($chunk) use ($timestamp, $server, $protocol) {
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Utils;
|
||||
|
||||
use App\Services\Plugin\HookManager;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class Helper
|
||||
{
|
||||
public static function uuidToBase64($uuid, $length)
|
||||
@ -113,10 +116,12 @@ class Helper
|
||||
$path = route('client.subscribe', ['token' => $token], false);
|
||||
if (!$subscribeUrl) {
|
||||
$subscribeUrls = explode(',', admin_setting('subscribe_url'));
|
||||
$subscribeUrl = \Arr::random($subscribeUrls);
|
||||
$subscribeUrl = Arr::random($subscribeUrls);
|
||||
$subscribeUrl = self::replaceByPattern($subscribeUrl);
|
||||
}
|
||||
return $subscribeUrl ? rtrim($subscribeUrl, '/') . $path : url($path);
|
||||
|
||||
$finalUrl = $subscribeUrl ? rtrim($subscribeUrl, '/') . $path : url($path);
|
||||
return HookManager::filter('subscribe.url', $finalUrl);
|
||||
}
|
||||
|
||||
public static function randomPort($range): int {
|
||||
|
Loading…
Reference in New Issue
Block a user