mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 05:19: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;
|
||||
}
|
||||
|
||||
if pattern.ends_with("*") && ip.starts_with(&pattern.replace("*", "")){
|
||||
if pattern.ends_with('*') && ip.starts_with(&pattern.replace('*', "")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -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)?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user