use signed uuid in previews
This commit is contained in:
@@ -5,6 +5,10 @@ ActiveSupport.on_load(:active_storage_attachment) do
|
||||
|
||||
has_many_attached :preview_images
|
||||
|
||||
def signed_uuid
|
||||
@signed_uuid ||= ApplicationRecord.signed_id_verifier.generate(uuid, expires_in: 6.hours)
|
||||
end
|
||||
|
||||
def preview_image_url
|
||||
preview_images.joins(:blob).find_by(blob: { filename: '0.jpg' })&.url
|
||||
end
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ Rails.application.routes.draw do
|
||||
resource :code_modal, only: %i[show], controller: 'templates_code_modal'
|
||||
resources :submissions_export, only: %i[index new]
|
||||
end
|
||||
resources :preview_document_page, only: %i[show], path: '/preview/:attachment_uuid'
|
||||
resources :preview_document_page, only: %i[show], path: '/preview/:signed_uuid'
|
||||
|
||||
resources :start_form, only: %i[show update], path: 'd', param: 'slug' do
|
||||
get :completed
|
||||
|
||||
Reference in New Issue
Block a user