geschenkgutscheine implementiert ("Paket verschenken"). Neuer Upload-Provider: Sparkbooth.
This commit is contained in:
@@ -20,22 +20,50 @@ class PhotoboothStatusResource extends JsonResource
|
||||
/** @var PhotoboothSetting $settings */
|
||||
$settings = $payload['settings'];
|
||||
|
||||
$password = $event->getAttribute('plain_photobooth_password') ?? $event->photobooth_password;
|
||||
$mode = $event->photobooth_mode ?? 'ftp';
|
||||
$isSparkbooth = $mode === 'sparkbooth';
|
||||
|
||||
$password = $isSparkbooth
|
||||
? $event->getAttribute('plain_sparkbooth_password') ?? $event->sparkbooth_password
|
||||
: $event->getAttribute('plain_photobooth_password') ?? $event->photobooth_password;
|
||||
|
||||
$activeUsername = $isSparkbooth ? $event->sparkbooth_username : $event->photobooth_username;
|
||||
$activeStatus = $isSparkbooth ? $event->sparkbooth_status : $event->photobooth_status;
|
||||
$activeExpires = $isSparkbooth ? $event->sparkbooth_expires_at : $event->photobooth_expires_at;
|
||||
|
||||
$sparkMetrics = [
|
||||
'last_upload_at' => optional($event->sparkbooth_last_upload_at)->toIso8601String(),
|
||||
'uploads_24h' => (int) ($event->sparkbooth_uploads_last_24h ?? 0),
|
||||
'uploads_total' => (int) ($event->sparkbooth_uploads_total ?? 0),
|
||||
];
|
||||
|
||||
return [
|
||||
'mode' => $mode,
|
||||
'enabled' => (bool) $event->photobooth_enabled,
|
||||
'status' => $event->photobooth_status,
|
||||
'username' => $event->photobooth_username,
|
||||
'status' => $activeStatus,
|
||||
'username' => $activeUsername,
|
||||
'password' => $password,
|
||||
'path' => $event->photobooth_path,
|
||||
'ftp_url' => $this->buildFtpUrl($event, $settings, $password),
|
||||
'expires_at' => optional($event->photobooth_expires_at)->toIso8601String(),
|
||||
'ftp_url' => $isSparkbooth ? null : $this->buildFtpUrl($event, $settings, $password),
|
||||
'upload_url' => $isSparkbooth ? route('api.v1.photobooth.sparkbooth.upload') : null,
|
||||
'expires_at' => optional($activeExpires)->toIso8601String(),
|
||||
'rate_limit_per_minute' => (int) $settings->rate_limit_per_minute,
|
||||
'ftp' => [
|
||||
'host' => config('photobooth.ftp.host'),
|
||||
'port' => $settings->ftp_port,
|
||||
'require_ftps' => (bool) $settings->require_ftps,
|
||||
],
|
||||
'metrics' => $isSparkbooth ? $sparkMetrics : null,
|
||||
'sparkbooth' => [
|
||||
'enabled' => $mode === 'sparkbooth' && $event->photobooth_enabled,
|
||||
'status' => $event->sparkbooth_status,
|
||||
'username' => $event->sparkbooth_username,
|
||||
'password' => $event->getAttribute('plain_sparkbooth_password') ?? $event->sparkbooth_password,
|
||||
'expires_at' => optional($event->sparkbooth_expires_at)->toIso8601String(),
|
||||
'upload_url' => route('api.v1.photobooth.sparkbooth.upload'),
|
||||
'response_format' => $event->photobooth_metadata['sparkbooth_response_format'] ?? config('photobooth.sparkbooth.response_format', 'json'),
|
||||
'metrics' => $sparkMetrics,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user