2017-08-12 08:32:15 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-21 17:25:11 -04:00
|
|
|
Rails.application.routes.draw do
|
2017-12-13 11:59:36 -05:00
|
|
|
get "/rails/active_storage/blobs/:signed_id/*filename" => "active_storage/blobs#show", as: :rails_service_blob
|
2017-07-23 12:06:06 -04:00
|
|
|
|
2017-11-21 14:17:12 -05:00
|
|
|
direct :rails_blob do |blob, options|
|
|
|
|
route_for(:rails_service_blob, blob.signed_id, blob.filename, options)
|
2017-07-23 12:06:06 -04:00
|
|
|
end
|
|
|
|
|
2017-12-21 15:28:23 -05:00
|
|
|
resolve("ActiveStorage::Blob") { |blob, options| route_for(:rails_blob, blob, options) }
|
2017-11-21 14:17:12 -05:00
|
|
|
resolve("ActiveStorage::Attachment") { |attachment, options| route_for(:rails_blob, attachment.blob, options) }
|
2017-07-20 18:33:31 -04:00
|
|
|
|
2017-07-23 12:05:20 -04:00
|
|
|
|
2018-03-03 15:36:43 -05:00
|
|
|
get "/rails/active_storage/representations/:signed_blob_id/:variation_key/*filename" => "active_storage/representations#show", as: :rails_blob_representation
|
2017-07-21 17:25:01 -04:00
|
|
|
|
2018-03-03 15:36:43 -05:00
|
|
|
direct :rails_representation do |representation, options|
|
|
|
|
signed_blob_id = representation.blob.signed_id
|
|
|
|
variation_key = representation.variation.key
|
|
|
|
filename = representation.blob.filename
|
2017-07-20 18:33:31 -04:00
|
|
|
|
2018-03-03 15:36:43 -05:00
|
|
|
route_for(:rails_blob_representation, signed_blob_id, variation_key, filename, options)
|
2017-07-20 18:33:31 -04:00
|
|
|
end
|
2017-07-21 17:25:01 -04:00
|
|
|
|
2018-03-03 15:36:43 -05:00
|
|
|
resolve("ActiveStorage::Variant") { |variant, options| route_for(:rails_representation, variant, options) }
|
|
|
|
resolve("ActiveStorage::Preview") { |preview, options| route_for(:rails_representation, preview, options) }
|
2017-09-28 16:43:37 -04:00
|
|
|
|
|
|
|
|
2017-12-13 11:59:36 -05:00
|
|
|
get "/rails/active_storage/disk/:encoded_key/*filename" => "active_storage/disk#show", as: :rails_disk_service
|
|
|
|
put "/rails/active_storage/disk/:encoded_token" => "active_storage/disk#update", as: :update_rails_disk_service
|
|
|
|
post "/rails/active_storage/direct_uploads" => "active_storage/direct_uploads#create", as: :rails_direct_uploads
|
2017-07-20 18:33:31 -04:00
|
|
|
end
|