mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-07 15:17:47 +00:00
Add "open in reddit" button to all pages (#304)
* Pass the url parameter to all templates. Add a reddit_link to the navbar, which opens the current url on reddit. * Add icon for reddit link Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
This commit is contained in:
parent
2486347b14
commit
0f7ba3c61d
7 changed files with 30 additions and 2 deletions
|
@ -341,6 +341,7 @@ pub struct Comment {
|
|||
pub struct ErrorTemplate {
|
||||
pub msg: String,
|
||||
pub prefs: Preferences,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -606,9 +607,11 @@ pub fn redirect(path: String) -> Response<Body> {
|
|||
}
|
||||
|
||||
pub async fn error(req: Request<Body>, msg: String) -> Result<Response<Body>, String> {
|
||||
let url = req.uri().to_string();
|
||||
let body = ErrorTemplate {
|
||||
msg,
|
||||
prefs: Preferences::new(req),
|
||||
url: url,
|
||||
}
|
||||
.render()
|
||||
.unwrap_or_default();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue