mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-02-12 19:48:13 -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 其他参数
|
||||
* @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;
|
||||
|
||||
use App\Services\Plugin\HookManager;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class Helper
|
||||
{
|
||||
public static function uuidToBase64($uuid, $length)
|
||||
@ -111,12 +114,14 @@ class Helper
|
||||
public static function getSubscribeUrl(string $token, $subscribeUrl = null)
|
||||
{
|
||||
$path = route('client.subscribe', ['token' => $token], false);
|
||||
if(!$subscribeUrl){
|
||||
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, $token]);
|
||||
}
|
||||
|
||||
public static function randomPort($range): int {
|
||||
|
Loading…
Reference in New Issue
Block a user