Fix Firefox buggy appcache

pull/142/merge
Thibaut 10 years ago
parent e4ac0e8757
commit d8cdda54b5

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

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

Loading…
Cancel
Save