Merge pull request #1004 from Retrospring/cache-headers-on-manifest

Cache headers for web app manifest based on user theme
This commit is contained in:
Karina Kwiatek 2023-01-28 11:13:08 +01:00 committed by GitHub
commit 1c74061c1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,