mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-08 07:37:45 +00:00
Restrict Proxy to Reddit Domains
This commit is contained in:
parent
f49bff9853
commit
5ea504e6e8
14 changed files with 156 additions and 61 deletions
|
@ -14,7 +14,8 @@ struct UserTemplate {
|
|||
ends: (String, String),
|
||||
}
|
||||
|
||||
pub async fn profile(req: HttpRequest) -> Result<HttpResponse> {
|
||||
// FUNCTIONS
|
||||
pub async fn profile(req: HttpRequest) -> HttpResponse {
|
||||
// Build the Reddit JSON API path
|
||||
let path = format!("{}.json?{}&raw_json=1", req.path(), req.query_string());
|
||||
|
||||
|
@ -36,7 +37,7 @@ pub async fn profile(req: HttpRequest) -> Result<HttpResponse> {
|
|||
}
|
||||
.render()
|
||||
.unwrap();
|
||||
Ok(HttpResponse::Ok().content_type("text/html").body(s))
|
||||
HttpResponse::Ok().content_type("text/html").body(s)
|
||||
}
|
||||
// If there is an error show error page
|
||||
Err(msg) => error(msg.to_string()).await,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue