Class: SolidQueueMonitor::AssetsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SolidQueueMonitor::AssetsController
- Defined in:
- app/controllers/solid_queue_monitor/assets_controller.rb
Constant Summary collapse
- MIME_TYPES =
{ '.css' => 'text/css', '.js' => 'application/javascript' }.freeze
- FINGERPRINT_PATTERN =
/\A(?<base>[A-Za-z0-9_]+)-(?<hash>[a-f0-9]+)(?<ext>\.css|\.js)\z/
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#show ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/solid_queue_monitor/assets_controller.rb', line 10 def show asset_request = parse_asset_request return head(:not_found) unless asset_request asset = SolidQueueMonitor::AssetCache.fetch_by_name(asset_request[:file_name]) return head(:not_found) unless asset return head(:not_found) unless fingerprint_matches?(asset[:etag], asset_request[:hash]) assign_asset_headers(asset) return head(:not_modified) if etag_matches? render plain: asset[:content], content_type: MIME_TYPES[asset_request[:ext]] end |