" class="relative">
-

+
<% document_annots_index[index]&.each do |annot| %>
<%= render 'submissions/annotation', annot: %>
diff --git a/config/environments/production.rb b/config/environments/production.rb
index d218ff1f..4a577e81 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -52,6 +52,7 @@ Rails.application.configure do
end
config.active_storage.resolve_model_to_route = :rails_storage_proxy if ENV['ACTIVE_STORAGE_PUBLIC'] != 'true'
+ config.active_storage.service_urls_expire_in = 15.minutes
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb
index 8bd2fcb3..8a9b8aa5 100644
--- a/config/initializers/active_storage.rb
+++ b/config/initializers/active_storage.rb
@@ -10,7 +10,11 @@ ActiveSupport.on_load(:active_storage_attachment) do
end
def preview_image_url
- preview_images.joins(:blob).find_by(blob: { filename: '0.jpg' })&.url
+ first_page = preview_images.joins(:blob).find_by(blob: { filename: '0.jpg' })
+
+ return unless first_page
+
+ Rails.application.routes.url_helpers.rails_storage_proxy_url(first_page, **Docuseal.default_url_options)
end
end
diff --git a/lib/docuseal.rb b/lib/docuseal.rb
index bcbd4599..4f2a3e71 100644
--- a/lib/docuseal.rb
+++ b/lib/docuseal.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
module Docuseal
+ URL_CACHE = ActiveSupport::Cache::MemoryStore.new
PRODUCT_URL = 'https://www.docuseal.co'
NEWSLETTER_URL = "#{PRODUCT_URL}/newsletters".freeze
ENQUIRIES_URL = "#{PRODUCT_URL}/enquiries".freeze