""" API root views for KeepItGoing. """ from django.http import JsonResponse from django.shortcuts import render def manifest_webmanifest(request): """Serve the PWA web app manifest, rendered so icon URLs pick up static hashing.""" return render(request, 'manifest.webmanifest', content_type='application/manifest+json') def service_worker(request): """ Serve the service worker script from the site root so its default scope covers the whole app (a service worker can only control paths at or below where it's served from). """ response = render(request, 'sw.js', content_type='application/javascript') response['Cache-Control'] = 'no-cache' return response def api_root(request): """ API root endpoint - returns available API endpoints. """ return JsonResponse({ 'message': 'KeepItGoing API', 'version': '1.0', 'endpoints': { 'users': '/api/users/', 'tasks': '/api/tasks/', 'sync': '/api/sync/', 'notifications': '/api/notifications/', 'admin': '/admin/', }, 'status': 'running' })