Merge remote-tracking branch 'parent/main' into upstream-20240109
This commit is contained in:
commit
d35fa72842
333 changed files with 4444 additions and 2541 deletions
|
@ -23,8 +23,49 @@ 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
|
||||
|
||||
def system_stylesheet
|
||||
stylesheet_link_tag(
|
||||
system_css_path,
|
||||
host: root_url,
|
||||
media: :all,
|
||||
skip_pipeline: true
|
||||
)
|
||||
end
|
||||
|
||||
def user_custom_stylesheet
|
||||
stylesheet_link_tag(
|
||||
user_custom_css_path({ version: user_custom_css_version }),
|
||||
host: root_url,
|
||||
media: :all,
|
||||
skip_pipeline: true
|
||||
)
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue