This commit is contained in:
spikecodes 2021-09-09 17:28:55 -07:00
parent 668493b72c
commit 6a4191f3b5
No known key found for this signature in database
GPG key ID: 004CECFF9B463BCB
8 changed files with 41 additions and 27 deletions

View file

@ -249,7 +249,7 @@ impl Post {
let title = esc!(post, "title");
// Determine the type of media along with the media URL
let (post_type, media, gallery) = Media::parse(&data).await;
let (post_type, media, gallery) = Media::parse(data).await;
posts.push(Self {
id: val(post, "id"),
@ -518,7 +518,8 @@ pub fn format_url(url: &str) -> String {
// Rewrite Reddit links to Libreddit in body of text
pub fn rewrite_urls(input_text: &str) -> String {
let text1 = Regex::new(r#"href="(https|http|)://(www\.|old\.|np\.|amp\.|)(reddit\.com|redd\.it)/"#).map_or(String::new(), |re| re.replace_all(input_text, r#"href="/"#).to_string());
let text1 =
Regex::new(r#"href="(https|http|)://(www\.|old\.|np\.|amp\.|)(reddit\.com|redd\.it)/"#).map_or(String::new(), |re| re.replace_all(input_text, r#"href="/"#).to_string());
// Rewrite external media previews to Libreddit
Regex::new(r"https://external-preview\.redd\.it(.*)[^?]").map_or(String::new(), |re| {