Quellcode durchsuchen

Fix Firefox buggy appcache

Thibaut vor 11 Jahren
Ursprung
Commit
d8cdda54b5
2 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 1 1
      assets/javascripts/models/doc.coffee
  2. 3 3
      lib/app.rb

+ 1 - 1
assets/javascripts/models/doc.coffee

@@ -28,7 +28,7 @@ class app.models.Doc extends app.Model
     "#{app.config.docs_host}#{@fullPath(path)}"
 
   indexUrl: ->
-    "#{app.indexHost()}/#{@index_path}"
+    "#{app.indexHost()}/#{@index_path}?#{@mtime}"
 
   toEntry: ->
     new app.models.Entry

+ 3 - 3
lib/app.rb

@@ -63,7 +63,7 @@ class App < Sinatra::Application
       root: 'public',
       urls: %w(/assets /docs /images /favicon.ico /robots.txt /opensearch.xml /manifest.webapp),
       header_rules: [
-        [:all,           {'Cache-Control' => 'private, max-age=0'}],
+        [:all,           {'Cache-Control' => 'no-cache, max-age=0'}],
         ['/assets',      {'Cache-Control' => 'public, max-age=604800'}],
         ['/favicon.ico', {'Cache-Control' => 'public, max-age=86400'}],
         ['/images',      {'Cache-Control' => 'public, max-age=86400'}] ]
@@ -96,7 +96,7 @@ class App < Sinatra::Application
 
       cookie.split('/').inject [] do |result, slug|
         if doc = settings.docs[slug]
-          result << File.join('', settings.docs_prefix, doc['index_path'])
+          result << File.join('', settings.docs_prefix, doc['index_path']) + "?#{doc['mtime']}"
         end
         result
       end
@@ -113,7 +113,7 @@ class App < Sinatra::Application
 
   get '/manifest.appcache' do
     content_type 'text/cache-manifest'
-    expires 0, :private
+    expires 0, :'no-cache'
     erb :manifest
   end