mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-24 18:10:58 +00:00
WIP: Various subreddit & post fixes (#215)
* Fixed random subreddit issue * Fixed large subreddit icon rendering * Formatting fix * Fix dodgy HTML rendering issues * Revert "Fix dodgy HTML rendering issues" This reverts commit 58be5f449b72f271d2b3c046870b652d1e715289.
This commit is contained in:
parent
e34329cfee
commit
536a766960
3 changed files with 39 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
// CRATES
|
||||
use crate::utils::{cookie, error, format_num, format_url, param, template, val, Post, Preferences};
|
||||
use crate::utils::{catch_random, cookie, error, format_num, format_url, param, template, val, Post, Preferences};
|
||||
use crate::{client::json, RequestExt};
|
||||
use askama::Template;
|
||||
use hyper::{Body, Request, Response};
|
||||
|
@ -38,6 +38,10 @@ pub async fn find(req: Request<Body>) -> Result<Response<Body>, String> {
|
|||
let nsfw_results = if cookie(&req, "show_nsfw") == "on" { "&include_over_18=on" } else { "" };
|
||||
let path = format!("{}.json?{}{}", req.uri().path(), req.uri().query().unwrap_or_default(), nsfw_results);
|
||||
let sub = req.param("sub").unwrap_or_default();
|
||||
// Handle random subreddits
|
||||
if let Ok(random) = catch_random(&sub, "/find").await {
|
||||
return Ok(random);
|
||||
}
|
||||
let query = param(&path, "q");
|
||||
|
||||
let sort = if param(&path, "sort").is_empty() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue