1// Service worker registration for the pre-login pages (auth / social auth / 2// facebook in-app layouts). 3// 4// This file is served statically from public/, so it is NEVER processed by 5// Blade â an earlier version put Blade placeholders for the FIREBASE_* env vars 6// in here and shipped those braces to the browser verbatim, which initialised 7// Firebase with garbage credentials and threw on every auth page load. 8// 9// Push notifications deliberately do NOT live here: asking a visitor to allow 10// notifications before they even have an account burns the one-shot prompt on 11// iOS for nothing. The logged-in layouts include 12// resources/views/partials/service-worker-register.blade.php, which has the 13// real Firebase config and defers the ask until onboarding completes. 14 15// Resolve the worker relative to this script so the app still works when it is 16// served from a sub-directory (e.g. /theslashapp/public/ on local dev). 17const SERVICE_WORKER_URL = new URL('service-worker.js?v=94', import.meta.url); 18 19if ('serviceWorker' in navigator) { 20 window.addEventListener('load', function () { 21 navigator.serviceWorker.register(SERVICE_WORKER_URL).catch(function (err) { 22 console.error('[SW] registration failed:', err); 23 }); 24 }); 25}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.