Compare commits
14 Commits
developmen
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
755f46a66c | ||
|
|
83f3b45d6e | ||
|
|
4f957d4da6 | ||
|
|
f6360edef3 | ||
|
|
28fc22fcd8 | ||
|
|
c881d660e2 | ||
|
|
90287e098e | ||
|
|
1d4cae35a5 | ||
| 3f771bf7b0 | |||
| e78902d79f | |||
|
|
e52aea9dd3 | ||
| cdc8b89916 | |||
| 9dd79514f5 | |||
|
|
cd37d8da0f |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "scan-wave",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
onMount(async () => {
|
||||
await authManager.checkConnection();
|
||||
if (authState.isConnected && authState.token) {
|
||||
onSuccess?.(authState.token);
|
||||
}
|
||||
});
|
||||
|
||||
async function handleConnect() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { google } from 'googleapis';
|
||||
import { getAuthenticatedClient } from '../auth/server.js';
|
||||
import { GoogleSheet } from './types.ts';
|
||||
import { GoogleSheet } from './types';
|
||||
|
||||
// Type for sheet data
|
||||
export interface SheetData {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<h1 class="text-3xl font-bold text-center mb-2">ScanWave</h1>
|
||||
<h2 class="text-lg text-gray-600 text-center mb-8">Make entrance to your events a breeze.</h2>
|
||||
<div class="flex space-x-4 w-full justify-center">
|
||||
<a href="/private/home" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-8 rounded-full shadow-none border border-gray-300 w-64 text-center transition">
|
||||
<a href="/private/home" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-8 rounded-full shadow-none border border-gray-300 w-64 text-center transition" data-sveltekit-reload>
|
||||
Get started
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</script>
|
||||
|
||||
<nav class="border-b border-gray-300 bg-gray-50 p-2 text-gray-900">
|
||||
<div class="container mx-auto max-w-2xl p-2">
|
||||
<div class="container mx-auto max-w-4xl p-2">
|
||||
<div class="flex items-center justify-between">
|
||||
<a href="/private/home" class="text-lg font-bold" aria-label="ScanWave Home">ScanWave</a>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container mx-auto max-w-2xl bg-white p-2">
|
||||
<div class="container mx-auto max-w-4xl bg-white p-2">
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{@render children()}
|
||||
</QueryClientProvider>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
{$debouncedSearch ? `Search Results: "${$debouncedSearch}"` : 'All Events'}
|
||||
</h1>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 max-w-2xl mx-auto mb-10">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4 mx-auto mb-10">
|
||||
{#if isLoading}
|
||||
<!-- Loading placeholders -->
|
||||
{#each Array(4) as _}
|
||||
|
||||
@@ -1,86 +1,66 @@
|
||||
/// <reference lib="webworker" />
|
||||
/// <reference types="@sveltejs/kit" />
|
||||
import { build, files, version } from '$service-worker';
|
||||
|
||||
// Create a unique cache name for this deployment
|
||||
const CACHE = `cache-${version}`;
|
||||
declare const self: ServiceWorkerGlobalScope;
|
||||
|
||||
const CACHE = `cache-${version}`;
|
||||
const ASSETS = [
|
||||
...build, // the app itself
|
||||
...files // everything in `static`
|
||||
...build,
|
||||
...files
|
||||
];
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
// Create a new cache and add all files to it
|
||||
async function addFilesToCache() {
|
||||
const cache = await caches.open(CACHE);
|
||||
await cache.addAll(ASSETS);
|
||||
}
|
||||
self.addEventListener('install', (event: ExtendableEvent) => {
|
||||
const addFilesToCache = async () => {
|
||||
const cache = await caches.open(CACHE);
|
||||
await cache.addAll(ASSETS);
|
||||
};
|
||||
|
||||
event.waitUntil(addFilesToCache());
|
||||
console.log(`[SW] Installing new service worker, cache name: ${CACHE}`);
|
||||
|
||||
event.waitUntil(addFilesToCache());
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener('activate', (event) => {
|
||||
// Remove previous cached data from disk
|
||||
async function deleteOldCaches() {
|
||||
for (const key of await caches.keys()) {
|
||||
if (key !== CACHE) await caches.delete(key);
|
||||
}
|
||||
}
|
||||
self.addEventListener('activate', (event: ExtendableEvent) => {
|
||||
const deleteOldCaches = async () => {
|
||||
for (const key of await caches.keys()) {
|
||||
if (key !== CACHE) await caches.delete(key);
|
||||
console.log("[SW] Removing old service worker")
|
||||
}
|
||||
};
|
||||
|
||||
event.waitUntil(deleteOldCaches());
|
||||
event.waitUntil(deleteOldCaches());
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
// ignore POST requests etc
|
||||
if (event.request.method !== 'GET') return;
|
||||
self.addEventListener('fetch', (event: FetchEvent) => {
|
||||
if (event.request.method !== 'GET') return;
|
||||
|
||||
async function respond() {
|
||||
const url = new URL(event.request.url);
|
||||
|
||||
// Skip caching for auth routes
|
||||
if (url.pathname.startsWith('/auth/')) {
|
||||
return fetch(event.request);
|
||||
}
|
||||
// For navigation requests, always fetch from the network to ensure
|
||||
// server-side authentication checks are performed.
|
||||
if (event.request.mode === 'navigate') {
|
||||
event.respondWith(fetch(event.request));
|
||||
return;
|
||||
}
|
||||
|
||||
const cache = await caches.open(CACHE);
|
||||
// For other requests (e.g., static assets), use a cache-first strategy.
|
||||
const respond = async () => {
|
||||
const cache = await caches.open(CACHE);
|
||||
|
||||
// `build`/`files` can always be served from the cache
|
||||
if (ASSETS.includes(url.pathname)) {
|
||||
const response = await cache.match(url.pathname);
|
||||
const cachedResponse = await cache.match(event.request);
|
||||
if (cachedResponse) {
|
||||
return cachedResponse;
|
||||
}
|
||||
|
||||
if (response) {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await fetch(event.request);
|
||||
} catch {
|
||||
// If the network fails, and it's not in the cache, it will fail,
|
||||
// which is the expected behavior for non-navigation requests.
|
||||
return new Response('Not found', { status: 404 });
|
||||
}
|
||||
};
|
||||
|
||||
// for everything else, try the network first, but
|
||||
// fall back to the cache if we're offline
|
||||
try {
|
||||
const response = await fetch(event.request);
|
||||
|
||||
// if we're offline, fetch can return a value that is not a Response
|
||||
// instead of throwing - and we can't pass this non-Response to respondWith
|
||||
if (!(response instanceof Response)) {
|
||||
throw new Error('invalid response from fetch');
|
||||
}
|
||||
|
||||
if (response.status === 200) {
|
||||
cache.put(event.request, response.clone());
|
||||
}
|
||||
|
||||
return response;
|
||||
} catch (err) {
|
||||
const response = await cache.match(event.request);
|
||||
|
||||
if (response) {
|
||||
return response;
|
||||
}
|
||||
|
||||
// if there's no cache, then just error out
|
||||
// as there is nothing we can do to respond to this request
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
event.respondWith(respond());
|
||||
});
|
||||
event.respondWith(respond());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user