Connectez-vous avec votre compte organisateur
+ +diff --git a/public/scanner/sw.js b/public/scanner/sw.js new file mode 100644 index 0000000..597e346 --- /dev/null +++ b/public/scanner/sw.js @@ -0,0 +1,27 @@ +const CACHE_NAME = 'scanner-v1'; +const ASSETS = [ + '/scanner', + 'https://unpkg.com/html5-qrcode@2.3.8/html5-qrcode.min.js', +]; + +self.addEventListener('install', (e) => { + e.waitUntil(caches.open(CACHE_NAME).then(c => c.addAll(ASSETS))); + self.skipWaiting(); +}); + +self.addEventListener('activate', (e) => { + e.waitUntil( + caches.keys().then(keys => Promise.all( + keys.filter(k => k !== CACHE_NAME).map(k => caches.delete(k)) + )) + ); + self.clients.claim(); +}); + +self.addEventListener('fetch', (e) => { + if (e.request.method !== 'GET') return; + if (e.request.url.includes('/api/')) return; + e.respondWith( + caches.match(e.request).then(cached => cached || fetch(e.request)) + ); +}); diff --git a/src/Controller/ScannerController.php b/src/Controller/ScannerController.php new file mode 100644 index 0000000..f6819c9 --- /dev/null +++ b/src/Controller/ScannerController.php @@ -0,0 +1,42 @@ +render('scanner/index.html.twig'); + } + + #[Route('/scanner/manifest.json', name: 'app_scanner_manifest', methods: ['GET'])] + public function manifest(): Response + { + $manifest = [ + 'name' => 'E-Ticket Scanner', + 'short_name' => 'Scanner', + 'description' => 'Application de scan de billets pour organisateurs', + 'start_url' => '/scanner', + 'scope' => '/scanner', + 'display' => 'standalone', + 'orientation' => 'portrait', + 'theme_color' => '#111827', + 'background_color' => '#111827', + 'lang' => 'fr', + 'icons' => [ + ['src' => '/logo.png', 'sizes' => '512x512', 'type' => 'image/png'], + ], + ]; + + return new Response( + json_encode($manifest, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES), + 200, + ['Content-Type' => 'application/manifest+json'], + ); + } +} diff --git a/templates/scanner/index.html.twig b/templates/scanner/index.html.twig new file mode 100644 index 0000000..87c504d --- /dev/null +++ b/templates/scanner/index.html.twig @@ -0,0 +1,400 @@ + + +
+ + +Connectez-vous avec votre compte organisateur
+ +