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

+23
View File
@@ -9,6 +9,7 @@
use App\Themes\Theme;
use App\Themes\ThemeFactory;
use Closure;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
use Symfony\Component\HttpFoundation\Response;
@@ -44,11 +45,33 @@ public function handle(Request $request, Closure $next): Response
$context->set($tenant);
}
if ($redirect = $this->toMainAddress($request, $theme->site)) {
return $redirect;
}
$this->useSiteOrigin($theme->site);
return $next($request);
}
/**
* A website answers on one main address. Visitors coming in through a further address (e.g. www.…) are
* sent there permanently – otherwise the page would load its scripts, fonts and videos from the main
* address, which the browser treats as another origin and blocks (no JavaScript, fallback fonts).
* Only GET/HEAD: a form sent to the other address must not lose its input.
*/
private function toMainAddress(Request $request, Site $site): ?RedirectResponse
{
$origin = $site->exists ? $site->origin() : null;
$mainHost = $origin === null ? null : parse_url($origin, PHP_URL_HOST);
if (! is_string($mainHost) || strcasecmp($mainHost, $request->getHost()) === 0 || ! $request->isMethodSafe()) {
return null;
}
return new RedirectResponse($origin.$request->getRequestUri(), 301);
}
/**
* Links must carry the address the visitor came in on. AppServiceProvider forces APP_URL for every
* generated URL, because on Strato the document root is a release folder; with one landlord that was