0
0
Fork 0

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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 142 additions and 6 deletions

View file

@ -23,8 +23,31 @@ module ThemeHelper
end
end
def custom_stylesheet
if active_custom_stylesheet.present?
stylesheet_link_tag(
custom_css_path(active_custom_stylesheet),
host: root_url,
media: :all,
skip_pipeline: true
)
end
end
private
def active_custom_stylesheet
if cached_custom_css_digest.present?
[:custom, cached_custom_css_digest.to_s.first(8)]
.compact_blank
.join('-')
end
end
def cached_custom_css_digest
Rails.cache.read(:setting_digest_custom_css)
end
def theme_color_for(theme)
theme == 'mastodon-light' ? Themes::THEME_COLORS[:light] : Themes::THEME_COLORS[:dark]
end