mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-02-15 12:58:14 -05:00
feat(plugin): add subscribe.url hook
This commit is contained in:
parent
667e02460c
commit
7c0434d182
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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)
|
||||||
@ -113,10 +116,12 @@ class Helper
|
|||||||
$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, $token]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function randomPort($range): int {
|
public static function randomPort($range): int {
|
||||||
|
Loading…
Reference in New Issue
Block a user