diff --git a/src/post.rs b/src/post.rs
index 397f1ac..7308e01 100644
--- a/src/post.rs
+++ b/src/post.rs
@@ -90,6 +90,7 @@ async fn parse_post(json: &serde_json::Value) -> Post {
post["data"]["author_flair_richtext"].as_array(),
post["data"]["author_flair_text"].as_str(),
),
+ text: val(post, "link_flair_text"),
background_color: val(post, "author_flair_background_color"),
foreground_color: val(post, "author_flair_text_color"),
},
@@ -112,6 +113,7 @@ async fn parse_post(json: &serde_json::Value) -> Post {
post["data"]["link_flair_richtext"].as_array(),
post["data"]["link_flair_text"].as_str(),
),
+ text: val(post, "link_flair_text"),
background_color: val(post, "link_flair_background_color"),
foreground_color: if val(post, "link_flair_text_color") == "dark" {
"black".to_string()
@@ -186,6 +188,7 @@ async fn parse_comments(json: &serde_json::Value, post_link: &str, post_author:
data["author_flair_richtext"].as_array(),
data["author_flair_text"].as_str(),
),
+ text: val(&comment, "link_flair_text"),
background_color: val(&comment, "author_flair_background_color"),
foreground_color: val(&comment, "author_flair_text_color"),
},
diff --git a/src/search.rs b/src/search.rs
index 247a1ac..1771988 100644
--- a/src/search.rs
+++ b/src/search.rs
@@ -36,6 +36,7 @@ pub async fn find(req: Request<()>) -> tide::Result {
let nsfw_results = if cookie(&req, "show_nsfw") == "on" { "&include_over_18=on" } else { "" };
let path = format!("{}.json?{}{}", req.url().path(), req.url().query().unwrap_or_default(), nsfw_results);
let sub = req.param("sub").unwrap_or("").to_string();
+ let query = param(&path, "q");
let sort = if param(&path, "sort").is_empty() {
"relevance".to_string()
@@ -44,7 +45,7 @@ pub async fn find(req: Request<()>) -> tide::Result {
};
let subreddits = if param(&path, "restrict_sr").is_empty() {
- search_subreddits(param(&path, "q")).await
+ search_subreddits(&query).await
} else {
Vec::new()
};
@@ -55,7 +56,7 @@ pub async fn find(req: Request<()>) -> tide::Result {
subreddits,
sub,
params: SearchParams {
- q: param(&path, "q"),
+ q: query.replace('"', """),
sort,
t: param(&path, "t"),
before: param(&path, "after"),
@@ -68,7 +69,7 @@ pub async fn find(req: Request<()>) -> tide::Result {
}
}
-async fn search_subreddits(q: String) -> Vec
{% if post.flair.flair_parts.len() > 0 %} - {% call render_flair(post.flair.flair_parts) %} + + {% call render_flair(post.flair.flair_parts) %} + {% endif %} {{ post.title }}{% if post.flags.nsfw %} NSFW{% endif %}
@@ -87,9 +89,9 @@ {% else if (prefs.layout.is_empty() || prefs.layout == "card") && post.post_type == "gif" %} - + {% else if (prefs.layout.is_empty() || prefs.layout == "card") && post.post_type == "video" %} - + {% else if post.post_type != "self" %} {% if post.thumbnail.url.is_empty() %}