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
|
FROM phpswoole/swoole:php8.2-alpine
|
||||||
|
|
||||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
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 \
|
# Install PHP extensions one by one with lower optimization level for ARM64 compatibility
|
||||||
&& addgroup -S -g 1000 www && adduser -S -G www -u 1000 www \
|
RUN CFLAGS="-O1" install-php-extensions pcntl && \
|
||||||
&& (getent group redis || addgroup -S redis) \
|
CFLAGS="-O1" install-php-extensions bcmath && \
|
||||||
&& (getent passwd redis || adduser -S -G redis -H -h /data redis)
|
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
|
WORKDIR /www
|
||||||
COPY .docker /
|
COPY .docker /
|
||||||
|
@ -134,16 +134,11 @@ class PluginController extends Controller
|
|||||||
'code' => 'required|string'
|
'code' => 'required|string'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
$this->pluginManager->disable($request->input('code'));
|
||||||
$this->pluginManager->disable($request->input('code'));
|
return response()->json([
|
||||||
return response()->json([
|
'message' => '插件禁用成功'
|
||||||
'message' => '插件禁用成功'
|
]);
|
||||||
]);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
return response()->json([
|
|
||||||
'message' => '插件禁用失败:' . $e->getMessage()
|
|
||||||
], 400);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,9 +45,9 @@ class HookManager
|
|||||||
* @param mixed ...$args 其他参数
|
* @param mixed ...$args 其他参数
|
||||||
* @return mixed
|
* @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\Order;
|
||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Services\Plugin\HookManager;
|
||||||
|
|
||||||
class UserService
|
class UserService
|
||||||
{
|
{
|
||||||
@ -172,6 +173,11 @@ class UserService
|
|||||||
|
|
||||||
public function trafficFetch(array $server, string $protocol, array $data)
|
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'));
|
$timestamp = strtotime(date('Y-m-d'));
|
||||||
collect($data)->chunk(1000)->each(function ($chunk) use ($timestamp, $server, $protocol) {
|
collect($data)->chunk(1000)->each(function ($chunk) use ($timestamp, $server, $protocol) {
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Utils;
|
namespace App\Utils;
|
||||||
|
|
||||||
|
use App\Services\Plugin\HookManager;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
class Helper
|
class Helper
|
||||||
{
|
{
|
||||||
public static function uuidToBase64($uuid, $length)
|
public static function uuidToBase64($uuid, $length)
|
||||||
@ -111,12 +114,14 @@ class Helper
|
|||||||
public static function getSubscribeUrl(string $token, $subscribeUrl = null)
|
public static function getSubscribeUrl(string $token, $subscribeUrl = null)
|
||||||
{
|
{
|
||||||
$path = route('client.subscribe', ['token' => $token], false);
|
$path = route('client.subscribe', ['token' => $token], false);
|
||||||
if(!$subscribeUrl){
|
if (!$subscribeUrl) {
|
||||||
$subscribeUrls = explode(',', admin_setting('subscribe_url'));
|
$subscribeUrls = explode(',', admin_setting('subscribe_url'));
|
||||||
$subscribeUrl = \Arr::random($subscribeUrls);
|
$subscribeUrl = Arr::random($subscribeUrls);
|
||||||
$subscribeUrl = self::replaceByPattern($subscribeUrl);
|
$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 {
|
public static function randomPort($range): int {
|
||||||
|
Loading…
Reference in New Issue
Block a user