From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Fri, 28 Feb 2025 11:27:18 +0000 (+0100) Subject: Generate icon entries dynamically X-Git-Tag: live^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/6ce0a13f599dbe4db657092d1e4f24bb15a5ef43?ds=sidebyside;hp=847d2c544b84d54de074213241ab813165395261 Generate icon entries dynamically --- diff --git a/app/assets/favicons/manifest.json.erb b/app/assets/favicons/manifest.json.erb index 0826e8841..8d806ac9a 100644 --- a/app/assets/favicons/manifest.json.erb +++ b/app/assets/favicons/manifest.json.erb @@ -1,43 +1,11 @@ { "name": "OpenStreetMap", - "icons": [ - { - "src": "<%= image_path("android-chrome-36x36.png").gsub("/", "\\/") %>", - "sizes": "36x36", - "type": "image\/png", - "density": "0.75" - }, - { - "src": "<%= image_path("android-chrome-48x48.png").gsub("/", "\\/") %>", - "sizes": "48x48", - "type": "image\/png", - "density": "1.0" - }, - { - "src": "<%= image_path("android-chrome-72x72.png").gsub("/", "\\/") %>", - "sizes": "72x72", - "type": "image\/png", - "density": "1.5" - }, - { - "src": "<%= image_path("android-chrome-96x96.png").gsub("/", "\\/") %>", - "sizes": "96x96", - "type": "image\/png", - "density": "2.0" - }, - { - "src": "<%= image_path("android-chrome-144x144.png").gsub("/", "\\/") %>", - "sizes": "144x144", - "type": "image\/png", - "density": "3.0" - }, - { - "src": "<%= image_path("android-chrome-192x192.png").gsub("/", "\\/") %>", - "sizes": "192x192", - "type": "image\/png", - "density": "4.0" - } - ], + "icons": <%= [36, 48, 72, 96, 144, 192].map { |res| { + src: image_path("android-chrome-#{res}x#{res}.png").gsub("/", "\\/"), + sizes: "#{res}x#{res}", + type: "image/png", + density: res.to_f / 48 + } }.to_json %>, "start_url": "/", "display": "minimal-ui" }