Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions web/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "Binary Bloom Clock",
"short_name": "Binary Clock",
"description": "A beautifully designed binary clock that displays time using binary lights. Read the time in 24-hour or 12-hour format.",
"start_url": "/",
"scope": "/",
"start_url": "./index.html",
"scope": "./",
"display": "standalone",
"orientation": "portrait-primary",
"theme_color": "#4a2954",
Expand Down Expand Up @@ -36,7 +36,7 @@
"name": "24-Hour View",
"short_name": "24h",
"description": "Open Binary Clock in 24-hour mode",
"url": "/?mode=24",
"url": "./?mode=24",
"icons": [
{
"src": "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96'><rect width='96' height='96' rx='24' fill='%23ffa8d9'/><text x='48' y='60' font-size='32' font-weight='bold' fill='white' text-anchor='middle'>24h</text></svg>",
Expand All @@ -49,7 +49,7 @@
"name": "12-Hour View",
"short_name": "12h",
"description": "Open Binary Clock in 12-hour mode",
"url": "/?mode=12",
"url": "./?mode=12",
"icons": [
{
"src": "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96'><rect width='96' height='96' rx='24' fill='%23e39cff'/><text x='48' y='60' font-size='32' font-weight='bold' fill='white' text-anchor='middle'>12h</text></svg>",
Expand Down
14 changes: 8 additions & 6 deletions web/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
const CACHE_NAME = 'binary-bloom-v1';
const ASSETS_TO_CACHE = [
'/',
'/index.html',
'/styles.css',
'/script.js',
'/manifest.json'
'./',
'./index.html',
'./styles.css',
'./script.js',
'./manifest.json'
];

const APP_SCOPE_PATH = new URL(self.registration.scope).pathname;

// Install event - cache assets
self.addEventListener('install', event => {
event.waitUntil(
Expand Down Expand Up @@ -47,7 +49,7 @@ self.addEventListener('fetch', event => {
// Network first for API calls, cache first for assets
const url = new URL(event.request.url);

if (url.pathname === '/' || url.pathname.endsWith('.html') ||
if (url.pathname === APP_SCOPE_PATH || url.pathname.endsWith('.html') ||
url.pathname.endsWith('.css') || url.pathname.endsWith('.js') ||
url.pathname.endsWith('.json')) {

Expand Down
Loading