Hauptadresse statt Zweitadresse, Abspielgeschwindigkeit je Video

- Weitere Adressen einer Website (z. B. www.stommer.info) leiten per 301 auf die
  Hauptadresse um; vorher blockierte der Browser Skripte, Schriften und Videos,
  die von der Hauptadresse kamen (kein Titelvideo, Ersatzschrift)
- Site::origin() nimmt verbindlich das Feld domain
- Videos: Abspielgeschwindigkeit 0,5x bis 1x, gilt im Titelbereich und Rundgang

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-10-30 11:30:42 +01:00
1 parent b5ff837dcd
commit cc47cac93e
14 files changed
+113 -16

No files matched your search

+3 -2
View File
@@ -54,11 +54,12 @@ public function domains(): HasMany
}
/**
* Scheme and host for guest links. Empty while the website has no hostname yet.
* Scheme and main host for guest links (the domain field; further addresses redirect there, see
* ResolveTheme). Empty while the website has no hostname yet.
*/
public function origin(): ?string
{
$host = $this->domains()->value('host') ?: $this->domain;
$host = $this->domain ?: $this->domains()->orderBy('id')->value('host');
if (! is_string($host) || $host === '') {
return null;
+13 -1
View File
@@ -19,7 +19,7 @@
*
* @property list<array{at?: string, label?: string, room?: string|null}>|null $chapters
*/
#[Fillable(['property_id', 'title', 'chapters'])]
#[Fillable(['property_id', 'title', 'chapters', 'playback_rate'])]
class Video extends Model implements HasMedia
{
/** @use HasFactory<VideoFactory> */
@@ -29,6 +29,9 @@ class Video extends Model implements HasMedia
public const POSTER = 'poster';
/** Speeds offered in the admin (rate => label); the browser plays the file at this speed everywhere. */
public const PLAYBACK_RATES = ['0.5' => 'Halb so schnell (0,5×)', '0.6' => 'Sehr ruhig (0,6×)', '0.75' => 'Ruhig (0,75×)', '0.85' => 'Etwas langsamer (0,85×)', '1' => 'Original (1×)'];
/** Largest accepted video file in KB (Strato allows uploads up to 128 MB). */
public const MAX_KB = 100 * 1024;
@@ -41,6 +44,7 @@ protected function casts(): array
{
return [
'chapters' => 'array',
'playback_rate' => 'float',
];
}
@@ -79,6 +83,14 @@ public function url(): ?string
return $this->getFirstMediaUrl(self::COLLECTION) ?: null;
}
/**
* Playback speed for the browser, limited to 0.25–2; chapter times stay in video time.
*/
public function playbackRate(): float
{
return min(2.0, max(0.25, (float) ($this->playback_rate ?: 1)));
}
public function mimeType(): string
{
return $this->getFirstMedia(self::COLLECTION)?->mime_type ?? 'video/mp4';