From 24936277dbed596991af4c3e4be0c1287d6abd4b Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Thu, 10 Oct 2024 03:05:34 +0800 Subject: [PATCH] get_user_passkey() --- app/Console/Commands/Test.php | 13 ++----------- app/Filament/Pages/Dashboard.php | 25 +++++++++++++++++++++++++ include/globalfunctions.php | 9 +++++++++ 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 3cee37fd..f3d14a6a 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -100,17 +100,8 @@ class Test extends Command */ public function handle() { - $url = "http://127.0.0.1:7777/list-seeder-leecher-count"; - $idArr = [8, 12]; - $client = new Client(); - $response = $client->post($url, ['json' => ['torrent_ids' => $idArr]]); - $result = json_decode((string)$response->getBody(), true); - dump($result); - if (!isset($result['ret']) || $result['ret'] != 0) { - echo "Bad"; - } else { - echo "OK"; - } + $ip = "116.77.75.254"; + $this->info(inet_pton($ip)); } } diff --git a/app/Filament/Pages/Dashboard.php b/app/Filament/Pages/Dashboard.php index 3fd98ef6..198034de 100644 --- a/app/Filament/Pages/Dashboard.php +++ b/app/Filament/Pages/Dashboard.php @@ -1,7 +1,32 @@ user()->id ?? 0; } +function get_user_passkey() +{ + if (IN_NEXUS) { + global $CURUSER; + return $CURUSER["passkey"] ?? ""; + } + return auth()->user()->passkey ?? ""; +} + function get_pure_username() { if (IN_NEXUS) {