Replace sparkbooth upload with photobooth uploader

This commit is contained in:
soeren
2026-01-29 12:16:27 +01:00
parent e37f533bcb
commit 084c52ba2d
27 changed files with 2163 additions and 50 deletions

View File

@@ -13,7 +13,7 @@ use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Table;
use UnitEnum;
class SparkboothConnections extends Page implements HasTable
class PhotoboothConnections extends Page implements HasTable
{
use InteractsWithTable;
@@ -23,16 +23,16 @@ class SparkboothConnections extends Page implements HasTable
protected static ?int $navigationSort = 11;
protected static ?string $title = 'Sparkbooth Verbindungen';
protected static ?string $title = 'Photobooth Verbindungen';
protected ?string $heading = 'Sparkbooth Verbindungen';
protected ?string $heading = 'Photobooth Verbindungen';
protected string $view = 'filament.pages.sparkbooth-connections';
protected string $view = 'filament.pages.photobooth-connections';
public function table(Table $table): Table
{
return $table
->heading('Vorhandene Sparkbooth-Verbindungen')
->heading('Vorhandene Photobooth-Verbindungen')
->query(
Gallery::query()
->whereNotNull('upload_token_hash')
@@ -73,7 +73,7 @@ class SparkboothConnections extends Page implements HasTable
$data = [
'gallery' => $record->only(['id', 'name', 'slug', 'images_path']),
'upload_token' => $plainToken,
'upload_url' => route('api.sparkbooth.upload'),
'upload_url' => route('api.photobooth.upload'),
'gallery_url' => route('gallery.show', $record),
'sparkbooth_username' => $record->sparkbooth_username,
'sparkbooth_password' => $record->sparkbooth_password,
@@ -86,26 +86,26 @@ class SparkboothConnections extends Page implements HasTable
->success()
->send();
return view('filament.pages.partials.sparkbooth-token', $data);
return view('filament.pages.partials.photobooth-token', $data);
}),
Action::make('deleteConnection')
->label('Verbindung loeschen')
->icon('heroicon-o-trash')
->color('danger')
->requiresConfirmation()
->modalHeading('Sparkbooth-Verbindung entfernen')
->modalHeading('Photobooth-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.')
->title('Photobooth-Verbindung entfernt.')
->body('Der Upload-Token und die Zugangsdaten wurden geloescht.')
->success()
->send();
}),
])
->emptyStateHeading('Keine Sparkbooth-Verbindungen')
->emptyStateHeading('Keine Photobooth-Verbindungen')
->emptyStateDescription('Lege eine neue Verbindung an oder aktiviere Uploads fuer eine Galerie.');
}
}

View File

@@ -15,7 +15,7 @@ use Filament\Schemas\Schema;
use Illuminate\Support\Str;
use UnitEnum;
class SparkboothSetup extends Page implements HasForms
class PhotoboothSetup extends Page implements HasForms
{
use InteractsWithForms;
@@ -25,7 +25,7 @@ class SparkboothSetup extends Page implements HasForms
protected static ?int $navigationSort = 10;
protected string $view = 'filament.pages.sparkbooth-setup';
protected string $view = 'filament.pages.photobooth-setup';
public ?array $data = [];
@@ -33,7 +33,7 @@ class SparkboothSetup extends Page implements HasForms
public function getTitle(): string
{
return 'Sparkbooth Setup';
return 'Photobooth Setup';
}
public function form(Schema $schema): Schema
@@ -64,8 +64,8 @@ class SparkboothSetup extends Page implements HasForms
->label('Uploads aktivieren')
->default(true),
TextInput::make('sparkbooth_username')
->label('Sparkbooth Benutzername')
->helperText('Wird in Sparkbooth unter „Username“ eingetragen. Erlaubt sind Buchstaben, Zahlen sowie ._-')
->label('Photobooth Benutzername')
->helperText('Wird im Photobooth Uploader unter „Benutzername“ eingetragen. Erlaubt sind Buchstaben, Zahlen sowie ._-')
->default(fn (): string => 'spark-'.Str::lower(Str::random(6)))
->required()
->maxLength(64)
@@ -73,7 +73,7 @@ class SparkboothSetup extends Page implements HasForms
->unique(table: Gallery::class, column: 'sparkbooth_username'),
Select::make('sparkbooth_response_format')
->label('Standard-Antwortformat')
->helperText('Sparkbooth kann JSON oder XML erwarten. JSON ist empfohlen.')
->helperText('Der Photobooth Uploader kann JSON oder XML erwarten. JSON ist empfohlen.')
->options([
'json' => 'JSON',
'xml' => 'XML',
@@ -113,7 +113,7 @@ class SparkboothSetup extends Page implements HasForms
$this->result = [
'gallery' => $gallery->only(['id', 'name', 'slug', 'images_path']),
'upload_token' => $plainToken,
'upload_url' => route('api.sparkbooth.upload'),
'upload_url' => route('api.photobooth.upload'),
'gallery_url' => route('gallery.show', $gallery),
'sparkbooth_username' => $sparkboothUsername,
'sparkbooth_password' => $sparkboothPassword,

View File

@@ -79,14 +79,14 @@ class GalleryForm
'url' => $record ? URL::route('gallery.show', $record) : null,
]),
]),
Tab::make('Sparkbooth')
Tab::make('Photobooth')
->schema([
Section::make('Sparkbooth Upload')
Section::make('Photobooth Upload')
->columns(2)
->schema([
Toggle::make('upload_enabled')
->label('Uploads aktivieren')
->helperText('Steuert, ob Sparkbooth-Uploads erlaubt sind.')
->helperText('Steuert, ob Photobooth-Uploads erlaubt sind.')
->default(false),
Select::make('sparkbooth_response_format')
->label('Standard-Antwortformat')
@@ -96,25 +96,25 @@ class GalleryForm
])
->default('json'),
TextInput::make('sparkbooth_username')
->label('Sparkbooth Benutzername')
->helperText('Wird in Sparkbooth unter „Username“ eingetragen. Erlaubt sind Buchstaben, Zahlen sowie ._-')
->label('Photobooth Benutzername')
->helperText('Wird im Photobooth Uploader unter „Benutzername“ 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)')
->label('Photobooth 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')
View::make('filament.pages.partials.photobooth-token')
->columnSpanFull()
->visible(fn (?object $record) => (bool) $record?->id)
->viewData(fn (?object $record) => [
'upload_url' => URL::route('api.sparkbooth.upload'),
'upload_url' => URL::route('api.photobooth.upload'),
'gallery_url' => $record ? URL::route('gallery.show', $record) : null,
'sparkbooth_username' => $record?->sparkbooth_username,
'sparkbooth_password' => $record?->sparkbooth_password,