feat: add app icons and PWA shell
CI / test (push) Successful in 2m40s

This commit is contained in:
strsv committed 2026-11-06 08:27:02 +03:00
1 parent 2fcb29e3fe
commit 97a5098511
23 files changed
+146 -57

No files matched your search

+6
View File
@@ -910,6 +910,12 @@ document.addEventListener("keydown", (e) => {
/* ---------- boot ---------- */
if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker.register("/sw.js").catch(() => {});
});
}
(async function boot() {
await Promise.all([loadMeta(), loadMoods()]);
await loadGames(true);
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

-16
View File
@@ -1,16 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<defs>
<linearGradient id="f-bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#ffd08a"/>
<stop offset=".52" stop-color="#f3b45c"/>
<stop offset="1" stop-color="#5eead4"/>
</linearGradient>
<linearGradient id="f-play" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#ffffff"/>
<stop offset="1" stop-color="#c8fff5"/>
</linearGradient>
</defs>
<rect width="64" height="64" rx="16" fill="url(#f-bg)"/>
<rect x="16" y="16" width="32" height="34" rx="8" fill="#0a0d13"/>
<path d="M29 24.5 L41 33 L29 41.5 Z" fill="url(#f-play)"/>
</svg>

Before

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

+8 -2
View File
@@ -4,7 +4,13 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SteamBase — библиотека и рекомендации</title>
<link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
<link rel="icon" href="/static/favicon.ico" sizes="any">
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16.png">
<link rel="apple-touch-icon" href="/static/apple-touch-icon.png">
<link rel="manifest" href="/static/site.webmanifest">
<meta name="theme-color" content="#062555">
<meta name="apple-mobile-web-app-title" content="SteamBase">
<script>
try {
if (localStorage.getItem("sb.theme") === "light") document.documentElement.dataset.theme = "light";
@@ -15,7 +21,7 @@ try {
<body>
<header class="topbar">
<div class="brand">
<img class="logo" src="/static/logo.svg" alt="" width="34" height="34">
<img class="logo" src="/static/icon-64.png" alt="" width="34" height="34">
<span>SteamBase</span>
</div>
<nav class="tabs">
-24
View File
@@ -1,24 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="SteamBase">
<defs>
<linearGradient id="sb-bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#ffd08a"/>
<stop offset=".52" stop-color="#f3b45c"/>
<stop offset="1" stop-color="#5eead4"/>
</linearGradient>
<linearGradient id="sb-play" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#ffffff"/>
<stop offset="1" stop-color="#c8fff5"/>
</linearGradient>
</defs>
<rect width="64" height="64" rx="18" fill="url(#sb-bg)"/>
<g transform="rotate(-9 32 33)">
<rect x="17" y="16" width="33" height="29" rx="7" fill="#0a0d13" opacity=".18"/>
</g>
<g transform="rotate(-4 32 34)">
<rect x="15" y="21" width="35" height="30" rx="7" fill="#0a0d13" opacity=".38"/>
</g>
<rect x="14" y="25" width="36" height="31" rx="8" fill="#0a0d13"/>
<rect x="20" y="33" width="12" height="3" rx="1.5" fill="#5eead4" opacity=".9"/>
<rect x="20" y="39" width="9" height="3" rx="1.5" fill="#f3b45c" opacity=".9"/>
<path d="M36.5 33.5 L47 39.5 L36.5 45.5 Z" fill="url(#sb-play)"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

+30
View File
@@ -0,0 +1,30 @@
{
"name": "SteamBase",
"short_name": "SteamBase",
"description": "Локальная библиотека Steam, рекомендации по настроению и личные заметки.",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#090c12",
"theme_color": "#062555",
"icons": [
{
"src": "/static/icon-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/static/icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/static/icon-maskable-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}
+1 -1
View File
@@ -66,7 +66,7 @@ button { cursor: pointer; }
flex: 0 0 34px;
display: block;
border-radius: 10px;
box-shadow: 0 6px 18px rgba(243, 180, 92, .22);
box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
}
.tabs {
+46
View File
@@ -0,0 +1,46 @@
const CACHE = "steambase-shell-v1";
const SHELL = [
"/",
"/static/styles.css",
"/static/app.js",
"/static/icon-192.png",
"/static/site.webmanifest",
];
self.addEventListener("install", (event) => {
event.waitUntil(
caches.open(CACHE).then((cache) => cache.addAll(SHELL)).then(() => self.skipWaiting())
);
});
self.addEventListener("activate", (event) => {
event.waitUntil(
caches.keys()
.then((keys) => Promise.all(keys.filter((key) => key !== CACHE).map((key) => caches.delete(key))))
.then(() => self.clients.claim())
);
});
self.addEventListener("fetch", (event) => {
const request = event.request;
const url = new URL(request.url);
if (request.method !== "GET" || url.origin !== self.location.origin) return;
if (url.pathname.startsWith("/api/")) return;
if (request.mode === "navigate") {
event.respondWith(fetch(request).catch(() => caches.match("/")));
return;
}
event.respondWith(
fetch(request)
.then((response) => {
if (response.ok) {
const copy = response.clone();
caches.open(CACHE).then((cache) => cache.put(request, copy));
}
return response;
})
.catch(() => caches.match(request))
);
});