mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-05-22 22:31:31 -05:00
feat(pwa): static manifest, root-scoped worker, offline fallback
Add app/static/manifest.json (TimeTracker / Tracker, indigo theme) and PNG install icons via scripts/generate_pwa_icons.py. Replace inline Flask service worker with app/static/js/sw.js served at /service-worker.js for full-site scope. Cache name timetracker-v1: cache-first for /static, network-first for HTML and non-v1 /api, no interception of /api/v1/* (preserves Authorization). Add public GET /offline and offline.html for SW navigation fallback; redirect /manifest.webmanifest to the static manifest. Wire base.html (manifest link, theme-color #4F46E5, SW registration) and pwa-enhancements.js (ready/update/push without duplicate registration). Remove legacy app/static/service-worker.js and manifest.webmanifest. Tests: service worker and offline routes, manifest redirect, TestPWA expectations; drop duplicate test_enhanced_ui app/client fixtures in favor of conftest. Docs: ASSETS.md, BUILD_CONFIGURATION.md, implementation notes, and incomplete-features analysis updated for new paths.
This commit is contained in:
+4
-1
@@ -167,7 +167,10 @@ Some formats require manual conversion:
|
||||
- **Base template:** `app/templates/base.html`
|
||||
- **Login page:** `app/templates/auth/login.html`
|
||||
- **About page:** `app/templates/main/about.html`
|
||||
- **Manifest:** `app/static/manifest.webmanifest`
|
||||
- **PWA manifest:** `app/static/manifest.json` (linked from `base.html`; `GET /manifest.webmanifest` redirects here for compatibility)
|
||||
- **PWA service worker source:** `app/static/js/sw.js` (served at `GET /service-worker.js` for site-wide scope; registered from `base.html`)
|
||||
- **PWA offline fallback page:** `app/templates/offline.html` (`GET /offline`, public, cache-friendly)
|
||||
- **Install icons (PNG):** `app/static/images/android-chrome-192x192.png`, `android-chrome-512x512.png` — regenerate with `python3 scripts/generate_pwa_icons.py` after visual changes
|
||||
|
||||
### Desktop Application
|
||||
- **Main window:** `desktop/src/main/window.js`
|
||||
|
||||
@@ -104,7 +104,7 @@ See `desktop/assets/README.md` for detailed instructions on generating icons fro
|
||||
The web application uses the logo as favicon:
|
||||
- Location: `app/static/images/timetracker-logo.svg`
|
||||
- Configured in: `app/templates/base.html`
|
||||
- Also used in PWA manifest: `app/static/manifest.webmanifest`
|
||||
- Also used in PWA manifest: `app/static/manifest.json` (see `scripts/generate_pwa_icons.py` for install icons)
|
||||
|
||||
## Build Optimization
|
||||
|
||||
|
||||
@@ -350,9 +350,9 @@ The dedicated PostHog feature-flag helper under `app/utils/` was **removed**. Re
|
||||
### 2. Frontend Features
|
||||
|
||||
#### 2.1 Service Worker
|
||||
- **File:** `app/static/service-worker.js`
|
||||
- **Status:** Basic implementation exists but may need enhancement for full PWA functionality.
|
||||
**Priority:** Medium
|
||||
- **File:** `app/static/js/sw.js` (registered URL: `/service-worker.js`)
|
||||
- **Status:** PWA shell caching, offline page, and `/api/v1/*` pass-through are implemented; further enhancements (e.g. broader precache, background sync tuning) remain optional.
|
||||
**Priority:** Low
|
||||
|
||||
#### 2.2 Kiosk Mode
|
||||
- **File:** `app/routes/kiosk.py`
|
||||
|
||||
@@ -326,9 +326,10 @@ new DragDropManager(document.getElementById('sortable-list'), {
|
||||
- Offline page
|
||||
- Cache strategies
|
||||
|
||||
**Files Created:**
|
||||
- `app/static/service-worker.js`
|
||||
- Updated `manifest.webmanifest`
|
||||
**Files Created / current layout:**
|
||||
- `app/static/js/sw.js` (service worker; registered as `/service-worker.js`)
|
||||
- `app/static/manifest.json` (PWA manifest; legacy `GET /manifest.webmanifest` redirects)
|
||||
- `app/templates/offline.html`, `GET /offline`
|
||||
|
||||
**Features:**
|
||||
- ✅ Offline mode
|
||||
@@ -584,10 +585,10 @@ window.onboardingManager.reset()
|
||||
|
||||
## 🔧 Configuration
|
||||
|
||||
### Service Worker Cache Version
|
||||
Edit `service-worker.js`:
|
||||
### Service Worker cache name
|
||||
Edit `app/static/js/sw.js` and bump the cache constant when changing caching behavior (e.g. after breaking static asset changes):
|
||||
```javascript
|
||||
const CACHE_VERSION = 'v1.0.0';
|
||||
const CACHE_NAME = 'timetracker-v1';
|
||||
```
|
||||
|
||||
### Chart Default Colors
|
||||
|
||||
@@ -258,7 +258,7 @@ Routes → Services → Repositories → Models → Database
|
||||
- Lazy loading for routes
|
||||
- Image optimization
|
||||
- CDN for static assets
|
||||
- Service worker caching (exists: `app/static/service-worker.js`)
|
||||
- Service worker caching (`app/static/js/sw.js`, served at `/service-worker.js`)
|
||||
|
||||
#### 🟡 Medium Priority
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ All 16 planned improvements have been successfully implemented and tested. The T
|
||||
8. `app/static/enhanced-ui.js` - **950 lines** - Core enhanced functionality
|
||||
9. `app/static/charts.js` - **450 lines** - Chart management utilities
|
||||
10. `app/static/onboarding.js` - **380 lines** - Onboarding system
|
||||
11. `app/static/service-worker.js` - **400 lines** - PWA service worker
|
||||
11. `app/static/js/sw.js` - PWA service worker (served at `/service-worker.js`; replaces former `app/static/service-worker.js`)
|
||||
|
||||
### Documentation (3)
|
||||
12. `LAYOUT_IMPROVEMENTS_COMPLETE.md` - **800 lines** - Complete documentation
|
||||
@@ -58,7 +58,7 @@ All 16 planned improvements have been successfully implemented and tested. The T
|
||||
14. `tests/test_enhanced_ui.py` - **350 lines** - Comprehensive test suite
|
||||
|
||||
### Configuration (1)
|
||||
15. Updated `app/static/manifest.webmanifest` - PWA manifest with shortcuts
|
||||
15. `app/static/manifest.json` - PWA web app manifest (`/manifest.webmanifest` redirects for old clients)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user