♻️ refactor: remove lifetime on handlebars
parent
88c3500fd0
commit
4bd38180d0
|
@ -33,7 +33,7 @@ use ptth_server::{
|
||||||
load_toml,
|
load_toml,
|
||||||
};
|
};
|
||||||
|
|
||||||
async fn handle_all (req: Request <Body>, state: Arc <State <'static>>)
|
async fn handle_all (req: Request <Body>, state: Arc <State>)
|
||||||
-> Result <Response <Body>, anyhow::Error>
|
-> Result <Response <Body>, anyhow::Error>
|
||||||
{
|
{
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
|
@ -61,9 +61,9 @@ pub struct Config {
|
||||||
pub file_server_root: Option <PathBuf>,
|
pub file_server_root: Option <PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct State <'a> {
|
pub struct State {
|
||||||
pub config: Config,
|
pub config: Config,
|
||||||
pub handlebars: handlebars::Handlebars <'a>,
|
pub handlebars: handlebars::Handlebars <'static>,
|
||||||
pub instance_metrics: metrics::Startup,
|
pub instance_metrics: metrics::Startup,
|
||||||
pub hidden_path: Option <PathBuf>,
|
pub hidden_path: Option <PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,8 @@ pub fn password_is_bad (mut password: String) -> bool {
|
||||||
ac.find (BAD_PASSWORDS).is_some ()
|
ac.find (BAD_PASSWORDS).is_some ()
|
||||||
}
|
}
|
||||||
|
|
||||||
struct State <'a> {
|
struct State {
|
||||||
file_server: file_server::State <'a>,
|
file_server: file_server::State,
|
||||||
config: Config,
|
config: Config,
|
||||||
gauges: RwLock <file_server::metrics::Gauges>,
|
gauges: RwLock <file_server::metrics::Gauges>,
|
||||||
client: Client,
|
client: Client,
|
||||||
|
@ -62,7 +62,7 @@ struct State <'a> {
|
||||||
// When file_server responds, wrap it back up and stream it to the relay.
|
// When file_server responds, wrap it back up and stream it to the relay.
|
||||||
|
|
||||||
async fn handle_one_req (
|
async fn handle_one_req (
|
||||||
state: &Arc <State <'static>>,
|
state: &Arc <State>,
|
||||||
wrapped_req: http_serde::WrappedRequest
|
wrapped_req: http_serde::WrappedRequest
|
||||||
) -> Result <(), ServerError>
|
) -> Result <(), ServerError>
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ async fn handle_one_req (
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_req_resp (
|
async fn handle_req_resp (
|
||||||
state: &Arc <State <'static>>,
|
state: &Arc <State>,
|
||||||
req_resp: reqwest::Response
|
req_resp: reqwest::Response
|
||||||
) -> Result <(), ServerError>
|
) -> Result <(), ServerError>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue