mirror of
https://github.com/redlib-org/redlib.git
synced 2025-05-14 14:02:50 +00:00
Add "hide nsfw" option
This commit is contained in:
parent
3d142afd03
commit
b13874d0db
10 changed files with 98 additions and 75 deletions
|
@ -1,5 +1,5 @@
|
|||
// CRATES
|
||||
use crate::utils::{cookie, error, fetch_posts, format_num, format_url, param, request, rewrite_url, val, Post, Subreddit};
|
||||
use crate::utils::{error, fetch_posts, format_num, format_url, param, prefs, request, rewrite_url, val, Post, Preferences, Subreddit};
|
||||
use actix_web::{HttpRequest, HttpResponse, Result};
|
||||
use askama::Template;
|
||||
|
||||
|
@ -11,7 +11,7 @@ struct SubredditTemplate {
|
|||
posts: Vec<Post>,
|
||||
sort: (String, String),
|
||||
ends: (String, String),
|
||||
layout: String,
|
||||
prefs: Preferences,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
|
@ -41,7 +41,7 @@ pub async fn page(req: HttpRequest) -> HttpResponse {
|
|||
posts,
|
||||
sort: (sort, param(&path, "t")),
|
||||
ends: (param(&path, "after"), after),
|
||||
layout: cookie(req, "layout"),
|
||||
prefs: prefs(req),
|
||||
}
|
||||
.render()
|
||||
.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue