Extend custom CSS cache time with digest paths (#33207)

This commit is contained in:
Matt Jankowski
2025-01-08 03:48:45 -05:00
committed by GitHub
parent b3243ef41c
commit c0264c8013
11 changed files with 142 additions and 6 deletions

View File

@@ -0,0 +1,18 @@
# frozen_string_literal: true
Rails.application.config.to_prepare do
custom_css = begin
Setting.custom_css
rescue ActiveRecord::AdapterError # Running without a database, not migrated, no connection, etc
nil
end
if custom_css.present?
Rails
.cache
.write(
:setting_digest_custom_css,
Digest::SHA256.hexdigest(custom_css)
)
end
end

View File

@@ -55,7 +55,8 @@ Rails.application.routes.draw do
get 'manifest', to: 'manifests#show', defaults: { format: 'json' }
get 'intent', to: 'intents#show'
get 'custom.css', to: 'custom_css#show', as: :custom_css
get 'custom.css', to: 'custom_css#show'
resources :custom_css, only: :show, path: :css
get 'remote_interaction_helper', to: 'remote_interaction_helper#index'