Optimize anonymous public sessions
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
$comments = $comments ?? [];
|
||||
$groupSummary = $groupSummary ?? null;
|
||||
$useUnifiedSeo = true;
|
||||
$canReadSessionAuth = request()->hasSession() && ! request()->attributes->get('skinbase.session_skipped');
|
||||
@endphp
|
||||
|
||||
@push('head')
|
||||
@@ -49,7 +50,7 @@
|
||||
data-canonical='@json($meta["canonical"])'
|
||||
data-comments='@json($comments)'
|
||||
data-group-summary='@json($groupSummary)'
|
||||
data-is-authenticated='@json(auth()->check())'>
|
||||
data-is-authenticated='@json($canReadSessionAuth && auth()->check())'>
|
||||
</div>
|
||||
|
||||
@vite(['resources/js/Pages/ArtworkPage.jsx'])
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
@extends('layouts.nova')
|
||||
|
||||
@push('head')
|
||||
@if(request()->hasSession() && ! request()->attributes->get('skinbase.session_skipped'))
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
||||
@endif
|
||||
@vite(['resources/js/collections.jsx'])
|
||||
<style>
|
||||
body.page-collections main { padding-top: 4rem; }
|
||||
|
||||
@@ -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
|
||||
@@ -242,13 +246,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')">
|
||||
@@ -259,9 +263,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
|
||||
@@ -269,7 +273,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>
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
@php
|
||||
$skinbaseCanUseSession = ($skinbaseCanUseSession ?? false) === true;
|
||||
$skinbaseToolbarUser = $skinbaseCanUseSession ? Auth::user() : null;
|
||||
$skinbaseToolbarCanAuth = $skinbaseToolbarUser !== null;
|
||||
@endphp
|
||||
|
||||
<header id="nova-toolbar" class="fixed inset-x-0 top-0 z-50 h-16 bg-black/40 backdrop-blur border-b border-white/10">
|
||||
<div class="mx-auto w-full h-full px-3 sm:px-4 flex items-center gap-2 sm:gap-3">
|
||||
|
||||
@@ -84,11 +90,11 @@
|
||||
<a class="flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-white/5" href="{{ route('worlds.index') }}">
|
||||
<i class="fa-solid fa-globe w-4 text-center text-sb-muted"></i>Worlds
|
||||
</a>
|
||||
@auth
|
||||
@if($skinbaseToolbarCanAuth)
|
||||
<a class="flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-white/5" href="{{ route('discover.for-you') }}">
|
||||
<i class="fa-solid fa-wand-magic-sparkles w-4 text-center"></i>For You
|
||||
</a>
|
||||
@endauth
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -169,11 +175,11 @@
|
||||
<a class="flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-white/5" href="/stories">
|
||||
<i class="fa-solid fa-microphone w-4 text-center text-sb-muted"></i>Creator Stories
|
||||
</a>
|
||||
@auth
|
||||
@if($skinbaseToolbarCanAuth)
|
||||
<a class="flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-white/5" href="{{ route('dashboard.following') }}">
|
||||
<i class="fa-solid fa-user-plus w-4 text-center text-sb-muted"></i>Following
|
||||
</a>
|
||||
@endauth
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -189,7 +195,7 @@
|
||||
<a class="flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-white/5" href="{{ route('community.activity') }}">
|
||||
<i class="fa-solid fa-wave-square w-4 text-center text-sb-muted"></i>Activity Feed
|
||||
</a>
|
||||
@auth
|
||||
@if($skinbaseToolbarCanAuth)
|
||||
<a class="flex items-center justify-between gap-3 px-4 py-2.5 text-sm hover:bg-white/5" href="{{ route('dashboard.comments.received') }}">
|
||||
<span class="flex items-center gap-3">
|
||||
<i class="fa-solid fa-inbox w-4 text-center text-sb-muted"></i>Received Comments
|
||||
@@ -198,7 +204,7 @@
|
||||
<span class="rounded-full border border-cyan-400/25 bg-cyan-500/10 px-2 py-0.5 text-[11px] font-semibold text-cyan-200">{{ $receivedCommentsCount }}</span>
|
||||
@endif
|
||||
</a>
|
||||
@endauth
|
||||
@endif
|
||||
<a class="flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-white/5" href="/forum">
|
||||
<i class="fa-solid fa-comments w-4 text-center text-sb-muted"></i>Forum
|
||||
</a>
|
||||
@@ -245,7 +251,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@auth
|
||||
@if($skinbaseToolbarCanAuth)
|
||||
<!-- Notification icons -->
|
||||
<div class="hidden md:flex items-center gap-0.5 lg:gap-1 text-soft shrink-0">
|
||||
<a href="{{ route('dashboard.favorites') }}"
|
||||
@@ -462,7 +468,7 @@
|
||||
</a>
|
||||
</div>
|
||||
</details>
|
||||
@endauth
|
||||
@endif
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -470,9 +476,9 @@
|
||||
<div class="hidden fixed inset-x-0 top-16 bottom-0 z-40 overflow-y-auto overscroll-contain bg-nova border-b border-panel p-4 shadow-sb" id="mobileMenu">
|
||||
<div class="space-y-0.5 text-sm text-soft">
|
||||
|
||||
@guest
|
||||
@if(! $skinbaseToolbarCanAuth)
|
||||
<div class="my-2 border-t border-panel"></div>
|
||||
@endguest
|
||||
@endif
|
||||
|
||||
<div class="pt-1">
|
||||
<button type="button" data-mobile-section-toggle aria-controls="mobileSectionDiscover" aria-expanded="true" class="w-full flex items-center justify-between py-2.5 px-3 rounded-lg text-[11px] font-semibold uppercase tracking-widest text-sb-muted hover:bg-white/5">
|
||||
@@ -533,10 +539,10 @@
|
||||
<a class="flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-white/5" href="/leaderboard"><i class="fa-solid fa-trophy w-4 text-center text-sb-muted"></i>Leaderboard</a>
|
||||
<a class="flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-white/5" href="/creators/rising"><i class="fa-solid fa-arrow-trend-up w-4 text-center text-sb-muted"></i>Rising Creators</a>
|
||||
<a class="flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-white/5" href="/stories"><i class="fa-solid fa-microphone w-4 text-center text-sb-muted"></i>Creator Stories</a>
|
||||
@auth
|
||||
@if($skinbaseToolbarCanAuth)
|
||||
<a class="flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-white/5" href="{{ route('creator.stories.index') }}"><i class="fa-solid fa-rectangle-list w-4 text-center text-sb-muted"></i>My Stories</a>
|
||||
<a class="flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-white/5" href="{{ route('dashboard.following') }}"><i class="fa-solid fa-user-plus w-4 text-center text-sb-muted"></i>Following</a>
|
||||
@endauth
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -547,9 +553,9 @@
|
||||
</button>
|
||||
<div id="mobileSectionCommunity" data-mobile-section-panel class="hidden mt-0.5 space-y-0.5">
|
||||
<a class="flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-white/5" href="{{ route('community.activity') }}"><i class="fa-solid fa-wave-square w-4 text-center text-sb-muted"></i>Activity Feed</a>
|
||||
@auth
|
||||
@if($skinbaseToolbarCanAuth)
|
||||
<a class="flex items-center justify-between gap-3 py-2.5 px-3 rounded-lg hover:bg-white/5" href="{{ route('dashboard.comments.received') }}"><span class="flex items-center gap-3"><i class="fa-solid fa-inbox w-4 text-center text-sb-muted"></i>Received Comments</span>@if(($receivedCommentsCount ?? 0) > 0)<span class="rounded-full border border-cyan-400/25 bg-cyan-500/10 px-2 py-0.5 text-[11px] font-semibold text-cyan-200">{{ $receivedCommentsCount }}</span>@endif</a>
|
||||
@endauth
|
||||
@endif
|
||||
<a class="flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-white/5" href="/forum"><i class="fa-solid fa-comments w-4 text-center text-sb-muted"></i>Forum</a>
|
||||
<a class="flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-white/5" href="/news"><i class="fa-solid fa-newspaper w-4 text-center text-sb-muted"></i>News</a>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
@section('title', 'Messages')
|
||||
|
||||
@push('head')
|
||||
@if(request()->hasSession() && ! request()->attributes->get('skinbase.session_skipped'))
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
||||
@endif
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
@extends('layouts.nova')
|
||||
|
||||
@push('head')
|
||||
@if(request()->hasSession() && ! request()->attributes->get('skinbase.session_skipped'))
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
||||
@endif
|
||||
@vite(['resources/js/moderation.jsx'])
|
||||
<style>
|
||||
body.page-moderation main { padding-top: 4rem; }
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
@extends('layouts.nova')
|
||||
|
||||
@push('head')
|
||||
@if(request()->hasSession() && ! request()->attributes->get('skinbase.session_skipped'))
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
||||
@endif
|
||||
@vite(['resources/js/settings.jsx'])
|
||||
<style>
|
||||
body.page-settings main { padding-top: 4rem; }
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
@extends('layouts.nova')
|
||||
|
||||
@push('head')
|
||||
@if(request()->hasSession() && ! request()->attributes->get('skinbase.session_skipped'))
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
||||
@endif
|
||||
@vite(['resources/js/studio.jsx'])
|
||||
<style>
|
||||
body.page-studio main { padding-top: 2.3rem; }
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
@extends('layouts.nova')
|
||||
|
||||
@push('head')
|
||||
@if(request()->hasSession() && ! request()->attributes->get('skinbase.session_skipped'))
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
||||
@endif
|
||||
|
||||
<script>
|
||||
window.SKINBASE_FLAGS = Object.assign({}, window.SKINBASE_FLAGS || {}, {
|
||||
|
||||
Reference in New Issue
Block a user