Cache headers for web app manifest based on user theme

This commit is contained in:
Karina Kwiatek 2023-01-27 23:08:12 +01:00
parent 420627f3ad
commit b8b86b069d
1 changed files with 12 additions and 4 deletions

View File

@ -3,7 +3,13 @@
class ManifestsController < ApplicationController
include ThemeHelper
skip_before_action :banned?
skip_before_action :find_active_announcements
def show
expires_in 1.day
return if fresh_when current_user&.theme
render json: {
name: APP_CONFIG["site_name"],
description: t("about.index.subtitle"),
@ -12,17 +18,19 @@ class ManifestsController < ApplicationController
display: "standalone",
categories: %w[social],
lang: I18n.locale,
shortcuts: [
webapp_shortcut(inbox_url, t("navigation.inbox"), "inbox")
],
shortcuts:,
icons: webapp_icons,
theme_color: theme_color,
theme_color:,
background_color: mobile_theme_color
}
end
private
def shortcuts = [
webapp_shortcut(inbox_url, t("navigation.inbox"), "inbox")
]
def webapp_shortcut(url, name, icon_name)
{
name: name,