mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-14 12:06:46 +00:00
🌐 Enhance service management: Add IP address field to forms, views, and database schema
This commit is contained in:
@@ -29,6 +29,9 @@ class ServiceForm extends Form
|
|||||||
#[Validate('nullable|string|max:255')]
|
#[Validate('nullable|string|max:255')]
|
||||||
public ?string $url_pkdns = null;
|
public ?string $url_pkdns = null;
|
||||||
|
|
||||||
|
#[Validate('nullable|ip|max:45')]
|
||||||
|
public ?string $ip = null;
|
||||||
|
|
||||||
#[Validate('required')]
|
#[Validate('required')]
|
||||||
public ?string $type = null;
|
public ?string $type = null;
|
||||||
|
|
||||||
@@ -51,6 +54,7 @@ class ServiceForm extends Form
|
|||||||
'url_onion' => ['nullable', 'string', 'max:255'],
|
'url_onion' => ['nullable', 'string', 'max:255'],
|
||||||
'url_i2p' => ['nullable', 'string', 'max:255'],
|
'url_i2p' => ['nullable', 'string', 'max:255'],
|
||||||
'url_pkdns' => ['nullable', 'string', 'max:255'],
|
'url_pkdns' => ['nullable', 'string', 'max:255'],
|
||||||
|
'ip' => ['nullable', 'ip', 'max:45'],
|
||||||
'contact' => ['nullable', 'string'],
|
'contact' => ['nullable', 'string'],
|
||||||
'anonymous' => ['boolean'],
|
'anonymous' => ['boolean'],
|
||||||
];
|
];
|
||||||
@@ -66,6 +70,7 @@ class ServiceForm extends Form
|
|||||||
$this->url_onion = $service->url_onion;
|
$this->url_onion = $service->url_onion;
|
||||||
$this->url_i2p = $service->url_i2p;
|
$this->url_i2p = $service->url_i2p;
|
||||||
$this->url_pkdns = $service->url_pkdns;
|
$this->url_pkdns = $service->url_pkdns;
|
||||||
|
$this->ip = $service->ip;
|
||||||
$this->type = $service->type?->value;
|
$this->type = $service->type?->value;
|
||||||
$this->contact = $service->contact;
|
$this->contact = $service->contact;
|
||||||
$this->anonymous = is_null($service->created_by);
|
$this->anonymous = is_null($service->created_by);
|
||||||
@@ -84,6 +89,7 @@ class ServiceForm extends Form
|
|||||||
'url_onion' => $this->url_onion,
|
'url_onion' => $this->url_onion,
|
||||||
'url_i2p' => $this->url_i2p,
|
'url_i2p' => $this->url_i2p,
|
||||||
'url_pkdns' => $this->url_pkdns,
|
'url_pkdns' => $this->url_pkdns,
|
||||||
|
'ip' => $this->ip,
|
||||||
'contact' => $this->contact,
|
'contact' => $this->contact,
|
||||||
'created_by' => $this->anonymous ? null : auth()->id(),
|
'created_by' => $this->anonymous ? null : auth()->id(),
|
||||||
]);
|
]);
|
||||||
@@ -102,6 +108,7 @@ class ServiceForm extends Form
|
|||||||
'url_onion' => $this->url_onion,
|
'url_onion' => $this->url_onion,
|
||||||
'url_i2p' => $this->url_i2p,
|
'url_i2p' => $this->url_i2p,
|
||||||
'url_pkdns' => $this->url_pkdns,
|
'url_pkdns' => $this->url_pkdns,
|
||||||
|
'ip' => $this->ip,
|
||||||
'contact' => $this->contact,
|
'contact' => $this->contact,
|
||||||
'created_by' => $this->anonymous ? null : ($this->service->created_by ?? auth()->id()),
|
'created_by' => $this->anonymous ? null : ($this->service->created_by ?? auth()->id()),
|
||||||
]);
|
]);
|
||||||
@@ -109,8 +116,8 @@ class ServiceForm extends Form
|
|||||||
|
|
||||||
protected function validateAtLeastOneUrl(): void
|
protected function validateAtLeastOneUrl(): void
|
||||||
{
|
{
|
||||||
if (empty($this->url_clearnet) && empty($this->url_onion) && empty($this->url_i2p) && empty($this->url_pkdns)) {
|
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 muss angegeben werden.'));
|
$this->addError('url_clearnet', __('Mindestens eine URL oder IP muss angegeben werden.'));
|
||||||
throw new \Illuminate\Validation\ValidationException(
|
throw new \Illuminate\Validation\ValidationException(
|
||||||
\Illuminate\Support\Facades\Validator::make([], [])
|
\Illuminate\Support\Facades\Validator::make([], [])
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('self_hosted_services', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -116,6 +116,13 @@ class extends Component {
|
|||||||
<flux:description>{{ __('Pkarr DNS Adresse') }}</flux:description>
|
<flux:description>{{ __('Pkarr DNS Adresse') }}</flux:description>
|
||||||
<flux:error name="form.url_pkdns"/>
|
<flux:error name="form.url_pkdns"/>
|
||||||
</flux:field>
|
</flux:field>
|
||||||
|
|
||||||
|
<flux:field>
|
||||||
|
<flux:label>{{ __('IP-Adresse') }}</flux:label>
|
||||||
|
<flux:input wire:model="form.ip" placeholder="192.168.1.1"/>
|
||||||
|
<flux:description>{{ __('IP Adresse') }}</flux:description>
|
||||||
|
<flux:error name="form.ip"/>
|
||||||
|
</flux:field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<flux:field>
|
<flux:field>
|
||||||
|
|||||||
@@ -134,6 +134,13 @@ class extends Component {
|
|||||||
<flux:description>{{ __('Pkarr DNS Adresse') }}</flux:description>
|
<flux:description>{{ __('Pkarr DNS Adresse') }}</flux:description>
|
||||||
<flux:error name="form.url_pkdns"/>
|
<flux:error name="form.url_pkdns"/>
|
||||||
</flux:field>
|
</flux:field>
|
||||||
|
|
||||||
|
<flux:field>
|
||||||
|
<flux:label>{{ __('IP-Adresse') }}</flux:label>
|
||||||
|
<flux:input wire:model="form.ip" placeholder="192.168.1.1"/>
|
||||||
|
<flux:description>{{ __('IPv4 Adresse') }}</flux:description>
|
||||||
|
<flux:error name="form.ip"/>
|
||||||
|
</flux:field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<flux:field>
|
<flux:field>
|
||||||
|
|||||||
@@ -142,6 +142,19 @@ class extends Component {
|
|||||||
</flux:link>
|
</flux:link>
|
||||||
</flux:tooltip>
|
</flux:tooltip>
|
||||||
@endif
|
@endif
|
||||||
|
@if($service->ip)
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="font-mono text-sm text-gray-700 dark:text-gray-300">
|
||||||
|
<flux:icon.server variant="mini" class="inline"/>
|
||||||
|
{{ $service->ip }}
|
||||||
|
</span>
|
||||||
|
<div x-copy-to-clipboard="'{{ $service->ip }}'">
|
||||||
|
<flux:button icon="clipboard" size="xs" variant="ghost" class="cursor-pointer">
|
||||||
|
{{ __('Copy') }}
|
||||||
|
</flux:button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</flux:table.cell>
|
</flux:table.cell>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user