mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
Extend custom CSS cache time with digest paths (#33207)
This commit is contained in:
18
config/initializers/settings_digests.rb
Normal file
18
config/initializers/settings_digests.rb
Normal 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
|
||||
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user