use main image instead of thumb

This commit is contained in:
yggverse 2026-03-20 02:46:54 +02:00
parent 666a9ce3c4
commit 666b57dffc

View file

@ -266,22 +266,22 @@ fn pre_format(data: &str, uploads: &mut HashSet<PathBuf>) -> String {
.unwrap() .unwrap()
.replace_all( .replace_all(
&Regex::new(r"<s>[^<]+</s>").unwrap().replace_all( &Regex::new(r"<s>[^<]+</s>").unwrap().replace_all(
&Regex::new(r"(?s)<UPL-IMAGE-PREVIEW([^>]+)>\[[^\]]+\]</UPL-IMAGE-PREVIEW>") &Regex::new(r"(?s)<UPL-IMAGE-PREVIEW[^>]+>([^<]+)</UPL-IMAGE-PREVIEW>")
.unwrap() .unwrap()
.replace_all(data, |c: &Captures| { .replace_all(data, |c: &Captures| {
uploads.insert( uploads.insert(
Regex::new(r#"url="([^"]+)""#) Regex::new(r#"url="?([^\s]+)"?"#)
.unwrap() .unwrap()
.captures(&c[1]) .captures(&c[1])
.unwrap()[1] .unwrap()[1]
.trim_start_matches("/") .trim_start_matches("/")
.replace("d/", "") .trim_start_matches("d/")
.into(), .into(),
); );
format!( format!(
"<img{}>", "<img{}>",
c[1].replace(" url=\"/", " src=\"") c[1].replace(" url=d/", " url=")
.replace(" url=\"d/", " src=\"") .replace(" url=/", " url=")
.replace(" url=", " src=") .replace(" url=", " src=")
) )
}), }),