Commit 0759b80c authored by Julien Enselme's avatar Julien Enselme

Rely on the template to render URLs

Static files will now be cached with their hash (if provided).
parent 52e23484
......@@ -4,6 +4,7 @@ import time
from django.http import Http404
from django.shortcuts import render
from django.templatetags.static import static
from django.urls import reverse
from django.utils import timezone
from django.views.decorators.cache import never_cache
......@@ -70,4 +71,9 @@ class ServiceWorkerView(TemplateView):
def get_context_data(self, **kwargs):
return {
'version': version,
'icon_url': static('icons/aurss.512x512.png'),
'manifest_url': static('manifest.json'),
'style_url': static('style.css'),
'home_url': reverse('home'),
'offline_url': reverse('offline'),
}
......@@ -3,11 +3,12 @@ const staticCachePrefix = 'static';
const staticCacheName = `${staticCachePrefix}-${VERSION}`;
const dynamicCacheName = 'dynamic';
const appShell = [
'static/icons/aurss.512x512.png',
'static/manifest.json',
'',
'offline/',
].map((partialUrl) => `${location.protocol}//${location.host}/${partialUrl}`);
'{{ icon_url }}',
'{{ manifest_url }}',
'{{ style_url }}',
'{{ home_url }}',
'{{ offline_url }}',
].map((partialUrl) => `${location.protocol}//${location.host}${partialUrl}`);
const maxNumberItemsDynamicCache = 5;
const urlsToCacheTimes = new Map();
// In milliseconds.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment