diff --git a/Cargo.lock b/Cargo.lock index 6cd6da3..a5b49c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -177,7 +177,7 @@ dependencies = [ "dtoa-short", "itoa 0.4.8", "matches", - "phf", + "phf 0.8.0", "proc-macro2", "quote", "smallvec", @@ -527,9 +527,9 @@ dependencies = [ [[package]] name = "html5ever" -version = "0.25.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" +checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" dependencies = [ "log", "mac", @@ -727,13 +727,13 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] name = "markup5ever" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" +checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" dependencies = [ "log", - "phf", - "phf_codegen", + "phf 0.10.1", + "phf_codegen 0.10.0", "string_cache", "string_cache_codegen", "tendril", @@ -933,6 +933,15 @@ dependencies = [ "proc-macro-hack", ] +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared 0.10.0", +] + [[package]] name = "phf_codegen" version = "0.8.0" @@ -943,6 +952,16 @@ dependencies = [ "phf_shared 0.8.0", ] +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", +] + [[package]] name = "phf_generator" version = "0.8.0" @@ -1308,9 +1327,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scraper" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e02aa790c80c2e494130dec6a522033b6a23603ffc06360e9fe6c611ea2c12" +checksum = "5684396b456f3eb69ceeb34d1b5cb1a2f6acf7ca4452131efa3ba0ee2c2d0a70" dependencies = [ "cssparser", "ego-tree", @@ -1357,8 +1376,8 @@ dependencies = [ "fxhash", "log", "matches", - "phf", - "phf_codegen", + "phf 0.8.0", + "phf_codegen 0.8.0", "precomputed-hash", "servo_arc", "smallvec", @@ -1494,7 +1513,7 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "site_icons" -version = "0.1.12" +version = "0.1.13" dependencies = [ "byteorder", "clap", diff --git a/Cargo.toml b/Cargo.toml index 746cf2c..ac5613c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "site_icons" -version = "0.1.12" +version = "0.1.13" authors = ["Sam Denty "] edition = "2018" license = "GPL-3.0" @@ -22,13 +22,13 @@ clap = { version = "3.1.7", features = ["derive"] } vec1 = { version = "1.6.0", features = ["serde"] } itertools = "0.10.0" serde_with = "1.6.2" -html5ever = "0.25.1" +html5ever = "0.26.0" percent-encoding = "2.1.0" url = { version = "2.2.0", features = ["serde"] } regex = "1" log = "0.4.14" once_cell = "1.5.2" -scraper = "0.12.0" +scraper = "0.13.0" tokio-futures-byteorder = { version = "0.2.0", features = ["futures"] } byteorder = "1.4.2" data-url = "0.1.0" diff --git a/src/icon_info.rs b/src/icon_info.rs index 73f7273..b07aeba 100644 --- a/src/icon_info.rs +++ b/src/icon_info.rs @@ -33,10 +33,10 @@ impl IconInfo { pub async fn load( url: Url, sizes: Option, - ) -> Result> { + ) -> Result> { let sizes = sizes.as_ref().and_then(|s| IconSizes::from_str(s).ok()); - let (mime, mut body): (_, Box) = match url.scheme() { + let (mime, mut body): (_, Box) = match url.scheme() { "data" => { let url = url.to_string(); let url = DataUrl::process(&url).map_err(|_| "failed to parse data uri")?; diff --git a/src/icon_size/ico.rs b/src/icon_size/ico.rs index 8e5486d..3c7d64f 100644 --- a/src/icon_size/ico.rs +++ b/src/icon_size/ico.rs @@ -12,7 +12,7 @@ const INDEX_SIZE: u16 = 16; pub async fn get_ico_sizes( reader: &mut R, -) -> Result> { +) -> Result> { let mut offset = 0; let mut header = [0; 6]; reader.read_exact(&mut header).await?; diff --git a/src/icon_size/jpeg.rs b/src/icon_size/jpeg.rs index 012e8c7..6c32faa 100644 --- a/src/icon_size/jpeg.rs +++ b/src/icon_size/jpeg.rs @@ -6,7 +6,7 @@ use tokio_futures_byteorder::AsyncReadBytesExt; pub async fn get_jpeg_size( reader: &mut R, -) -> Result> { +) -> Result> { let mut data = [0; 2]; reader.read_exact(&mut data).await?; let data = &mut Cursor::new(data); diff --git a/src/icon_size/mod.rs b/src/icon_size/mod.rs index cd5ae31..398f172 100644 --- a/src/icon_size/mod.rs +++ b/src/icon_size/mod.rs @@ -88,7 +88,7 @@ fn slice_eq( cur: &mut T, offset: u64, slice: &[u8], -) -> Result> { +) -> Result> { cur.seek(SeekFrom::Start(offset))?; let mut buffer = vec![0; slice.len()]; cur.read_exact(&mut buffer)?; diff --git a/src/icon_size/png.rs b/src/icon_size/png.rs index 8d47d57..8223b91 100644 --- a/src/icon_size/png.rs +++ b/src/icon_size/png.rs @@ -5,7 +5,7 @@ use std::{error::Error, io::Cursor}; pub async fn get_png_sizes( reader: &mut R, -) -> Result> { +) -> Result> { let mut header = [0; 24]; reader.read_exact(&mut header).await?; let header = &mut Cursor::new(header); diff --git a/src/icons.rs b/src/icons.rs index e91f8d4..ec4fed6 100644 --- a/src/icons.rs +++ b/src/icons.rs @@ -19,7 +19,7 @@ pub struct Icons { Url, ( IconKind, - Pin>> + Send + Sync>>, + Pin>>>>, ), >, } @@ -28,7 +28,7 @@ fn add_icon_entry( entries: &mut Vec, url: Url, kind: IconKind, - info: Result>, + info: Result>, ) { match info { Ok(info) => entries.push(Icon { url, kind, info }), diff --git a/src/lib.rs b/src/lib.rs index c993988..9989f13 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,18 +38,13 @@ pub use icons::*; use once_cell::sync::Lazy; use reqwest::{ header::{HeaderMap, HeaderValue, USER_AGENT}, - redirect::Policy, Client, }; static CLIENT: Lazy = Lazy::new(|| { let mut headers = HeaderMap::new(); headers.insert(USER_AGENT, HeaderValue::from_str("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36").unwrap()); - Client::builder() - .default_headers(headers) - .redirect(Policy::limited(20)) - .build() - .unwrap() + Client::builder().default_headers(headers).build().unwrap() }); #[cfg(test)]