make apple-touch-icon AppIcon instead of SiteFavicon

This commit is contained in:
Sam Denty 2022-10-16 14:14:46 +01:00
parent 457de7a8e5
commit bed4ab8825
No known key found for this signature in database
GPG key ID: 7B4EAF7B9E291B79
3 changed files with 8 additions and 3 deletions

2
Cargo.lock generated
View file

@ -1525,7 +1525,7 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
[[package]] [[package]]
name = "site_icons" name = "site_icons"
version = "0.3.7" version = "0.3.8"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"clap", "clap",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "site_icons" name = "site_icons"
version = "0.3.7" version = "0.3.8"
authors = ["Sam Denty <sam@samdenty.com>"] authors = ["Sam Denty <sam@samdenty.com>"]
edition = "2018" edition = "2018"
license = "GPL-3.0" license = "GPL-3.0"

View file

@ -130,9 +130,14 @@ impl Icons {
)) { )) {
let elem = elem_ref.value(); let elem = elem_ref.value();
if let Some(href) = elem.attr("href").and_then(|href| url.join(&href).ok()) { if let Some(href) = elem.attr("href").and_then(|href| url.join(&href).ok()) {
let rel = elem.attr("rel").unwrap();
self.add_icon( self.add_icon(
href, href,
IconKind::SiteFavicon, if rel.contains("apple-touch-icon") {
IconKind::AppIcon
} else {
IconKind::SiteFavicon
},
elem.attr("sizes").map(|sizes| sizes.into()), elem.attr("sizes").map(|sizes| sizes.into()),
); );