diff --git a/app/Livewire/Forms/ServiceForm.php b/app/Livewire/Forms/ServiceForm.php index 57685cc..594469c 100644 --- a/app/Livewire/Forms/ServiceForm.php +++ b/app/Livewire/Forms/ServiceForm.php @@ -29,6 +29,9 @@ class ServiceForm extends Form #[Validate('nullable|string|max:255')] public ?string $url_pkdns = null; + #[Validate('nullable|ip|max:45')] + public ?string $ip = null; + #[Validate('required')] public ?string $type = null; @@ -51,6 +54,7 @@ class ServiceForm extends Form 'url_onion' => ['nullable', 'string', 'max:255'], 'url_i2p' => ['nullable', 'string', 'max:255'], 'url_pkdns' => ['nullable', 'string', 'max:255'], + 'ip' => ['nullable', 'ip', 'max:45'], 'contact' => ['nullable', 'string'], 'anonymous' => ['boolean'], ]; @@ -66,6 +70,7 @@ class ServiceForm extends Form $this->url_onion = $service->url_onion; $this->url_i2p = $service->url_i2p; $this->url_pkdns = $service->url_pkdns; + $this->ip = $service->ip; $this->type = $service->type?->value; $this->contact = $service->contact; $this->anonymous = is_null($service->created_by); @@ -84,6 +89,7 @@ class ServiceForm extends Form 'url_onion' => $this->url_onion, 'url_i2p' => $this->url_i2p, 'url_pkdns' => $this->url_pkdns, + 'ip' => $this->ip, 'contact' => $this->contact, 'created_by' => $this->anonymous ? null : auth()->id(), ]); @@ -102,6 +108,7 @@ class ServiceForm extends Form 'url_onion' => $this->url_onion, 'url_i2p' => $this->url_i2p, 'url_pkdns' => $this->url_pkdns, + 'ip' => $this->ip, 'contact' => $this->contact, 'created_by' => $this->anonymous ? null : ($this->service->created_by ?? auth()->id()), ]); @@ -109,8 +116,8 @@ class ServiceForm extends Form protected function validateAtLeastOneUrl(): void { - if (empty($this->url_clearnet) && empty($this->url_onion) && empty($this->url_i2p) && empty($this->url_pkdns)) { - $this->addError('url_clearnet', __('Mindestens eine URL muss angegeben werden.')); + if (empty($this->url_clearnet) && empty($this->url_onion) && empty($this->url_i2p) && empty($this->url_pkdns) && empty($this->ip)) { + $this->addError('url_clearnet', __('Mindestens eine URL oder IP muss angegeben werden.')); throw new \Illuminate\Validation\ValidationException( \Illuminate\Support\Facades\Validator::make([], []) ); diff --git a/database/migrations/2025_12_07_045659_add_ip_column_to_self_hosted_services_table.php b/database/migrations/2025_12_07_045659_add_ip_column_to_self_hosted_services_table.php new file mode 100644 index 0000000..eab4398 --- /dev/null +++ b/database/migrations/2025_12_07_045659_add_ip_column_to_self_hosted_services_table.php @@ -0,0 +1,28 @@ +string('ip', 45)->nullable()->after('url_pkdns'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('self_hosted_services', function (Blueprint $table) { + $table->dropColumn('ip'); + }); + } +}; diff --git a/resources/views/livewire/services/create.blade.php b/resources/views/livewire/services/create.blade.php index a9efda9..1a83f34 100644 --- a/resources/views/livewire/services/create.blade.php +++ b/resources/views/livewire/services/create.blade.php @@ -116,6 +116,13 @@ class extends Component { {{ __('Pkarr DNS Adresse') }} + + + {{ __('IP-Adresse') }} + + {{ __('IP Adresse') }} + + diff --git a/resources/views/livewire/services/edit.blade.php b/resources/views/livewire/services/edit.blade.php index bfefd06..e0421e8 100644 --- a/resources/views/livewire/services/edit.blade.php +++ b/resources/views/livewire/services/edit.blade.php @@ -134,6 +134,13 @@ class extends Component { {{ __('Pkarr DNS Adresse') }} + + + {{ __('IP-Adresse') }} + + {{ __('IPv4 Adresse') }} + + diff --git a/resources/views/livewire/services/index.blade.php b/resources/views/livewire/services/index.blade.php index b373700..faf25a4 100644 --- a/resources/views/livewire/services/index.blade.php +++ b/resources/views/livewire/services/index.blade.php @@ -142,6 +142,19 @@ class extends Component { @endif + @if($service->ip) +
+ + + {{ $service->ip }} + +
+ + {{ __('Copy') }} + +
+
+ @endif