1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 05:19:21 +00:00

Improve code readability

This commit is contained in:
Pierre HUBERT 2022-03-17 18:24:10 +01:00
parent 3c202d7afa
commit 22f9670560
2 changed files with 8 additions and 6 deletions

View File

@ -20,7 +20,7 @@ pub fn match_ip(pattern: &str, ip: &str) -> bool {
return true;
}
if pattern.ends_with("*") && ip.starts_with(&pattern.replace("*", "")){
if pattern.ends_with('*') && ip.starts_with(&pattern.replace('*', "")) {
return true;
}

View File

@ -11,11 +11,13 @@ use crate::data::post::PostWebLink;
/// Attempt to get information about a URL given by a user
pub fn get_post_web_link(url: &str) -> Res<PostWebLink> {
let mut options = WebpageOptions::default();
options.max_redirections = 2;
options.follow_location = true;
options.useragent = "OpenGraph Fetcher v1.0".to_string();
options.timeout = Duration::from_secs(3);
let options = WebpageOptions {
allow_insecure: false,
follow_location: false,
max_redirections: 0,
timeout: Duration::from_secs(3),
useragent: "OpenGraph Fetcher v1.0".to_string()
};
let page = Webpage::from_url(url, options)?;