Skip to content

Commit

Permalink
dont precache sites that might not be available without login
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrindt committed Jul 14, 2023
1 parent 8edc55f commit ecb1aa9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ephios/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
"compressor.finders.CompressorFinder",
)
COMPRESS_ENABLED = not DEBUG or True
COMPRESS_ENABLED = not DEBUG # or True
CSRF_TRUSTED_ORIGINS = ["https://local.rindt.me"]
# https://www.accordbox.com/blog/how-use-scss-sass-your-django-project-python-way/
COMPRESS_PRECOMPILERS = (("text/x-scss", "django_libsass.SassCompiler"),)
Expand Down
4 changes: 1 addition & 3 deletions ephios/static/ephios/js/serviceworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
const staticCacheName = "ephios-pwa-v" + new Date().getTime();
const staticFilesToCacheOnInstall = [
'/offline/',
'/events/',
'/',
"/manifest.json",
"/static/ephios/img/ephios-192x.png",
"/static/ephios/img/ephios-512x.png",
Expand Down Expand Up @@ -62,7 +60,7 @@ self.addEventListener("fetch", event => {
// Serve dynamic content from network, falling back to cache when offline.
// Cache network responses for the offline case.
return fetch(event.request).then(function (response) {
if (event.request.method === "GET") {
if (event.request.method === "GET" && response.status === 200) {
// This will inadvertedly cache pages with messages in them
cache.put(event.request, response.clone());
}
Expand Down

0 comments on commit ecb1aa9

Please sign in to comment.