diff options
Diffstat (limited to 'app/views/pwa/manifest.json.erb')
-rw-r--r-- | app/views/pwa/manifest.json.erb | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/app/views/pwa/manifest.json.erb b/app/views/pwa/manifest.json.erb index 9abb759389d..65501b27451 100644 --- a/app/views/pwa/manifest.json.erb +++ b/app/views/pwa/manifest.json.erb @@ -1,27 +1,35 @@ { - "name": "<%= Appearance.current&.title.presence || _('GitLab') %>", - "short_name": "<%= appearance_short_name %>", - "description": "<%= Appearance.current&.description.presence || _("The complete DevOps platform. One application with endless possibilities. Organizations rely on GitLab’s source code management, CI/CD, security, and more to deliver software rapidly.") %>", + "name": "<%= appearance_pwa_name %>", + "short_name": "<%= appearance_pwa_short_name %>", + "description": "<%= appearance_pwa_description %>", "start_url": "<%= explore_projects_path %>", "scope": "<%= root_path %>", "display": "browser", "orientation": "any", "background_color": "#fff", "theme_color": "<%= user_theme_primary_color %>", - "icons": [{ - "src": "<%= Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, '/-/pwa-icons/logo-192.png') %>", - "sizes": "192x192", - "type": "image/png" - }, + "icons": [ + <% widths = Appearance::ALLOWED_PWA_ICON_SCALER_WIDTHS %> + <% widths.each do |width| -%> { - "src": "<%= Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, '/-/pwa-icons/logo-512.png') %>", - "sizes": "512x512", + <% if source = appearance_pwa_icon_path_scaled(width) -%> + "src": "<%= source %>", + "sizes": "<%= width.to_s + "x" + width.to_s %>", "type": "image/png" - }, - { - "src": "<%= Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, '/-/pwa-icons/maskable-logo.png') %>", + <% else -%> + "error": "<%= "#{width} is not an allowed PWA scale" %>" + <% end -%> + } + <% unless width == widths.last -%> + , + <% end -%> + <% end -%> + <% unless current_appearance&.pwa_icon.present? -%> + ,{ + "src": "<%= appearance_maskable_logo %>", "sizes": "512x512", "type": "image/png", "purpose": "maskable" - }] + } + <% end -%>] } |