diff --git a/app/assets/images/favicons/16x16.png b/app/assets/images/favicons/16x16.png index c73712dba..ed096c4e0 100644 Binary files a/app/assets/images/favicons/16x16.png and b/app/assets/images/favicons/16x16.png differ diff --git a/app/assets/images/favicons/32x32.png b/app/assets/images/favicons/32x32.png index d23898479..706a82259 100644 Binary files a/app/assets/images/favicons/32x32.png and b/app/assets/images/favicons/32x32.png differ diff --git a/app/assets/images/favicons/96x96.png b/app/assets/images/favicons/96x96.png index a4d73f1d7..fa679a50c 100644 Binary files a/app/assets/images/favicons/96x96.png and b/app/assets/images/favicons/96x96.png differ diff --git a/app/assets/images/favicons/apple-touch-icon.png b/app/assets/images/favicons/apple-touch-icon.png new file mode 100644 index 000000000..dc28ab041 Binary files /dev/null and b/app/assets/images/favicons/apple-touch-icon.png differ diff --git a/app/views/graphql/playground.html.haml b/app/views/graphql/playground.html.haml index 1f2a5dad6..c45cd4fb1 100644 --- a/app/views/graphql/playground.html.haml +++ b/app/views/graphql/playground.html.haml @@ -4,14 +4,14 @@ %meta{ "http-equiv": "Content-Type", content: "text/html; charset=UTF-8" } %meta{ "http-equiv": "X-UA-Compatible", content: "IE=edge" } %meta{ name: "viewport", content: "width=device-width, initial-scale=1" } + %meta{ name: "application-name", content: APPLICATION_NAME } + %meta{ name: "apple-mobile-web-app-title", content: APPLICATION_NAME } = csrf_meta_tags %title = content_for?(:title) ? "#{yield(:title)} · #{APPLICATION_NAME}" : APPLICATION_NAME - = favicon_link_tag(image_url("#{FAVICON_16PX_SRC}"), type: "image/png", sizes: "16x16") - = favicon_link_tag(image_url("#{FAVICON_32PX_SRC}"), type: "image/png", sizes: "32x32") - = favicon_link_tag(image_url("#{FAVICON_96PX_SRC}"), type: "image/png", sizes: "96x96") + = render partial: "layouts/favicons" = vite_client_tag = vite_typescript_tag 'playground' diff --git a/app/views/layouts/_favicons.html.haml b/app/views/layouts/_favicons.html.haml new file mode 100644 index 000000000..4c2ba2744 --- /dev/null +++ b/app/views/layouts/_favicons.html.haml @@ -0,0 +1,5 @@ += favicon_link_tag(image_url(FAVICONS_SRC["16px"]), type: "image/png", sizes: "16x16") if FAVICONS_SRC.key?("16px") += favicon_link_tag(image_url(FAVICONS_SRC["32px"]), type: "image/png", sizes: "32x32") if FAVICONS_SRC.key?("32px") += favicon_link_tag(image_url(FAVICONS_SRC["96px"]), type: "image/png", sizes: "96x96") if FAVICONS_SRC.key?("96px") += favicon_link_tag(image_url(FAVICONS_SRC["apple_touch"]), type: nil, sizes: "152x152", rel: "apple-touch-icon") if FAVICONS_SRC.key?("apple_touch") +%meta{ name: "theme-color", content: "#ffffff" } diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 281018841..932431329 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -4,14 +4,14 @@ %meta{ "http-equiv": "Content-Type", content: "text/html; charset=UTF-8" } %meta{ "http-equiv": "X-UA-Compatible", content: "IE=edge" } %meta{ name: "viewport", content: "width=device-width, initial-scale=1" } + %meta{ name: "application-name", content: APPLICATION_NAME } + %meta{ name: "apple-mobile-web-app-title", content: APPLICATION_NAME } = csrf_meta_tags %title = content_for?(:title) ? "#{sanitize(yield(:title))} · #{APPLICATION_NAME}" : APPLICATION_NAME - = favicon_link_tag(image_url("#{FAVICON_16PX_SRC}"), type: "image/png", sizes: "16x16") - = favicon_link_tag(image_url("#{FAVICON_32PX_SRC}"), type: "image/png", sizes: "32x32") - = favicon_link_tag(image_url("#{FAVICON_96PX_SRC}"), type: "image/png", sizes: "96x96") + = render partial: "layouts/favicons" = Gon::Base.render_data(camel_case: true, init: true, nonce: request.content_security_policy_nonce) diff --git a/app/views/layouts/component_preview.html.haml b/app/views/layouts/component_preview.html.haml index 82fcf217c..da52c5d1f 100644 --- a/app/views/layouts/component_preview.html.haml +++ b/app/views/layouts/component_preview.html.haml @@ -4,14 +4,14 @@ %meta{ "http-equiv": "Content-Type", content: "text/html; charset=UTF-8" } %meta{ "http-equiv": "X-UA-Compatible", content: "IE=edge" } %meta{ name: "viewport", content: "width=device-width, initial-scale=1" } + %meta{ name: "application-name", content: APPLICATION_NAME } + %meta{ name: "apple-mobile-web-app-title", content: APPLICATION_NAME } = csrf_meta_tags %title = content_for?(:title) ? "#{yield(:title)} · #{APPLICATION_NAME}" : APPLICATION_NAME - = favicon_link_tag(image_url("#{FAVICON_16PX_SRC}"), type: "image/png", sizes: "16x16") - = favicon_link_tag(image_url("#{FAVICON_32PX_SRC}"), type: "image/png", sizes: "32x32") - = favicon_link_tag(image_url("#{FAVICON_96PX_SRC}"), type: "image/png", sizes: "96x96") + = render partial: "layouts/favicons" = vite_client_tag = vite_javascript_tag 'application' diff --git a/app/views/layouts/print.html.haml b/app/views/layouts/print.html.haml index 5b3baa7b0..2de782bd2 100644 --- a/app/views/layouts/print.html.haml +++ b/app/views/layouts/print.html.haml @@ -3,14 +3,14 @@ %meta{ "http-equiv": "Content-Type", content: "text/html; charset=UTF-8" } %meta{ "http-equiv": "X-UA-Compatible", content: "IE=edge" } %meta{ name: "viewport", content: "width=device-width, initial-scale=1" } + %meta{ name: "application-name", content: APPLICATION_NAME } + %meta{ name: "apple-mobile-web-app-title", content: APPLICATION_NAME } = csrf_meta_tags %title = t("dynamics.page_title") - = favicon_link_tag(image_url("#{FAVICON_16PX_SRC}"), type: "image/png", sizes: "16x16") - = favicon_link_tag(image_url("#{FAVICON_32PX_SRC}"), type: "image/png", sizes: "32x32") - = favicon_link_tag(image_url("#{FAVICON_96PX_SRC}"), type: "image/png", sizes: "96x96") + = render partial: "layouts/favicons" %body = yield diff --git a/config/env.example.optional b/config/env.example.optional index 8935825e9..c9d341df6 100644 --- a/config/env.example.optional +++ b/config/env.example.optional @@ -46,9 +46,12 @@ DS_ENV="staging" # STATUS_PAGE_URL="" # Instance customization: Favicons ---> to be put in "app/assets/images" +# Search "real favicon generator" to find websites generating all these formats from a single image source. +# An empty string disable the icon if you don't care. # FAVICON_16PX_SRC="favicons/16x16.png" # FAVICON_32PX_SRC="favicons/32x32.png" # FAVICON_96PX_SRC="favicons/96x96.png" +# FAVICON_APPLE_TOUCH_152PX_SRC="favicons/apple-touch-icon.png" # Instance customization: Application logo ---> to be put in "app/assets/images" # HEADER_LOGO_SRC="marianne.png" diff --git a/config/initializers/images.rb b/config/initializers/images.rb index 161c9fc24..9bf0804dc 100644 --- a/config/initializers/images.rb +++ b/config/initializers/images.rb @@ -1,7 +1,10 @@ # Favicons -FAVICON_16PX_SRC = ENV.fetch("FAVICON_16PX_SRC", "favicons/16x16.png") -FAVICON_32PX_SRC = ENV.fetch("FAVICON_32PX_SRC", "favicons/32x32.png") -FAVICON_96PX_SRC = ENV.fetch("FAVICON_96PX_SRC", "favicons/96x96.png") +FAVICONS_SRC = { + "16px" => ENV.fetch("FAVICON_16PX_SRC", "favicons/16x16.png"), + "32px" => ENV.fetch("FAVICON_32PX_SRC", "favicons/32x32.png"), + "96px" => ENV.fetch("FAVICON_96PX_SRC", "favicons/96x96.png"), + "apple_touch" => ENV.fetch("FAVICON_APPLE_TOUCH_152PX_SRC", "favicons/apple-touch-icon.png") +}.compact_blank.freeze # Header logo HEADER_LOGO_SRC = ENV.fetch("HEADER_LOGO_SRC", "marianne.png")