Fix wiki routing

This commit is contained in:
spikecodes 2021-03-17 21:40:55 -07:00
parent 0ce2d9054e
commit a81502dde1
No known key found for this signature in database
GPG key ID: 004CECFF9B463BCB
3 changed files with 27 additions and 16 deletions

View file

@ -21,7 +21,11 @@ struct UserTemplate {
// FUNCTIONS
pub async fn profile(req: Request<Body>) -> Result<Response<Body>, String> {
// Build the Reddit JSON API path
let path = format!("{}.json?{}&raw_json=1", req.uri().path(), req.uri().query().unwrap_or_default());
let path = format!(
"/user/{}.json?{}&raw_json=1",
req.param("name").unwrap_or("reddit".to_string()),
req.uri().query().unwrap_or_default()
);
// Retrieve other variables from Libreddit request
let sort = param(&path, "sort");