This commit is contained in:
spikecodes 2021-01-12 19:52:02 -08:00
parent 89fa0d5489
commit eb9a0dcb4a
5 changed files with 25 additions and 20 deletions

28
Cargo.lock generated
View File

@ -498,9 +498,9 @@ checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1f8e949d755f9d79112b5bb46938e0ef9d3804a0b16dfab13aafcaa5f0fa72" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"
[[package]] [[package]]
name = "bytestring" name = "bytestring"
@ -508,7 +508,7 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d" checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d"
dependencies = [ dependencies = [
"bytes 1.0.0", "bytes 1.0.1",
] ]
[[package]] [[package]]
@ -752,7 +752,7 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-task", "futures-task",
"memchr", "memchr",
"pin-project-lite 0.2.3", "pin-project-lite 0.2.4",
"pin-utils", "pin-utils",
"proc-macro-hack", "proc-macro-hack",
"proc-macro-nested", "proc-macro-nested",
@ -856,7 +856,7 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747"
dependencies = [ dependencies = [
"bytes 1.0.0", "bytes 1.0.1",
"fnv", "fnv",
"itoa", "itoa",
] ]
@ -1013,9 +1013,9 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.11" version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 0.1.10",
] ]
@ -1244,9 +1244,9 @@ checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b"
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.3" version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba36e0a6cc5a4c645073f4984f1ed55d09f5857d4de7c14550baa81a39ef5a17" checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@ -1472,18 +1472,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.118" version = "1.0.119"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" checksum = "9bdd36f49e35b61d49efd8aa7fc068fd295961fd2286d0b2ee9a4c7a14e99cc3"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.118" version = "1.0.119"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" checksum = "552954ce79a059ddd5fd68c271592374bd15cab2274970380c000118aeffe1cd"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1805,7 +1805,7 @@ checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"log", "log",
"pin-project-lite 0.2.3", "pin-project-lite 0.2.4",
"tracing-core", "tracing-core",
] ]

View File

@ -117,7 +117,7 @@ async fn parse_comments(json: &serde_json::Value) -> Vec<Comment> {
// Separate the comment JSON into a Vector of comments // Separate the comment JSON into a Vector of comments
let comment_data = match json["data"]["children"].as_array() { let comment_data = match json["data"]["children"].as_array() {
Some(f) => f.to_owned(), Some(f) => f.to_owned(),
None => { let v = Vec::new(); v } None => Vec::new(),
}; };
let mut comments: Vec<Comment> = Vec::new(); let mut comments: Vec<Comment> = Vec::new();

View File

@ -169,10 +169,15 @@ pub async fn media(data: &serde_json::Value) -> (String, String) {
format_url(data["secure_media"]["reddit_video"]["fallback_url"].as_str().unwrap_or_default()) format_url(data["secure_media"]["reddit_video"]["fallback_url"].as_str().unwrap_or_default())
} else if data["post_hint"].as_str().unwrap_or("") == "image" { } else if data["post_hint"].as_str().unwrap_or("") == "image" {
let preview = data["preview"]["images"][0].clone(); let preview = data["preview"]["images"][0].clone();
post_type = "image";
match preview["variants"]["mp4"].as_object() { match preview["variants"]["mp4"].as_object() {
Some(gif) => format_url(gif["source"]["url"].as_str().unwrap_or_default()), Some(gif) => {
None => format_url(preview["source"]["url"].as_str().unwrap_or_default()), post_type = "gif";
format_url(gif["source"]["url"].as_str().unwrap_or_default())
},
None => {
post_type = "image";
format_url(preview["source"]["url"].as_str().unwrap_or_default())
},
} }
} else if data["is_self"].as_bool().unwrap_or_default() { } else if data["is_self"].as_bool().unwrap_or_default() {
post_type = "self"; post_type = "self";

View File

@ -223,7 +223,7 @@ aside {
/* Sorting and Search */ /* Sorting and Search */
.search_label { .search_label {
max-width: 100px; max-width: 300px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;

View File

@ -66,7 +66,7 @@
<!-- POST MEDIA --> <!-- POST MEDIA -->
{% if post.post_type == "image" %} {% if post.post_type == "image" %}
<img class="post_media" src="{{ post.media }}"/> <img class="post_media" src="{{ post.media }}"/>
{% else if post.post_type == "video" %} {% else if post.post_type == "video" || post.post_type == "gif" %}
<video class="post_media" src="{{ post.media }}" controls autoplay loop></video> <video class="post_media" src="{{ post.media }}" controls autoplay loop></video>
{% else if post.post_type == "link" %} {% else if post.post_type == "link" %}
<a id="post_url" href="{{ post.media }}">{{ post.media }}</a> <a id="post_url" href="{{ post.media }}">{{ post.media }}</a>