Merge pull request #4 from redlib-org/fix_popular_localization
Fix /r/popular localization - set geo filter to global
This commit is contained in:
commit
1316c8491c
@ -331,3 +331,9 @@ pub async fn json(path: String, quarantine: bool) -> Result<Value, String> {
|
||||
Err(e) => err("Couldn't send request to Reddit", e),
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
async fn test_localization_popular() {
|
||||
let val = json("/r/popular/hot.json?&raw_json=1&geo_filter=GLOBAL".to_string(), false).await.unwrap();
|
||||
assert_eq!("GLOBAL", val["data"]["geo_filter"].as_str().unwrap());
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ pub async fn community(req: Request<Body>) -> Result<Response<Body>, String> {
|
||||
return Ok(nsfw_landing(req, req_url).await.unwrap_or_default());
|
||||
}
|
||||
|
||||
let path = format!("/r/{}/{}.json?{}&raw_json=1", sub_name.clone(), sort, req.uri().query().unwrap_or_default());
|
||||
let path = format!("/r/{sub_name}/{sort}.json?{}&raw_json=1&geo_filter=GLOBAL", req.uri().query().unwrap_or_default());
|
||||
let url = String::from(req.uri().path_and_query().map_or("", |val| val.as_str()));
|
||||
let redirect_url = url[1..].replace('?', "%3F").replace('&', "%26").replace('+', "%2B");
|
||||
let filters = get_filters(&req);
|
||||
|
Loading…
Reference in New Issue
Block a user