Optimize anonymous public sessions

This commit is contained in:
2026-05-01 11:42:10 +02:00
parent 35011001ba
commit 961d21e91e
35 changed files with 888 additions and 66 deletions

View File

@@ -1,5 +1,7 @@
@php
$gridVersion = request()->query('grid') === 'v2' ? 'v2' : 'v1';
$skinbaseSessionSkipped = request()->attributes->get('skinbase.session_skipped') === true;
$skinbaseCanUseSession = request()->hasSession() && ! $skinbaseSessionSkipped;
$deferToolbarSearch = request()->routeIs('index');
$deferFontAwesome = request()->routeIs('index');
$deferWebManifest = request()->routeIs('index');
@@ -21,7 +23,9 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@if($skinbaseCanUseSession)
<meta name="csrf-token" content="{{ csrf_token() }}">
@endif
@if($shouldRenderBladeSeo)
@include('partials.seo.head', ['seo' => $seo ?? null])
@endif
@@ -235,13 +239,13 @@
<!-- React Topbar mount point -->
<div id="topbar-root"
@auth
@if($skinbaseCanUseSession && Auth::check())
data-user-id="{{ Auth::id() }}"
data-display-name="{{ Auth::user()->name ?? '' }}"
data-username="{{ Auth::user()->username ?? '' }}"
data-avatar-url="{{ \App\Support\AvatarUrl::forUser((int) Auth::id(), optional(Auth::user()->profile)->avatar_hash, 64) }}"
data-upload-url="{{ Route::has('upload') ? route('upload') : '/upload' }}"
@endauth
@endif
></div>
@include('layouts.nova.toolbar')
<main class="flex-1 @yield('main-class', 'pt-16')">
@@ -252,9 +256,9 @@
{{-- Toast notifications (Alpine) --}}
@php
$toastMessage = session('status') ?? session('error') ?? null;
$toastType = session('error') ? 'error' : 'success';
$toastBorder = session('error') ? 'border-red-500' : 'border-green-500';
$toastMessage = $skinbaseCanUseSession ? (session('status') ?? session('error') ?? null) : null;
$toastType = $skinbaseCanUseSession && session('error') ? 'error' : 'success';
$toastBorder = $skinbaseCanUseSession && session('error') ? 'border-red-500' : 'border-green-500';
@endphp
@if($toastMessage)
<div x-data="{show:true}" x-show="show" x-init="setTimeout(()=>show=false,4000)" x-cloak
@@ -262,7 +266,7 @@
<div class="max-w-sm w-full rounded-lg shadow-lg overflow-hidden bg-nova-600 border {{ $toastBorder }}">
<div class="px-4 py-3 flex items-start gap-3">
<div class="flex-shrink-0">
@if(session('error'))
@if($skinbaseCanUseSession && session('error'))
<svg class="w-6 h-6 text-red-200" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 12H6"/></svg>
@else
<svg class="w-6 h-6 text-green-200" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>