diff options
author | 2019-07-22 17:51:05 +0200 | |
---|---|---|
committer | 2019-07-22 17:51:05 +0200 | |
commit | 1284184d3e311fa17be48e531647c948cf19a6d1 (patch) | |
tree | 64af7805d1b828a629c5c332069e6b161ff88056 | |
parent | Set ETag and Last-Modified based on package info (diff) | |
download | packages-5-1284184d3e311fa17be48e531647c948cf19a6d1.tar.gz packages-5-1284184d3e311fa17be48e531647c948cf19a6d1.tar.bz2 packages-5-1284184d3e311fa17be48e531647c948cf19a6d1.zip |
Add ETag and Last-Modified headers based on specific package
https://guides.rubyonrails.org/caching_with_rails.html#conditional-get-support
Signed-off-by: Hans de Graaff <graaff@gentoo.org>
-rw-r--r-- | app/controllers/packages_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/packages_controller.rb b/app/controllers/packages_controller.rb index 67aa0af..de24b40 100644 --- a/app/controllers/packages_controller.rb +++ b/app/controllers/packages_controller.rb @@ -25,7 +25,7 @@ class PackagesController < ApplicationController @package = Package.find_by(:atom, params[:id]) fail ActionController::RoutingError, 'No such package' unless @package - fresh_when etag: @package.updated_at, last_modified: @package.updated_at + fresh_when etag: @package.updated_at, last_modified: @package.updated_at, public: true # Enable this in 2024 (when we have full-color emojis on a Linux desktop) # @title = ' 📦 %s' % @package.atom @@ -37,7 +37,7 @@ class PackagesController < ApplicationController @package = Package.find_by(:atom, params[:id]) fail ActionController::RoutingError, 'No such package' unless @package - fresh_when etag: @package.updated_at, last_modified: @package.updated_at + fresh_when etag: @package.updated_at, last_modified: @package.updated_at, public: true @changelog = Rails.cache.fetch("changelog/#{@package.atom}") do Portage::Util::History.for(@package.category, @package.name, 5) |