1
0
mirror of synced 2025-12-23 21:07:12 -05:00

Serve /apple-touch-icon-120x120.png (#37667)

This commit is contained in:
Peter Bengtsson
2023-06-08 11:46:01 -04:00
committed by GitHub
parent 510eb08e18
commit 59c58f3eb4
2 changed files with 22 additions and 8 deletions

View File

@@ -17,16 +17,24 @@ const MAP = {
contentType: 'image/png',
buffer: getBuffer('assets/images/site/apple-touch-icon.png'),
},
// It's the same image but it's fine. By default, when Safari tries to
// to figure out which apple touch icons are available it will
// try to load this by default. For example, if you in desktop Safari
// click share icon, it will load this to serve as a preview icon.
'/apple-touch-icon-precomposed.png': {
'/apple-touch-icon-120x120.png': {
contentType: 'image/png',
buffer: getBuffer('assets/images/site/apple-touch-icon.png'),
buffer: getBuffer('assets/images/site/apple-touch-icon-120x120.png'),
},
'/apple-touch-icon-152x152.png': {
contentType: 'image/png',
buffer: getBuffer('assets/images/site/apple-touch-icon-152x152.png'),
},
}
// It's the same image but it's fine. By default, when Safari tries to
// to figure out which apple touch icons are available it will
// try to load this by default. For example, if you in desktop Safari
// click share icon, it will load this to serve as a preview icon.
MAP['/apple-touch-icon-precomposed.png'] = MAP['/apple-touch-icon.png']
MAP['/apple-touch-icon-120x120-precomposed.png'] = MAP['/apple-touch-icon-120x120.png']
MAP['/apple-touch-icon-152x152-precomposed.png'] = MAP['/apple-touch-icon-152x152.png']
function getBuffer(filePath) {
let buffer
if (!fs.existsSync(filePath)) {