mirror of
https://github.com/redlib-org/redlib.git
synced 2025-05-04 20:30:37 +00:00
Wide UI Mode
This commit is contained in:
parent
a0866b251e
commit
f445c42f55
13 changed files with 102 additions and 64 deletions
|
@ -1,5 +1,5 @@
|
|||
// CRATES
|
||||
use crate::utils::{cookie, error, format_num, format_url, media, param, request, rewrite_url, val, Comment, Flags, Flair, Post};
|
||||
use crate::utils::{Comment, Flags, Flair, Post, Preferences, cookie, error, format_num, format_url, media, param, prefs, request, rewrite_url, val};
|
||||
use actix_web::{HttpRequest, HttpResponse};
|
||||
|
||||
use async_recursion::async_recursion;
|
||||
|
@ -14,6 +14,7 @@ struct PostTemplate {
|
|||
comments: Vec<Comment>,
|
||||
post: Post,
|
||||
sort: String,
|
||||
prefs: Preferences
|
||||
}
|
||||
|
||||
pub async fn item(req: HttpRequest) -> HttpResponse {
|
||||
|
@ -45,7 +46,7 @@ pub async fn item(req: HttpRequest) -> HttpResponse {
|
|||
let comments = parse_comments(&res[1]).await;
|
||||
|
||||
// Use the Post and Comment structs to generate a website to show users
|
||||
let s = PostTemplate { comments, post, sort }.render().unwrap();
|
||||
let s = PostTemplate { comments, post, sort, prefs: prefs(req) }.render().unwrap();
|
||||
HttpResponse::Ok().content_type("text/html").body(s)
|
||||
}
|
||||
// If the Reddit API returns an error, exit and send error page to user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue