mirror of
https://github.com/redlib-org/redlib.git
synced 2025-05-04 12:24:50 +00:00
Build Media Proxy
This commit is contained in:
parent
16bf825e14
commit
a1e57d874f
6 changed files with 142 additions and 34 deletions
|
@ -77,15 +77,15 @@ async fn media(data: &serde_json::Value) -> String {
|
|||
let media: String = if !has_media {
|
||||
format!(r#"<h4 class="post_body"><a href="{u}">{u}</a></h4>"#, u = data["data"]["url"].as_str().unwrap())
|
||||
} else {
|
||||
format!(r#"<img class="post_image" src="{}.png"/>"#, data["data"]["url"].as_str().unwrap())
|
||||
format!(r#"<img class="post_image" src="/imageproxy/{}.png"/>"#, data["data"]["url"].as_str().unwrap())
|
||||
};
|
||||
|
||||
match post_hint {
|
||||
"hosted:video" => format!(
|
||||
r#"<video class="post_image" src="{}" controls/>"#,
|
||||
r#"<video class="post_image" src="/imageproxy/{}" controls/>"#,
|
||||
data["data"]["media"]["reddit_video"]["fallback_url"].as_str().unwrap()
|
||||
),
|
||||
"image" => format!(r#"<img class="post_image" src="{}"/>"#, data["data"]["url"].as_str().unwrap()),
|
||||
"image" => format!(r#"<img class="post_image" src="/imageproxy/{}"/>"#, data["data"]["url"].as_str().unwrap()),
|
||||
"self" => String::from(""),
|
||||
_ => media,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue