From d09c60b7f007162738aa09951e9aee3a6f2198e4 Mon Sep 17 00:00:00 2001 From: Oliver Kuster Date: Tue, 4 Jul 2017 15:13:32 -0300 Subject: [PATCH 1/3] Fix cache command --- lib/mathjax/rails/controllers.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mathjax/rails/controllers.rb b/lib/mathjax/rails/controllers.rb index ea613073d..05b761cd8 100644 --- a/lib/mathjax/rails/controllers.rb +++ b/lib/mathjax/rails/controllers.rb @@ -12,6 +12,7 @@ def giveOutStaticFile options[:disposition] = 'inline' file = File.expand_path(filepath, __FILE__) if File.exists?(file) + expires_in (params[:cache] || 1.day), :public => true unless params[:cache] == false send_file file, options else render :status => 404 From 4d82ca1608977c1852505e2d20079b57a69e23ba Mon Sep 17 00:00:00 2001 From: Oliver Kuster Date: Tue, 4 Jul 2017 14:54:09 -0300 Subject: [PATCH 2/3] Add cache configuration --- lib/mathjax/rails/controllers.rb | 4 ++++ lib/mathjax/rails/routes.rb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/mathjax/rails/controllers.rb b/lib/mathjax/rails/controllers.rb index 05b761cd8..46db71c85 100644 --- a/lib/mathjax/rails/controllers.rb +++ b/lib/mathjax/rails/controllers.rb @@ -12,7 +12,11 @@ def giveOutStaticFile options[:disposition] = 'inline' file = File.expand_path(filepath, __FILE__) if File.exists?(file) +<<<<<<< HEAD expires_in (params[:cache] || 1.day), :public => true unless params[:cache] == false +======= + response.headers["Expires"] = (params[:cache] || 1.day).from_now.httpdate +>>>>>>> cdd6b55... Add cache configuration send_file file, options else render :status => 404 diff --git a/lib/mathjax/rails/routes.rb b/lib/mathjax/rails/routes.rb index ed4c533a2..3f78b5e4f 100644 --- a/lib/mathjax/rails/routes.rb +++ b/lib/mathjax/rails/routes.rb @@ -1,8 +1,8 @@ module Mathjax module Rails module RouterMethods - def mathjax(str) - match "#{str}/*uri" => "mathjax/rails/mathjax_rails#giveOutStaticFile",:as=>'mathjax', :via => [:get, :post] + def mathjax(str, cache=1.day) + match "#{str}/*uri" => "mathjax/rails/mathjax_rails#giveOutStaticFile",:as=>'mathjax', :via => [:get, :post], :cache => cache end end end From 5820f99198e4b13cd06bebf41affd59da63e5a0a Mon Sep 17 00:00:00 2001 From: Oliver Kuster Date: Tue, 26 Sep 2017 11:42:44 -0300 Subject: [PATCH 3/3] Fix trailing merge --- lib/mathjax/rails/controllers.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/mathjax/rails/controllers.rb b/lib/mathjax/rails/controllers.rb index 46db71c85..05b761cd8 100644 --- a/lib/mathjax/rails/controllers.rb +++ b/lib/mathjax/rails/controllers.rb @@ -12,11 +12,7 @@ def giveOutStaticFile options[:disposition] = 'inline' file = File.expand_path(filepath, __FILE__) if File.exists?(file) -<<<<<<< HEAD expires_in (params[:cache] || 1.day), :public => true unless params[:cache] == false -======= - response.headers["Expires"] = (params[:cache] || 1.day).from_now.httpdate ->>>>>>> cdd6b55... Add cache configuration send_file file, options else render :status => 404