🔧 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:
HolgerHatGarKeineNode
2025-12-23 13:45:34 +01:00
parent 78f019bc4c
commit ed378ad5a0
4 changed files with 20 additions and 22 deletions

View File

@@ -3,7 +3,6 @@
namespace App\Traits; namespace App\Traits;
use App\Models\Profile; use App\Models\Profile;
use Illuminate\Support\Facades\Log;
use swentel\nostr\Filter\Filter; use swentel\nostr\Filter\Filter;
use swentel\nostr\Key\Key; use swentel\nostr\Key\Key;
use swentel\nostr\Message\RequestMessage; use swentel\nostr\Message\RequestMessage;
@@ -13,7 +12,6 @@ use swentel\nostr\Subscription\Subscription;
trait NostrFetcherTrait trait NostrFetcherTrait
{ {
public function fetchProfile($npubs) public function fetchProfile($npubs)
{ {
$hex = collect([]); $hex = collect([]);
@@ -58,14 +56,16 @@ trait NostrFetcherTrait
$response = $request->send(); $response = $request->send();
$data = $response[$relayUrl]; $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 break; // Exit the loop if data is not empty
} }
} catch (\Exception $e) { } catch (\Exception $e) {
// Log the exception or handle it if needed \Log::warning('Failed to fetch from relay '.$relayUrl.': '.$e->getMessage());
} }
} }
if (empty($data)) { if (empty($data)) {
\Log::warning('No data found from any relay');
return; return;
} }
foreach ($data as $item) { foreach ($data as $item) {
@@ -87,9 +87,11 @@ trait NostrFetcherTrait
'deleted' => $result['deleted'] ?? false, 'deleted' => $result['deleted'] ?? false,
], ],
); );
\Log::info('Profile updated/created for pubkey: '.$item->event->pubkey);
} }
} catch (\JsonException $e) { } 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());
} }
} }
} }

View File

@@ -5,7 +5,7 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
WWWGROUP: '${WWWGROUP}' WWWGROUP: '${WWWGROUP}'
image: sail-8.3/app image: sail-8.3/verein-einundzwanzig
extra_hosts: extra_hosts:
- 'host.docker.internal:host-gateway' - 'host.docker.internal:host-gateway'
ports: ports:

View File

@@ -1,5 +0,0 @@
identifier: einundzwanzig-nostr
maintainers:
- npub1pt0kw36ue3w2g4haxq3wgm6a2fhtptmzsjlc2j2vphtcgle72qesgpjyc6
relays:
- wss://nostr.einundzwanzig.space

View File

@@ -1,6 +1,8 @@
<?php <?php
use App\Livewire\Forms\ProjectProposalForm; use App\Livewire\Forms\ProjectProposalForm;
use App\Models\ProjectProposal;
use App\Support\NostrAuth;
use Livewire\Volt\Component; use Livewire\Volt\Component;
use swentel\nostr\Filter\Filter; use swentel\nostr\Filter\Filter;
use swentel\nostr\Key\Key; use swentel\nostr\Key\Key;
@@ -24,24 +26,21 @@ state([
'currentPleb' => null, 'currentPleb' => null,
]); ]);
mount(function ($projectProposal) {
$this->form->fill($projectProposal->toArray());
$this->image = $projectProposal->getFirstMedia('main');
});
usesFileUploads(); usesFileUploads();
mount(function () { mount(function (ProjectProposal $projectProposal) {
if (\App\Support\NostrAuth::check()) { if (NostrAuth::check()) {
$this->currentPubkey = \App\Support\NostrAuth::pubkey(); $this->currentPubkey = NostrAuth::pubkey();
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $this->currentPubkey)->first(); $this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $this->currentPubkey)->first();
$this->isAllowed = true; $this->isAllowed = true;
$this->form->fill($projectProposal->toArray());
$this->image = $projectProposal->getFirstMedia('main');
} }
}); });
on([ on([
'nostrLoggedIn' => function ($pubkey) { 'nostrLoggedIn' => function ($pubkey) {
\App\Support\NostrAuth::login($pubkey); NostrAuth::login($pubkey);
$this->currentPubkey = $pubkey; $this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first(); $this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first();
$this->isAllowed = true; $this->isAllowed = true;
@@ -77,7 +76,7 @@ $save = function () {
@volt @volt
<div> <div>
@if($isAllowed) @if($isAllowed)
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto"> <div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<form class="space-y-8 divide-y divide-gray-700 pb-24"> <form class="space-y-8 divide-y divide-gray-700 pb-24">
<div class="space-y-8 divide-y divide-gray-700 sm:space-y-5"> <div class="space-y-8 divide-y divide-gray-700 sm:space-y-5">
<div class="mt-6 sm:mt-5 space-y-6 sm:space-y-5"> <div class="mt-6 sm:mt-5 space-y-6 sm:space-y-5">
@@ -90,7 +89,8 @@ $save = function () {
@endif @endif
@if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main')) @if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main'))
<div class="text-gray-200">{{ __('Current picture') }}:</div> <div class="text-gray-200">{{ __('Current picture') }}:</div>
<img class="h-48 object-contain" src="{{ $projectProposal->getFirstMediaUrl('main') }}"> <img class="h-48 object-contain"
src="{{ $projectProposal->getFirstMediaUrl('main') }}">
@endif @endif
</div> </div>
<input class="text-gray-200" type="file" wire:model="image"> <input class="text-gray-200" type="file" wire:model="image">
@@ -156,7 +156,8 @@ $save = function () {
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto"> <div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<div class="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg"> <div class="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg">
<div class="px-4 py-5 sm:px-6"> <div class="px-4 py-5 sm:px-6">
<h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-200">Projekt-Unterstützung</h3> <h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-200">
Projekt-Unterstützung</h3>
<p class="mt-1 max-w"> <p class="mt-1 max-w">
Du bist nicht berechtigt, die Projekt-Unterstützungen zu bearbeiten. Du bist nicht berechtigt, die Projekt-Unterstützungen zu bearbeiten.
</p> </p>