Class: Pi::Browser::Taskbar::Rails::AssetsController

Inherits:
ApplicationController show all
Defined in:
lib/pi/browser/taskbar/rails/engine.rb

Instance Method Summary collapse

Instance Method Details

#showObject



177
178
179
180
181
182
183
184
# File 'lib/pi/browser/taskbar/rails/engine.rb', line 177

def show
  filename = params[:filename]
  path = File.join(__dir__, "assets", filename)
  return head :not_found unless %w[pi_browser_taskbar.js pi_browser_taskbar.css].include?(filename) && File.file?(path)

  response.set_header("Cache-Control", "no-store")
  send_data File.binread(path), disposition: "inline", type: filename.end_with?(".js") ? "text/javascript" : "text/css"
end