Fix share assets, shared photo UI, and live show expiry
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-02-06 07:30:30 +01:00
parent 18b4f36fcf
commit b14435df8b
12 changed files with 352 additions and 85 deletions

View File

@@ -1464,8 +1464,7 @@ class EventPublicController extends BaseController
[
'slug' => $shareLink->slug,
'variant' => $variant,
],
absolute: false
]
);
}

View File

@@ -212,6 +212,10 @@ class LiveShowController extends BaseController
return Event::query()
->where('live_show_token', $token)
->where(function (Builder $query) {
$query->whereNull('live_show_token_expires_at')
->orWhere('live_show_token_expires_at', '>=', now());
})
->first();
}

View File

@@ -53,6 +53,7 @@ class LiveShowLinkController extends Controller
'url' => $url,
'qr_code_data_url' => $this->buildQrCodeDataUrl($url),
'rotated_at' => $event->live_show_token_rotated_at?->toIso8601String(),
'expires_at' => $event->live_show_token_expires_at?->toIso8601String(),
];
}

View File

@@ -24,6 +24,7 @@ class Event extends Model
'name' => 'array',
'description' => 'array',
'live_show_token_rotated_at' => 'datetime',
'live_show_token_expires_at' => 'datetime',
];
protected static function booted(): void
@@ -47,6 +48,7 @@ class Event extends Model
}
app(EventJoinTokenService::class)->extendExpiryForEvent($event);
$event->refreshLiveShowTokenExpiry();
});
}
@@ -164,6 +166,8 @@ class Event extends Model
public function ensureLiveShowToken(): string
{
if (is_string($this->live_show_token) && $this->live_show_token !== '') {
$this->refreshLiveShowTokenExpiry();
return $this->live_show_token;
}
@@ -179,11 +183,34 @@ class Event extends Model
$this->forceFill([
'live_show_token' => $token,
'live_show_token_rotated_at' => now(),
'live_show_token_expires_at' => $this->computeLiveShowTokenExpiry(),
])->save();
return $token;
}
public function refreshLiveShowTokenExpiry(): void
{
if (! is_string($this->live_show_token) || $this->live_show_token === '') {
return;
}
$this->forceFill([
'live_show_token_expires_at' => $this->computeLiveShowTokenExpiry(),
])->saveQuietly();
}
private function computeLiveShowTokenExpiry(): \Carbon\CarbonInterface
{
$eventDate = $this->date;
if ($eventDate instanceof \Carbon\CarbonInterface) {
return $eventDate->copy()->addDay()->endOfDay();
}
return now()->addDay();
}
public function getSettingsAttribute($value): array
{
if (is_array($value)) {