Initial commit: Shelem card game

Full-stack multiplayer Shelem (Iranian trick-taking card game) with
Socket.IO, JWT auth, bot players, joker mode, and mobile-friendly UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
goyban
2026-05-08 16:17:37 +00:00
commit 8e8478e45b
12 changed files with 3869 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
'use strict';
const CACHE_NAME = 'shelem-v1';
const PRECACHE = [
'/',
'/index.html',
'/style.css',
'/app.js',
'/manifest.json',
'/icons/icon-192.png',
'/icons/icon-512.png',
'/icons/icon.svg',
];
self.addEventListener('install', event => {
event.waitUntil(
caches.open(CACHE_NAME).then(cache => cache.addAll(PRECACHE))
);
self.skipWaiting();
});
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(keys =>
Promise.all(keys.filter(k => k !== CACHE_NAME).map(k => caches.delete(k)))
)
);
self.clients.claim();
});
self.addEventListener('fetch', event => {
const url = event.request.url;
if (event.request.method !== 'GET') return;
if (url.includes('/socket.io/')) return;
if (url.includes('/cards/')) {
event.respondWith(
caches.match(event.request).then(cached => {
if (cached) return cached;
return fetch(event.request).then(res => {
caches.open(CACHE_NAME).then(c => c.put(event.request, res.clone()));
return res;
});
})
);
return;
}
event.respondWith(
fetch(event.request)
.then(res => {
caches.open(CACHE_NAME).then(c => c.put(event.request, res.clone()));
return res;
})
.catch(() => caches.match(event.request))
);
});