🔧 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;
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());
}
}
}

View File

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

View File

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

View File

@@ -1,6 +1,8 @@
<?php
use App\Livewire\Forms\ProjectProposalForm;
use App\Models\ProjectProposal;
use App\Support\NostrAuth;
use Livewire\Volt\Component;
use swentel\nostr\Filter\Filter;
use swentel\nostr\Key\Key;
@@ -24,24 +26,21 @@ state([
'currentPleb' => null,
]);
mount(function ($projectProposal) {
$this->form->fill($projectProposal->toArray());
$this->image = $projectProposal->getFirstMedia('main');
});
usesFileUploads();
mount(function () {
if (\App\Support\NostrAuth::check()) {
$this->currentPubkey = \App\Support\NostrAuth::pubkey();
mount(function (ProjectProposal $projectProposal) {
if (NostrAuth::check()) {
$this->currentPubkey = NostrAuth::pubkey();
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $this->currentPubkey)->first();
$this->isAllowed = true;
$this->form->fill($projectProposal->toArray());
$this->image = $projectProposal->getFirstMedia('main');
}
});
on([
'nostrLoggedIn' => function ($pubkey) {
\App\Support\NostrAuth::login($pubkey);
NostrAuth::login($pubkey);
$this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first();
$this->isAllowed = true;
@@ -77,7 +76,7 @@ $save = function () {
@volt
<div>
@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">
<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">
@@ -90,7 +89,8 @@ $save = function () {
@endif
@if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main'))
<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
</div>
<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="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg">
<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">
Du bist nicht berechtigt, die Projekt-Unterstützungen zu bearbeiten.
</p>