mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-25 04:13:17 +00:00
🛠️ Refactor migrations, models, configs, and Blade files to apply consistent formatting, remove unnecessary lines, and improve readability.
This commit is contained in:
@@ -15,7 +15,7 @@ trait NostrEventRendererTrait
|
||||
$profile = Profile::query()->where('pubkey', $event->pubkey)->first();
|
||||
if ($profile && $profile->name) {
|
||||
$name = $profile->name;
|
||||
} elseif ($profile && !empty($profile->display_name)) {
|
||||
} elseif ($profile && ! empty($profile->display_name)) {
|
||||
$name = $profile->display_name;
|
||||
} else {
|
||||
$name = 'Anonymous';
|
||||
@@ -30,7 +30,7 @@ trait NostrEventRendererTrait
|
||||
'event_id' => $event->event_id,
|
||||
], [
|
||||
'html' => $content,
|
||||
'profile_image' => $profile && $profile->picture !== '' ? $profile->picture : 'https://robohash.org/' . $profile->pubkey,
|
||||
'profile_image' => $profile && $profile->picture !== '' ? $profile->picture : 'https://robohash.org/'.$profile->pubkey,
|
||||
'profile_name' => $name,
|
||||
]);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ trait NostrEventRendererTrait
|
||||
$profile = Profile::query()->where('pubkey', $pubkey)->first();
|
||||
if ($profile && $profile->name) {
|
||||
$name = $profile->name;
|
||||
} elseif ($profile && !empty($profile->display_name)) {
|
||||
} elseif ($profile && ! empty($profile->display_name)) {
|
||||
$name = $profile->display_name;
|
||||
} else {
|
||||
$name = 'Anonymous';
|
||||
|
||||
@@ -22,6 +22,7 @@ trait NostrFetcherTrait
|
||||
'hex' => $item,
|
||||
'npub' => (new Key)->convertPublicKeyToBech32($item),
|
||||
]);
|
||||
|
||||
continue;
|
||||
}
|
||||
$hex->push([
|
||||
@@ -30,10 +31,10 @@ trait NostrFetcherTrait
|
||||
]);
|
||||
}
|
||||
|
||||
$subscription = new Subscription();
|
||||
$subscription = new Subscription;
|
||||
$subscriptionId = $subscription->setId();
|
||||
|
||||
$filter1 = new Filter();
|
||||
$filter1 = new Filter;
|
||||
$filter1->setKinds([0]); // You can add multiple kind numbers
|
||||
$filter1->setAuthors($hex->pluck('hex')->toArray()); // You can add multiple author ids
|
||||
$filters = [$filter1];
|
||||
@@ -54,7 +55,7 @@ trait NostrFetcherTrait
|
||||
try {
|
||||
$response = $request->send();
|
||||
$data = $response[$relayUrl];
|
||||
if (!empty($data)) {
|
||||
if (! empty($data)) {
|
||||
\Log::info('Successfully fetched data from relay: '.$relayUrl);
|
||||
break; // Exit the loop if data is not empty
|
||||
}
|
||||
@@ -65,6 +66,7 @@ trait NostrFetcherTrait
|
||||
|
||||
if (empty($data)) {
|
||||
\Log::warning('No data found from any relay');
|
||||
|
||||
return;
|
||||
}
|
||||
foreach ($data as $item) {
|
||||
@@ -94,5 +96,4 @@ trait NostrFetcherTrait
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user