Skip to content

Commit

Permalink
Fix banner
Browse files Browse the repository at this point in the history
  • Loading branch information
drakeerv committed Nov 26, 2024
1 parent 163b1f0 commit dfa74ce
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pasted"
version = "1.2.26"
version = "1.2.27"
edition = "2021"
authors = ["drakeerv <drakeerv@outlook.com>"]
description = "A pastebin frontend written in Rust"
Expand Down
4 changes: 3 additions & 1 deletion src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use once_cell::sync::Lazy;
use std::{collections::HashMap, env, process};
use tera::{Error, Result, Tera, Value};

pub static BANNER: Lazy<String> = Lazy::new(|| env::var("BANNER").unwrap_or_default());

#[cfg(feature = "include_templates")]
use include_dir::include_dir;

Expand Down Expand Up @@ -88,7 +90,7 @@ fn format_bytes(value: &Value, _: &HashMap<String, Value>) -> Result<Value> {
}

fn get_banner(_: &HashMap<String, Value>) -> Result<Value> {
Ok(tera::to_value(env::var("BANNER").unwrap_or_default()).unwrap())
Ok(tera::to_value(BANNER.clone()).unwrap())
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<body>
{% if get_banner() != "" %}
<div id="banner">
{{ get_banner() }}
{{ get_banner() | safe }}
</div>
{% endif %}
<div id="nav">
Expand Down

0 comments on commit dfa74ce

Please sign in to comment.