From 7543695744cbed5a03a4131c512fa30f7706bae4 Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Sun, 22 Sep 2019 00:20:25 -0400 Subject: [PATCH] FIX: PWA install was broken due to missing basic logo The current manifest validation in Chrome requires at least one non-maskable icon to make it installable. This commit adds the maskable entry as another entry, following up on changes added in 3e590b8 --- app/controllers/metadata_controller.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rb index 51d1a1e1f88..279cb99345a 100644 --- a/app/controllers/metadata_controller.rb +++ b/app/controllers/metadata_controller.rb @@ -47,12 +47,16 @@ class MetadataController < ApplicationController } logo = SiteSetting.site_manifest_icon_url - manifest[:icons] << { - src: UrlHelper.absolute(logo), - purpose: "maskable", - sizes: "512x512", - type: MiniMime.lookup_by_filename(logo)&.content_type || "image/png" - } if logo + if logo + icon_entry = { + src: UrlHelper.absolute(logo), + sizes: "512x512", + type: MiniMime.lookup_by_filename(logo)&.content_type || "image/png" + } + manifest[:icons] << icon_entry.dup + icon_entry[:purpose] = "maskable" + manifest[:icons] << icon_entry + end manifest[:short_name] = SiteSetting.short_title if SiteSetting.short_title.present?