Drop favicon.ico generation (#30375)

pull/2760/head
Claire 2024-06-26 15:44:08 +02:00 committed by GitHub
parent 2b43c05a6a
commit 7a84b76bb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 4 additions and 16 deletions

View File

@ -31,17 +31,10 @@ class SiteUpload < ApplicationRecord
[:"#{size}", { format: 'png', geometry: "#{size}x#{size}#", file_geometry_parser: FastGeometryParser }]
end.freeze,
favicon: {
ico: {
format: 'ico',
geometry: '48x48#',
file_geometry_parser: FastGeometryParser,
}.freeze,
}.merge(
favicon:
FAVICON_SIZES.to_h do |size|
[:"#{size}", { format: 'png', geometry: "#{size}x#{size}#", file_geometry_parser: FastGeometryParser }]
end
).freeze,
end.freeze,
thumbnail: {
'@1x': {

View File

@ -11,8 +11,6 @@
- if storage_host?
%link{ rel: 'dns-prefetch', href: storage_host }/
%link{ rel: 'icon', href: favicon_path('ico') || '/favicon.ico', type: 'image/x-icon' }/
- SiteUpload::FAVICON_SIZES.each do |size|
%link{ rel: 'icon', sizes: "#{size}x#{size}", href: favicon_path(size.to_i) || frontend_asset_path("icons/favicon-#{size}x#{size}.png"), type: 'image/png' }/

View File

@ -23,5 +23,5 @@
<!-- Disallow any coder by default, and only enable ones required by Mastodon -->
<policy domain="coder" rights="none" pattern="*" />
<policy domain="coder" rights="read | write" pattern="{JPEG,PNG,GIF,WEBP,HEIC,AVIF}" />
<policy domain="coder" rights="write" pattern="{HISTOGRAM,RGB,INFO,ICO}" />
<policy domain="coder" rights="write" pattern="{HISTOGRAM,RGB,INFO}" />
</policymap>

View File

@ -42,7 +42,6 @@ namespace :branding do
output_dest = Rails.root.join('app', 'javascript', 'icons')
rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '-w :size -h :size --keep-aspect-ratio :input -o :output')
convert = Terrapin::CommandLine.new('convert', ':input :output', environment: { 'MAGICK_CONFIGURE_PATH' => nil })
favicon_sizes = [16, 32, 48]
apple_icon_sizes = [57, 60, 72, 76, 114, 120, 144, 152, 167, 180, 1024]
@ -56,8 +55,6 @@ namespace :branding do
rsvg_convert.run(size: size, input: favicon_source, output: output_path)
end
convert.run(input: favicons, output: Rails.public_path.join('favicon.ico'))
apple_icon_sizes.each do |size|
rsvg_convert.run(size: size, input: app_icon_source, output: output_dest.join("apple-touch-icon-#{size}x#{size}.png"))
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -9,7 +9,7 @@ describe 'The account show page' do
get '/@alice'
expect(head_link_icons.size).to eq(4) # One general favicon and three with sizes
expect(head_link_icons.size).to eq(3) # Three favicons with sizes
expect(head_meta_content('og:title')).to match alice.display_name
expect(head_meta_content('og:type')).to eq 'profile'