specify BASE_PATH & APP_NAME fields in generate_manifests.py
Hunter
Friday, November 7th, 2025 at 12:22 AM
8 import re
9 from pathlib import Path
10
11 +# Configuration - Edit these for your deployment
12 +BASE_PATH = "/vibe_capsule/" # Path where this PWA will be hosted (e.g., "/" for root, "/my-playlist/" for subdirectory)
13 +APP_NAME = "vibe capsule"
14 +
15 +# Derived values (can be manually overridden if desired)
16 +SHORT_NAME = APP_NAME
17 +CACHE_NAME = APP_NAME
18 +APP_DESCRIPTION = f"{APP_NAME} ยท vibe capsule"
19 +
20 +# File paths (no need to edit these)
21 SCRIPT_DIR = Path(__file__).parent.absolute()
22 TRACKS_JSON = SCRIPT_DIR / "tracks.json"
23 STYLES_CSS = SCRIPT_DIR / "styles.css"
63
64 # Generate manifest.json
65 manifest = {
- "id": "/vibe_capsule/",
- "name": "vibe capsule",
- "short_name": "vibe capsule",
- "description": "mixtape as artifact",
- "start_url": "/vibe_capsule/",
- "scope": "/vibe_capsule/",
66 + "id": BASE_PATH,
67 + "name": APP_NAME,
68 + "short_name": SHORT_NAME,
69 + "description": APP_DESCRIPTION,
70 + "start_url": BASE_PATH,
71 + "scope": BASE_PATH,
72 "display": "standalone",
73 "background_color": background_color,
74 "theme_color": background_color,
110
111 # Generate service-worker.js
112 static_files = resource_manifest["static_files"]
- service_worker_content = f'''// Auto-generated service worker for vibe capsule PWA
-const CACHE_NAME = 'vibe-capsule';
113 + service_worker_content = f'''// Auto-generated service worker for {APP_NAME} PWA
114 +const CACHE_NAME = '{CACHE_NAME}';
115 const staticFilesToCache = {json.dumps(static_files, indent=2)};
116
117 // Get the base path from the service worker location