Initial commit
This commit is contained in:
BIN
public/apple-touch-icon.png
Normal file
BIN
public/apple-touch-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 651 B |
BIN
public/icon-192.png
Normal file
BIN
public/icon-192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
public/icon-512.png
Normal file
BIN
public/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 150 KiB |
BIN
public/icon.png
Normal file
BIN
public/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 150 KiB |
9
public/icon.svg
Normal file
9
public/icon.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
|
||||
<rect width="256" height="256" rx="56" fill="#17203A"/>
|
||||
<rect x="44" y="48" width="40" height="150" rx="18" fill="#F28B4B" opacity="0.4"/>
|
||||
<rect x="108" y="36" width="40" height="162" rx="18" fill="#3B5AE0"/>
|
||||
<rect x="172" y="76" width="40" height="122" rx="18" fill="#68A35D"/>
|
||||
<path d="M70 166l14 14 26-32" fill="none" stroke="#F7F4EE" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"/>
|
||||
<path d="M182 154l12 12 22-28" fill="none" stroke="#F7F4EE" stroke-linecap="round" stroke-linejoin="round" stroke-width="12"/>
|
||||
</svg>
|
||||
|
||||
|
After Width: | Height: | Size: 615 B |
45
public/sw.js
Normal file
45
public/sw.js
Normal file
@@ -0,0 +1,45 @@
|
||||
const CACHE_NAME = "rave-budget-control-v1";
|
||||
const APP_SHELL = ["/", "/login", "/icon.svg", "/manifest.webmanifest"];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(
|
||||
caches
|
||||
.open(CACHE_NAME)
|
||||
.then((cache) => cache.addAll(APP_SHELL))
|
||||
.then(() => self.skipWaiting())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys().then((cacheNames) =>
|
||||
Promise.all(cacheNames.filter((cacheName) => cacheName !== CACHE_NAME).map((cacheName) => caches.delete(cacheName)))
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("fetch", (event) => {
|
||||
const { request } = event;
|
||||
const url = new URL(request.url);
|
||||
|
||||
if (request.method !== "GET" || url.pathname.startsWith("/api")) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.respondWith(
|
||||
fetch(request)
|
||||
.then((response) => {
|
||||
const responseClone = response.clone();
|
||||
|
||||
caches.open(CACHE_NAME).then((cache) => {
|
||||
cache.put(request, responseClone);
|
||||
});
|
||||
|
||||
return response;
|
||||
})
|
||||
.catch(async () => {
|
||||
const cached = await caches.match(request);
|
||||
return cached ?? caches.match("/");
|
||||
})
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user