mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 13:29:21 +00:00
Improve code readability
This commit is contained in:
parent
3c202d7afa
commit
22f9670560
@ -20,7 +20,7 @@ pub fn match_ip(pattern: &str, ip: &str) -> bool {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if pattern.ends_with("*") && ip.starts_with(&pattern.replace("*", "")){
|
if pattern.ends_with('*') && ip.starts_with(&pattern.replace('*', "")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,11 +11,13 @@ use crate::data::post::PostWebLink;
|
|||||||
|
|
||||||
/// Attempt to get information about a URL given by a user
|
/// Attempt to get information about a URL given by a user
|
||||||
pub fn get_post_web_link(url: &str) -> Res<PostWebLink> {
|
pub fn get_post_web_link(url: &str) -> Res<PostWebLink> {
|
||||||
let mut options = WebpageOptions::default();
|
let options = WebpageOptions {
|
||||||
options.max_redirections = 2;
|
allow_insecure: false,
|
||||||
options.follow_location = true;
|
follow_location: false,
|
||||||
options.useragent = "OpenGraph Fetcher v1.0".to_string();
|
max_redirections: 0,
|
||||||
options.timeout = Duration::from_secs(3);
|
timeout: Duration::from_secs(3),
|
||||||
|
useragent: "OpenGraph Fetcher v1.0".to_string()
|
||||||
|
};
|
||||||
|
|
||||||
let page = Webpage::from_url(url, options)?;
|
let page = Webpage::from_url(url, options)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user