added a sparkbooth section to gallery form, connection details reside there now.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -4,9 +4,9 @@ namespace App\Filament\Pages;
|
|||||||
|
|
||||||
use App\Models\Gallery;
|
use App\Models\Gallery;
|
||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
|
use Filament\Actions\Action;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Pages\Page;
|
use Filament\Pages\Page;
|
||||||
use Filament\Actions\Action;
|
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Concerns\InteractsWithTable;
|
use Filament\Tables\Concerns\InteractsWithTable;
|
||||||
use Filament\Tables\Contracts\HasTable;
|
use Filament\Tables\Contracts\HasTable;
|
||||||
@@ -88,11 +88,24 @@ class SparkboothConnections extends Page implements HasTable
|
|||||||
|
|
||||||
return view('filament.pages.partials.sparkbooth-token', $data);
|
return view('filament.pages.partials.sparkbooth-token', $data);
|
||||||
}),
|
}),
|
||||||
|
Action::make('deleteConnection')
|
||||||
|
->label('Verbindung loeschen')
|
||||||
|
->icon('heroicon-o-trash')
|
||||||
|
->color('danger')
|
||||||
|
->requiresConfirmation()
|
||||||
|
->modalHeading('Sparkbooth-Verbindung entfernen')
|
||||||
|
->modalDescription('Die Galerie bleibt erhalten, aber Upload-Token und Zugangsdaten werden geloescht.')
|
||||||
|
->action(function (Gallery $record): void {
|
||||||
|
$record->clearSparkboothConnection();
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Sparkbooth-Verbindung entfernt.')
|
||||||
|
->body('Der Upload-Token und die Zugangsdaten wurden geloescht.')
|
||||||
|
->success()
|
||||||
|
->send();
|
||||||
|
}),
|
||||||
])
|
])
|
||||||
->emptyStateHeading('Keine Sparkbooth-Verbindungen')
|
->emptyStateHeading('Keine Sparkbooth-Verbindungen')
|
||||||
->emptyStateDescription('Lege eine neue Verbindung an oder aktiviere Uploads fuer eine Galerie.');
|
->emptyStateDescription('Lege eine neue Verbindung an oder aktiviere Uploads fuer eine Galerie.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ class GalleryResource extends Resource
|
|||||||
public static function mutateFormDataBeforeCreate(array $data): array
|
public static function mutateFormDataBeforeCreate(array $data): array
|
||||||
{
|
{
|
||||||
$data = self::mutatePassword($data);
|
$data = self::mutatePassword($data);
|
||||||
|
$data = self::mutateSparkbooth($data, true);
|
||||||
$data['slug'] = $data['slug'] ?: Str::uuid()->toString();
|
$data['slug'] = $data['slug'] ?: Str::uuid()->toString();
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@@ -67,6 +68,7 @@ class GalleryResource extends Resource
|
|||||||
public static function mutateFormDataBeforeSave(array $data): array
|
public static function mutateFormDataBeforeSave(array $data): array
|
||||||
{
|
{
|
||||||
$data = self::mutatePassword($data);
|
$data = self::mutatePassword($data);
|
||||||
|
$data = self::mutateSparkbooth($data);
|
||||||
$data['slug'] = $data['slug'] ?: Str::uuid()->toString();
|
$data['slug'] = $data['slug'] ?: Str::uuid()->toString();
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@@ -83,4 +85,24 @@ class GalleryResource extends Resource
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function mutateSparkbooth(array $data, bool $isCreate = false): array
|
||||||
|
{
|
||||||
|
if (array_key_exists('sparkbooth_username', $data)) {
|
||||||
|
$data['sparkbooth_username'] = $data['sparkbooth_username']
|
||||||
|
? Str::of($data['sparkbooth_username'])->lower()->trim()->value()
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$password = $data['sparkbooth_password'] ?? null;
|
||||||
|
unset($data['sparkbooth_password']);
|
||||||
|
|
||||||
|
if (! empty($password)) {
|
||||||
|
$data['sparkbooth_password'] = $password;
|
||||||
|
} elseif ($isCreate && empty($password)) {
|
||||||
|
$data['sparkbooth_password'] = Str::random(24);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,71 +3,125 @@
|
|||||||
namespace App\Filament\Resources\Galleries\Schemas;
|
namespace App\Filament\Resources\Galleries\Schemas;
|
||||||
|
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Components\Toggle;
|
use Filament\Forms\Components\Toggle;
|
||||||
use Filament\Schemas\Components\Section;
|
use Filament\Schemas\Components\Section;
|
||||||
|
use Filament\Schemas\Components\Tabs;
|
||||||
|
use Filament\Schemas\Components\Tabs\Tab;
|
||||||
use Filament\Schemas\Components\View;
|
use Filament\Schemas\Components\View;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Illuminate\Support\Facades\URL;
|
use Illuminate\Support\Facades\URL;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class GalleryForm
|
class GalleryForm
|
||||||
{
|
{
|
||||||
public static function configure(Schema $schema): Schema
|
public static function configure(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
|
->columns(1)
|
||||||
->components([
|
->components([
|
||||||
Section::make('Details')
|
Tabs::make('gallery_tabs')
|
||||||
->columns(2)
|
->tabs([
|
||||||
->schema([
|
Tab::make('Galerie')
|
||||||
TextInput::make('name')
|
->schema([
|
||||||
->label('Name')
|
Section::make('Details')
|
||||||
->required(),
|
->columns(2)
|
||||||
TextInput::make('slug')
|
->schema([
|
||||||
->label('Slug')
|
TextInput::make('name')
|
||||||
->disabled()
|
->label('Name')
|
||||||
->dehydrated(true)
|
->required(),
|
||||||
->helperText('Wird automatisch erzeugt'),
|
TextInput::make('slug')
|
||||||
TextInput::make('title')
|
->label('Slug')
|
||||||
->label('Titel')
|
->disabled()
|
||||||
->required(),
|
->dehydrated(true)
|
||||||
TextInput::make('images_path')
|
->helperText('Wird automatisch erzeugt'),
|
||||||
->label('Bilder-Pfad')
|
TextInput::make('title')
|
||||||
->helperText('Relativer Pfad unter public/storage')
|
->label('Titel')
|
||||||
->required(),
|
->required(),
|
||||||
Toggle::make('is_public')
|
TextInput::make('images_path')
|
||||||
->label('Öffentlich')
|
->label('Bilder-Pfad')
|
||||||
->default(true),
|
->helperText('Relativer Pfad unter public/storage')
|
||||||
Toggle::make('allow_ai_styles')
|
->required(),
|
||||||
->label('AI-Stile erlauben')
|
Toggle::make('is_public')
|
||||||
->default(true),
|
->label('Öffentlich')
|
||||||
Toggle::make('allow_print')
|
->default(true),
|
||||||
->label('Drucken erlauben')
|
Toggle::make('allow_ai_styles')
|
||||||
->default(true),
|
->label('AI-Stile erlauben')
|
||||||
Toggle::make('require_password')
|
->default(true),
|
||||||
->label('Passwortschutz aktiv')
|
Toggle::make('allow_print')
|
||||||
->default(false),
|
->label('Drucken erlauben')
|
||||||
TextInput::make('password')
|
->default(true),
|
||||||
->label('Neues Passwort')
|
Toggle::make('require_password')
|
||||||
->password()
|
->label('Passwortschutz aktiv')
|
||||||
->revealable()
|
->default(false),
|
||||||
->dehydrated(false)
|
TextInput::make('password')
|
||||||
->helperText('Leer lassen, um das bestehende Passwort zu behalten.'),
|
->label('Neues Passwort')
|
||||||
DateTimePicker::make('expires_at')
|
->password()
|
||||||
->label('Ablaufdatum')
|
->revealable()
|
||||||
->native(false)
|
->dehydrated(false)
|
||||||
->seconds(false),
|
->helperText('Leer lassen, um das bestehende Passwort zu behalten.'),
|
||||||
TextInput::make('access_duration_minutes')
|
DateTimePicker::make('expires_at')
|
||||||
->label('Zugriffsdauer (Minuten)')
|
->label('Ablaufdatum')
|
||||||
->numeric()
|
->native(false)
|
||||||
->minValue(1)
|
->seconds(false),
|
||||||
->nullable()
|
TextInput::make('access_duration_minutes')
|
||||||
->helperText('Optional: Zeitfenster nach dem ersten Unlock.'),
|
->label('Zugriffsdauer (Minuten)')
|
||||||
]),
|
->numeric()
|
||||||
View::make('filament.components.gallery-link')
|
->minValue(1)
|
||||||
->columnSpanFull()
|
->nullable()
|
||||||
->visible(fn (?object $record) => (bool) $record?->id)
|
->helperText('Optional: Zeitfenster nach dem ersten Unlock.'),
|
||||||
->viewData(fn (?object $record) => [
|
]),
|
||||||
'url' => $record ? URL::route('gallery.show', $record) : null,
|
View::make('filament.components.gallery-link')
|
||||||
|
->columnSpanFull()
|
||||||
|
->visible(fn (?object $record) => (bool) $record?->id)
|
||||||
|
->viewData(fn (?object $record) => [
|
||||||
|
'url' => $record ? URL::route('gallery.show', $record) : null,
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
Tab::make('Sparkbooth')
|
||||||
|
->schema([
|
||||||
|
Section::make('Sparkbooth Upload')
|
||||||
|
->columns(2)
|
||||||
|
->schema([
|
||||||
|
Toggle::make('upload_enabled')
|
||||||
|
->label('Uploads aktivieren')
|
||||||
|
->helperText('Steuert, ob Sparkbooth-Uploads erlaubt sind.')
|
||||||
|
->default(false),
|
||||||
|
Select::make('sparkbooth_response_format')
|
||||||
|
->label('Standard-Antwortformat')
|
||||||
|
->options([
|
||||||
|
'json' => 'JSON',
|
||||||
|
'xml' => 'XML',
|
||||||
|
])
|
||||||
|
->default('json'),
|
||||||
|
TextInput::make('sparkbooth_username')
|
||||||
|
->label('Sparkbooth Benutzername')
|
||||||
|
->helperText('Wird in Sparkbooth unter „Username“ eingetragen. Erlaubt sind Buchstaben, Zahlen sowie ._-')
|
||||||
|
->maxLength(64)
|
||||||
|
->rule('regex:/^[A-Za-z0-9._-]+$/')
|
||||||
|
->unique(table: \App\Models\Gallery::class, column: 'sparkbooth_username', ignoreRecord: true)
|
||||||
|
->dehydrateStateUsing(fn (?string $state): ?string => $state ? Str::of($state)->lower()->trim()->value() : null),
|
||||||
|
TextInput::make('sparkbooth_password')
|
||||||
|
->label('Sparkbooth Passwort (neu)')
|
||||||
|
->password()
|
||||||
|
->revealable()
|
||||||
|
->dehydrated(false)
|
||||||
|
->afterStateHydrated(fn (callable $set) => $set('sparkbooth_password', null))
|
||||||
|
->helperText('Leer lassen, um das bestehende Passwort zu behalten.'),
|
||||||
|
]),
|
||||||
|
View::make('filament.pages.partials.sparkbooth-token')
|
||||||
|
->columnSpanFull()
|
||||||
|
->visible(fn (?object $record) => (bool) $record?->id)
|
||||||
|
->viewData(fn (?object $record) => [
|
||||||
|
'upload_url' => URL::route('api.sparkbooth.upload'),
|
||||||
|
'gallery_url' => $record ? URL::route('gallery.show', $record) : null,
|
||||||
|
'sparkbooth_username' => $record?->sparkbooth_username,
|
||||||
|
'sparkbooth_password' => $record?->sparkbooth_password,
|
||||||
|
'response_format' => $record?->sparkbooth_response_format,
|
||||||
|
'gallery' => $record ? $record->only(['slug', 'images_path']) : null,
|
||||||
|
]),
|
||||||
|
]),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,4 +74,15 @@ class Gallery extends Model
|
|||||||
|
|
||||||
return $password;
|
return $password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clearSparkboothConnection(): void
|
||||||
|
{
|
||||||
|
$this->forceFill([
|
||||||
|
'upload_token_hash' => null,
|
||||||
|
'upload_token_expires_at' => null,
|
||||||
|
'sparkbooth_username' => null,
|
||||||
|
'sparkbooth_password' => null,
|
||||||
|
'upload_enabled' => false,
|
||||||
|
])->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ class GallerySeeder extends Seeder
|
|||||||
$settings = app(GeneralSettings::class);
|
$settings = app(GeneralSettings::class);
|
||||||
|
|
||||||
Gallery::firstOrCreate(
|
Gallery::firstOrCreate(
|
||||||
['slug' => Str::uuid()->toString()],
|
['images_path' => 'uploads'],
|
||||||
[
|
[
|
||||||
|
'slug' => Str::uuid()->toString(),
|
||||||
'name' => 'Default Gallery',
|
'name' => 'Default Gallery',
|
||||||
'title' => $settings->gallery_heading ?? 'Style Gallery',
|
'title' => $settings->gallery_heading ?? 'Style Gallery',
|
||||||
'images_path' => 'uploads',
|
|
||||||
'is_public' => true,
|
'is_public' => true,
|
||||||
'allow_ai_styles' => true,
|
'allow_ai_styles' => true,
|
||||||
'allow_print' => true,
|
'allow_print' => true,
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use App\Models\Role;
|
use App\Models\Role;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class RoleSeeder extends Seeder
|
class RoleSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@@ -13,7 +12,7 @@ class RoleSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
Role::create(['name' => 'admin']);
|
Role::firstOrCreate(['name' => 'admin']);
|
||||||
Role::create(['name' => 'user']);
|
Role::firstOrCreate(['name' => 'user']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
class UserSeeder extends Seeder
|
class UserSeeder extends Seeder
|
||||||
@@ -14,11 +13,15 @@ class UserSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
User::create([
|
$role = \App\Models\Role::firstOrCreate(['name' => 'admin']);
|
||||||
'name' => 'admin',
|
|
||||||
'email' => 'admin@admin.com',
|
User::updateOrCreate(
|
||||||
'password' => Hash::make('admin'),
|
['email' => 'admin@admin.com'],
|
||||||
'role_id' => 1
|
[
|
||||||
]);
|
'name' => 'admin',
|
||||||
|
'password' => Hash::make('admin'),
|
||||||
|
'role_id' => $role->id,
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,62 +1,69 @@
|
|||||||
|
@php
|
||||||
|
$uploadUrl = $upload_url ?? null;
|
||||||
|
$galleryUrl = $gallery_url ?? null;
|
||||||
|
$username = $sparkbooth_username ?? '—';
|
||||||
|
$password = $sparkbooth_password ?? '—';
|
||||||
|
$format = strtoupper($response_format ?? 'JSON');
|
||||||
|
$imagesPath = $gallery['images_path'] ?? 'uploads';
|
||||||
|
@endphp
|
||||||
|
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Upload Endpoint</p>
|
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Upload Endpoint</p>
|
||||||
<p class="mt-1 break-all font-semibold text-gray-900 dark:text-white">{{ $upload_url }}</p>
|
<p class="mt-1 break-all font-semibold text-gray-900 dark:text-white">{{ $uploadUrl }}</p>
|
||||||
|
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">Methode: POST (multipart/form-data) mit Username/Password.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-4 md:grid-cols-2">
|
<div class="grid gap-4 md:grid-cols-2">
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Sparkbooth Benutzername</p>
|
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Sparkbooth Benutzername</p>
|
||||||
<p class="mt-1 break-all font-mono text-sm text-gray-900 dark:text-white">{{ $sparkbooth_username ?? '—' }}</p>
|
<p class="mt-1 break-all font-mono text-sm text-gray-900 dark:text-white">{{ $username }}</p>
|
||||||
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">Eintragen im Sparkbooth Custom Upload Dialog unter „Username“.</p>
|
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">Eintragen im Sparkbooth Custom Upload Dialog unter „Username“.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Sparkbooth Passwort</p>
|
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Sparkbooth Passwort</p>
|
||||||
<p class="mt-1 break-all font-mono text-sm text-gray-900 dark:text-white">{{ $sparkbooth_password ?? '—' }}</p>
|
<p class="mt-1 break-all font-mono text-sm text-gray-900 dark:text-white">{{ $password }}</p>
|
||||||
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">Eintragen unter „Password“.</p>
|
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">Eintragen unter „Password“.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-4 md:grid-cols-2">
|
<div class="grid gap-4 md:grid-cols-2">
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Galerie-Link</p>
|
|
||||||
<p class="mt-1 break-all font-semibold text-gray-900 dark:text-white">{{ $gallery_url }}</p>
|
|
||||||
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">Slug: {{ $gallery['slug'] }}, Pfad: storage/{{ $gallery['images_path'] }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Antwortformat</p>
|
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Antwortformat</p>
|
||||||
<p class="mt-1 font-semibold text-gray-900 dark:text-white">{{ strtoupper($response_format ?? 'JSON') }}</p>
|
<p class="mt-1 font-semibold text-gray-900 dark:text-white">{{ $format }}</p>
|
||||||
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">Muss mit „JSON Response“ oder „XML Response“ in Sparkbooth übereinstimmen.</p>
|
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">In Sparkbooth „JSON Response“ oder „XML Response“ passend auswählen.</p>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid gap-4 md:grid-cols-2">
|
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Legacy Upload Token</p>
|
|
||||||
<p class="mt-1 break-all font-mono text-sm text-gray-900 dark:text-white">{{ $upload_token }}</p>
|
|
||||||
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">Optionales Secret (Feld „token“) für ältere Integrationen.</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Sparkbooth Hinweise</p>
|
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Sparkbooth Hinweise</p>
|
||||||
<ul class="mt-2 list-disc space-y-1 pl-4 text-xs text-gray-600 dark:text-gray-300">
|
<ul class="mt-2 list-disc space-y-1 pl-4 text-xs text-gray-600 dark:text-gray-300">
|
||||||
<li>Uploader „Custom Upload“ wählen.</li>
|
<li>Uploader „Custom Upload“ wählen.</li>
|
||||||
<li>Username & Password wie oben eintragen.</li>
|
<li>Username & Password wie oben eintragen.</li>
|
||||||
<li>Falls JSON Response aktiviert ist, hier ebenfalls JSON wählen (gleiches gilt für XML).</li>
|
<li>Optional: Name/Email/Message Felder in Sparkbooth setzen.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
||||||
|
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Beispiel (curl)</p>
|
||||||
|
<pre class="mt-2 rounded-xl border border-gray-200 bg-gray-900 p-4 text-xs text-gray-100 dark:border-white/10">curl -X POST {{ $uploadUrl }} \
|
||||||
|
-F "media=@/pfad/zum/foto.jpg" \
|
||||||
|
-F "username={{ $username }}" \
|
||||||
|
-F "password={{ $password }}" \
|
||||||
|
-F "response_format={{ strtolower($format) }}" \
|
||||||
|
-F "name=Guest" \
|
||||||
|
-F "message=Hallo von der Fotobox"</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-4 md:grid-cols-2">
|
<div class="grid gap-4 md:grid-cols-2">
|
||||||
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
||||||
|
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Galerie-Link</p>
|
||||||
|
<p class="mt-1 break-all font-semibold text-gray-900 dark:text-white">{{ $galleryUrl }}</p>
|
||||||
|
<p class="mt-2 text-xs text-gray-500 dark:text-gray-300">Slug: {{ $gallery['slug'] ?? '—' }}, Pfad: storage/{{ $imagesPath }}</p>
|
||||||
|
</div>
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">QR Code (Galerie)</p>
|
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">QR Code (Galerie)</p>
|
||||||
<div class="mt-2 rounded-lg border border-gray-200 bg-white p-2 shadow-sm dark:border-white/20 dark:bg-white/5">
|
<div class="mt-2 rounded-lg border border-gray-200 bg-white p-2 shadow-sm dark:border-white/20 dark:bg-white/5">
|
||||||
{!! \SimpleSoftwareIO\QrCode\Facades\QrCode::size(200)->margin(1)->generate($gallery_url) !!}
|
{!! \SimpleSoftwareIO\QrCode\Facades\QrCode::size(200)->margin(1)->generate($galleryUrl) !!}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">QR Code (Upload)</p>
|
|
||||||
<div class="mt-2 rounded-lg border border-gray-200 bg-white p-2 shadow-sm dark:border-white/20 dark:bg-white/5">
|
|
||||||
{!! \SimpleSoftwareIO\QrCode\Facades\QrCode::size(200)->margin(1)->generate($upload_url.'?token='.$upload_token) !!}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -63,10 +63,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-white/5">
|
||||||
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">QR Code (Upload)</p>
|
<p class="text-xs uppercase tracking-[0.3em] text-gray-500 dark:text-gray-300">Legacy Upload (Token)</p>
|
||||||
<div class="mt-2 rounded-lg border border-gray-200 bg-white p-2 shadow-sm dark:border-white/20 dark:bg-white/5">
|
<p class="mt-1 text-xs text-gray-500 dark:text-gray-300">Nur falls eine alte Integration noch Token statt Username/Password nutzt.</p>
|
||||||
{!! \SimpleSoftwareIO\QrCode\Facades\QrCode::size(200)->margin(1)->generate($result['upload_url'].'?token='.$result['upload_token']) !!}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
53
tests/Feature/Filament/SparkboothConnectionsTest.php
Normal file
53
tests/Feature/Filament/SparkboothConnectionsTest.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Filament;
|
||||||
|
|
||||||
|
use App\Filament\Pages\SparkboothConnections;
|
||||||
|
use App\Models\Gallery;
|
||||||
|
use App\Models\Role;
|
||||||
|
use App\Models\User;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Livewire\Livewire;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class SparkboothConnectionsTest extends TestCase
|
||||||
|
{
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
public function test_admin_can_delete_connection_without_deleting_gallery(): void
|
||||||
|
{
|
||||||
|
$adminRole = Role::create(['name' => 'Admin']);
|
||||||
|
Role::create(['name' => 'User']);
|
||||||
|
|
||||||
|
$admin = User::factory()->create([
|
||||||
|
'role_id' => $adminRole->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->actingAs($admin);
|
||||||
|
Filament::setCurrentPanel('admin');
|
||||||
|
|
||||||
|
$gallery = Gallery::factory()->create([
|
||||||
|
'upload_enabled' => true,
|
||||||
|
'sparkbooth_username' => 'spark-test',
|
||||||
|
'sparkbooth_password' => 'secret-123',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$gallery->setUploadToken('tokentest');
|
||||||
|
$gallery->save();
|
||||||
|
|
||||||
|
Livewire::test(SparkboothConnections::class)
|
||||||
|
->callTableAction('deleteConnection', $gallery);
|
||||||
|
|
||||||
|
$updated = $gallery->fresh();
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('galleries', ['id' => $gallery->id]);
|
||||||
|
$this->assertNotNull($updated);
|
||||||
|
$this->assertNull($updated->upload_token_hash);
|
||||||
|
$this->assertNull($updated->upload_token_expires_at);
|
||||||
|
$this->assertNull($updated->sparkbooth_username);
|
||||||
|
$this->assertNull($updated->sparkbooth_password);
|
||||||
|
$this->assertFalse($updated->upload_enabled);
|
||||||
|
$this->assertSame(0, Gallery::query()->whereNotNull('upload_token_hash')->count());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user