pwa
Browse files- README.md +2 -0
- assets/logo-big.PNG +3 -0
- assets/logo.PNG +3 -0
- index.html +30 -4
- public/manifest.json +49 -6
- public/sw.js +76 -0
README.md
CHANGED
@@ -12,6 +12,8 @@ hf_oauth_scopes:
|
|
12 |
- inference-api
|
13 |
---
|
14 |
|
|
|
|
|
15 |
# Svelte + TS + Vite
|
16 |
|
17 |
This template should help get you started developing with Svelte and TypeScript in Vite.
|
|
|
12 |
- inference-api
|
13 |
---
|
14 |
|
15 |
+
https://fraser-piclets.static.hf.space/
|
16 |
+
|
17 |
# Svelte + TS + Vite
|
18 |
|
19 |
This template should help get you started developing with Svelte and TypeScript in Vite.
|
assets/logo-big.PNG
ADDED
|
Git LFS Details
|
assets/logo.PNG
ADDED
|
Git LFS Details
|
index.html
CHANGED
@@ -2,24 +2,50 @@
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8" />
|
5 |
-
<link rel="icon" type="image/png" href="
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
7 |
|
8 |
<!-- PWA Meta Tags -->
|
9 |
<meta name="mobile-web-app-capable" content="yes">
|
10 |
<meta name="apple-mobile-web-app-capable" content="yes">
|
11 |
-
<meta name="apple-mobile-web-app-status-bar-style" content="
|
12 |
<meta name="apple-mobile-web-app-title" content="Piclets">
|
13 |
<meta name="application-name" content="Piclets">
|
14 |
<meta name="theme-color" content="#007bff">
|
|
|
15 |
|
16 |
-
<!-- Apple Touch
|
17 |
-
<link rel="apple-touch-icon" href="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
<!-- PWA Manifest -->
|
20 |
<link rel="manifest" href="/manifest.json">
|
21 |
|
|
|
|
|
|
|
|
|
22 |
<title>Piclets - Monster Collection Game</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
</head>
|
24 |
<body>
|
25 |
<div id="app"></div>
|
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8" />
|
5 |
+
<link rel="icon" type="image/png" href="/assets/logo.PNG" />
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
7 |
|
8 |
<!-- PWA Meta Tags -->
|
9 |
<meta name="mobile-web-app-capable" content="yes">
|
10 |
<meta name="apple-mobile-web-app-capable" content="yes">
|
11 |
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
12 |
<meta name="apple-mobile-web-app-title" content="Piclets">
|
13 |
<meta name="application-name" content="Piclets">
|
14 |
<meta name="theme-color" content="#007bff">
|
15 |
+
<meta name="description" content="Transform photos into unique monsters and build your collection">
|
16 |
|
17 |
+
<!-- Apple Touch Icons -->
|
18 |
+
<link rel="apple-touch-icon" href="/assets/logo.PNG">
|
19 |
+
<link rel="apple-touch-icon" sizes="72x72" href="/assets/logo.PNG">
|
20 |
+
<link rel="apple-touch-icon" sizes="96x96" href="/assets/logo.PNG">
|
21 |
+
<link rel="apple-touch-icon" sizes="144x144" href="/assets/logo.PNG">
|
22 |
+
<link rel="apple-touch-icon" sizes="192x192" href="/assets/logo.PNG">
|
23 |
+
|
24 |
+
<!-- Android Icons -->
|
25 |
+
<link rel="icon" type="image/png" sizes="192x192" href="/assets/logo.PNG">
|
26 |
+
<link rel="icon" type="image/png" sizes="96x96" href="/assets/logo.PNG">
|
27 |
+
<link rel="icon" type="image/png" sizes="32x32" href="/assets/logo.PNG">
|
28 |
+
<link rel="icon" type="image/png" sizes="16x16" href="/assets/logo.PNG">
|
29 |
|
30 |
<!-- PWA Manifest -->
|
31 |
<link rel="manifest" href="/manifest.json">
|
32 |
|
33 |
+
<!-- Apple Splash Screens (optional but recommended) -->
|
34 |
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
35 |
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
36 |
+
|
37 |
<title>Piclets - Monster Collection Game</title>
|
38 |
+
|
39 |
+
<script>
|
40 |
+
// Register service worker
|
41 |
+
if ('serviceWorker' in navigator) {
|
42 |
+
window.addEventListener('load', () => {
|
43 |
+
navigator.serviceWorker.register('/sw.js')
|
44 |
+
.then(registration => console.log('ServiceWorker registered:', registration))
|
45 |
+
.catch(err => console.log('ServiceWorker registration failed:', err));
|
46 |
+
});
|
47 |
+
}
|
48 |
+
</script>
|
49 |
</head>
|
50 |
<body>
|
51 |
<div id="app"></div>
|
public/manifest.json
CHANGED
@@ -3,20 +3,63 @@
|
|
3 |
"short_name": "Piclets",
|
4 |
"description": "Transform photos into unique monsters and build your collection",
|
5 |
"start_url": "/",
|
|
|
6 |
"display": "standalone",
|
7 |
-
"background_color": "#
|
8 |
"theme_color": "#007bff",
|
9 |
"orientation": "portrait",
|
|
|
10 |
"icons": [
|
11 |
{
|
12 |
-
"src": "
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
"sizes": "192x192",
|
14 |
-
"type": "image/png"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
},
|
16 |
{
|
17 |
-
"src": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
"sizes": "512x512",
|
19 |
-
"type": "image/png"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
-
]
|
|
|
22 |
}
|
|
|
3 |
"short_name": "Piclets",
|
4 |
"description": "Transform photos into unique monsters and build your collection",
|
5 |
"start_url": "/",
|
6 |
+
"scope": "/",
|
7 |
"display": "standalone",
|
8 |
+
"background_color": "#ffffff",
|
9 |
"theme_color": "#007bff",
|
10 |
"orientation": "portrait",
|
11 |
+
"categories": ["games", "entertainment"],
|
12 |
"icons": [
|
13 |
{
|
14 |
+
"src": "/assets/logo.PNG",
|
15 |
+
"sizes": "512x512",
|
16 |
+
"type": "image/png",
|
17 |
+
"purpose": "any"
|
18 |
+
},
|
19 |
+
{
|
20 |
+
"src": "/assets/logo.PNG",
|
21 |
"sizes": "192x192",
|
22 |
+
"type": "image/png",
|
23 |
+
"purpose": "any"
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"src": "/assets/logo.PNG",
|
27 |
+
"sizes": "144x144",
|
28 |
+
"type": "image/png",
|
29 |
+
"purpose": "any"
|
30 |
+
},
|
31 |
+
{
|
32 |
+
"src": "/assets/logo.PNG",
|
33 |
+
"sizes": "96x96",
|
34 |
+
"type": "image/png",
|
35 |
+
"purpose": "any"
|
36 |
},
|
37 |
{
|
38 |
+
"src": "/assets/logo.PNG",
|
39 |
+
"sizes": "72x72",
|
40 |
+
"type": "image/png",
|
41 |
+
"purpose": "any"
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"src": "/assets/logo.PNG",
|
45 |
+
"sizes": "48x48",
|
46 |
+
"type": "image/png",
|
47 |
+
"purpose": "any"
|
48 |
+
},
|
49 |
+
{
|
50 |
+
"src": "/assets/logo.PNG",
|
51 |
"sizes": "512x512",
|
52 |
+
"type": "image/png",
|
53 |
+
"purpose": "maskable"
|
54 |
+
}
|
55 |
+
],
|
56 |
+
"screenshots": [
|
57 |
+
{
|
58 |
+
"src": "/assets/screenshot1.png",
|
59 |
+
"sizes": "1280x720",
|
60 |
+
"type": "image/png",
|
61 |
+
"form_factor": "wide"
|
62 |
}
|
63 |
+
],
|
64 |
+
"prefer_related_applications": false
|
65 |
}
|
public/sw.js
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const CACHE_NAME = 'piclets-v1';
|
2 |
+
const urlsToCache = [
|
3 |
+
'/',
|
4 |
+
'/manifest.json',
|
5 |
+
'/assets/logo.PNG'
|
6 |
+
];
|
7 |
+
|
8 |
+
// Install event - cache key resources
|
9 |
+
self.addEventListener('install', event => {
|
10 |
+
event.waitUntil(
|
11 |
+
caches.open(CACHE_NAME)
|
12 |
+
.then(cache => {
|
13 |
+
console.log('Opened cache');
|
14 |
+
return cache.addAll(urlsToCache);
|
15 |
+
})
|
16 |
+
);
|
17 |
+
});
|
18 |
+
|
19 |
+
// Activate event - clean up old caches
|
20 |
+
self.addEventListener('activate', event => {
|
21 |
+
event.waitUntil(
|
22 |
+
caches.keys().then(cacheNames => {
|
23 |
+
return Promise.all(
|
24 |
+
cacheNames.map(cacheName => {
|
25 |
+
if (cacheName !== CACHE_NAME) {
|
26 |
+
console.log('Deleting old cache:', cacheName);
|
27 |
+
return caches.delete(cacheName);
|
28 |
+
}
|
29 |
+
})
|
30 |
+
);
|
31 |
+
})
|
32 |
+
);
|
33 |
+
});
|
34 |
+
|
35 |
+
// Fetch event - serve from cache when offline
|
36 |
+
self.addEventListener('fetch', event => {
|
37 |
+
event.respondWith(
|
38 |
+
caches.match(event.request)
|
39 |
+
.then(response => {
|
40 |
+
// Cache hit - return response
|
41 |
+
if (response) {
|
42 |
+
return response;
|
43 |
+
}
|
44 |
+
|
45 |
+
// Clone the request
|
46 |
+
const fetchRequest = event.request.clone();
|
47 |
+
|
48 |
+
return fetch(fetchRequest).then(response => {
|
49 |
+
// Check if valid response
|
50 |
+
if (!response || response.status !== 200 || response.type !== 'basic') {
|
51 |
+
return response;
|
52 |
+
}
|
53 |
+
|
54 |
+
// Clone the response
|
55 |
+
const responseToCache = response.clone();
|
56 |
+
|
57 |
+
// Cache the fetched response for future use
|
58 |
+
caches.open(CACHE_NAME)
|
59 |
+
.then(cache => {
|
60 |
+
// Don't cache API calls or external resources
|
61 |
+
if (event.request.url.startsWith(self.location.origin)) {
|
62 |
+
cache.put(event.request, responseToCache);
|
63 |
+
}
|
64 |
+
});
|
65 |
+
|
66 |
+
return response;
|
67 |
+
});
|
68 |
+
})
|
69 |
+
.catch(() => {
|
70 |
+
// Offline fallback
|
71 |
+
if (event.request.mode === 'navigate') {
|
72 |
+
return caches.match('/');
|
73 |
+
}
|
74 |
+
})
|
75 |
+
);
|
76 |
+
});
|