Updated dependencies and fixed panic getting icons

This commit is contained in:
Daniel García 2019-07-30 19:38:54 +02:00
parent 8a21c6df10
commit c9c3f07171
No known key found for this signature in database
GPG key ID: FC8A7D14C3CD543A
4 changed files with 351 additions and 303 deletions

624
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -25,13 +25,13 @@ rocket = { version = "0.5.0-dev", features = ["tls"], default-features = false }
rocket_contrib = "0.5.0-dev" rocket_contrib = "0.5.0-dev"
# HTTP client # HTTP client
reqwest = "0.9.18" reqwest = "0.9.19"
# multipart/form-data support # multipart/form-data support
multipart = { version = "0.16.1", features = ["server"], default-features = false } multipart = { version = "0.16.1", features = ["server"], default-features = false }
# WebSockets library # WebSockets library
ws = "0.8.1" ws = "0.9.0"
# MessagePack library # MessagePack library
rmpv = "0.4.0" rmpv = "0.4.0"
@ -40,12 +40,12 @@ rmpv = "0.4.0"
chashmap = "2.2.2" chashmap = "2.2.2"
# A generic serialization/deserialization framework # A generic serialization/deserialization framework
serde = "1.0.94" serde = "1.0.98"
serde_derive = "1.0.94" serde_derive = "1.0.98"
serde_json = "1.0.40" serde_json = "1.0.40"
# Logging # Logging
log = "0.4.6" log = "0.4.8"
fern = { version = "0.5.8", features = ["syslog-4"] } fern = { version = "0.5.8", features = ["syslog-4"] }
# A safe, extensible ORM and Query builder # A safe, extensible ORM and Query builder
@ -99,14 +99,14 @@ native-tls = "0.2.3"
quoted_printable = "0.4.1" quoted_printable = "0.4.1"
# Template library # Template library
handlebars = "2.0.0" handlebars = "2.0.1"
# For favicon extraction from main website # For favicon extraction from main website
soup = "0.4.1" soup = "0.4.1"
regex = "1.1.9" regex = "1.2.0"
# URL encoding library # URL encoding library
percent-encoding = "1.0.1" percent-encoding = "2.0.0"
[patch.crates-io] [patch.crates-io]
# Add support for Timestamp type # Add support for Timestamp type

View file

@ -204,9 +204,13 @@ fn get_icon_url(domain: &str) -> Result<(Vec<Icon>, String), Error> {
let raw_cookies = content.headers().get_all("set-cookie"); let raw_cookies = content.headers().get_all("set-cookie");
cookie_str = raw_cookies cookie_str = raw_cookies
.iter() .iter()
.map(|raw_cookie| { .filter_map(|raw_cookie| raw_cookie.to_str().ok())
let cookie = Cookie::parse(raw_cookie.to_str().unwrap_or_default()).unwrap(); .map(|cookie_str| {
if let Ok(cookie) = Cookie::parse(cookie_str) {
format!("{}={}; ", cookie.name(), cookie.value()) format!("{}={}; ", cookie.name(), cookie.value())
} else {
String::new()
}
}) })
.collect::<String>(); .collect::<String>();

View file

@ -3,7 +3,7 @@ use lettre::smtp::ConnectionReuseParameters;
use lettre::{ClientSecurity, ClientTlsParameters, SmtpClient, SmtpTransport, Transport}; use lettre::{ClientSecurity, ClientTlsParameters, SmtpClient, SmtpTransport, Transport};
use lettre_email::{EmailBuilder, MimeMultipartType, PartBuilder}; use lettre_email::{EmailBuilder, MimeMultipartType, PartBuilder};
use native_tls::{Protocol, TlsConnector}; use native_tls::{Protocol, TlsConnector};
use percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
use quoted_printable::encode_to_str; use quoted_printable::encode_to_str;
use crate::api::EmptyResult; use crate::api::EmptyResult;
@ -103,7 +103,7 @@ pub fn send_invite(
"url": CONFIG.domain(), "url": CONFIG.domain(),
"org_id": org_id.unwrap_or_else(|| "_".to_string()), "org_id": org_id.unwrap_or_else(|| "_".to_string()),
"org_user_id": org_user_id.unwrap_or_else(|| "_".to_string()), "org_user_id": org_user_id.unwrap_or_else(|| "_".to_string()),
"email": percent_encode(address.as_bytes(), DEFAULT_ENCODE_SET).to_string().replace("+", "%2b"), "email": percent_encode(address.as_bytes(), NON_ALPHANUMERIC).to_string(),
"org_name": org_name, "org_name": org_name,
"token": invite_token, "token": invite_token,
}), }),