mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-27 21:30:16 +00:00
🔧 Remove obsolete maintainers file
🛠️ Improve ProjectProposal form logic and refactor mounting process 🐳 Update Docker image reference in docker-compose configuration 🪵 Add logging to NostrFetcherTrait for better debugging
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Models\Profile;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use swentel\nostr\Filter\Filter;
|
||||
use swentel\nostr\Key\Key;
|
||||
use swentel\nostr\Message\RequestMessage;
|
||||
@@ -13,7 +12,6 @@ use swentel\nostr\Subscription\Subscription;
|
||||
|
||||
trait NostrFetcherTrait
|
||||
{
|
||||
|
||||
public function fetchProfile($npubs)
|
||||
{
|
||||
$hex = collect([]);
|
||||
@@ -58,14 +56,16 @@ trait NostrFetcherTrait
|
||||
$response = $request->send();
|
||||
$data = $response[$relayUrl];
|
||||
if (!empty($data)) {
|
||||
\Log::info('Successfully fetched data from relay: '.$relayUrl);
|
||||
break; // Exit the loop if data is not empty
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Log the exception or handle it if needed
|
||||
\Log::warning('Failed to fetch from relay '.$relayUrl.': '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($data)) {
|
||||
\Log::warning('No data found from any relay');
|
||||
return;
|
||||
}
|
||||
foreach ($data as $item) {
|
||||
@@ -87,9 +87,11 @@ trait NostrFetcherTrait
|
||||
'deleted' => $result['deleted'] ?? false,
|
||||
],
|
||||
);
|
||||
\Log::info('Profile updated/created for pubkey: '.$item->event->pubkey);
|
||||
}
|
||||
} catch (\JsonException $e) {
|
||||
throw new \RuntimeException('Error decoding JSON: ' . $e->getMessage());
|
||||
\Log::error('Error decoding JSON: '.$e->getMessage());
|
||||
throw new \RuntimeException('Error decoding JSON: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user