mirror of
https://github.com/YGGverse/hlstate-rs.git
synced 2026-03-31 17:15:37 +00:00
connect masters
This commit is contained in:
parent
af0c69c4c5
commit
204b64a4f9
3 changed files with 9 additions and 4 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::net::IpAddr;
|
use std::net::{IpAddr, SocketAddr};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub title: String,
|
pub debug: bool,
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
pub format_time: String,
|
pub format_time: String,
|
||||||
pub host: IpAddr,
|
pub host: IpAddr,
|
||||||
|
pub masters: Vec<SocketAddr>,
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
pub debug: bool,
|
pub title: String,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,5 @@ use rocket::serde::Serialize;
|
||||||
#[serde(crate = "rocket::serde")]
|
#[serde(crate = "rocket::serde")]
|
||||||
pub struct Global {
|
pub struct Global {
|
||||||
pub format_time: String,
|
pub format_time: String,
|
||||||
|
pub masters: Vec<std::net::SocketAddr>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,10 @@ fn index(meta: &State<Meta>, global: &State<Global>) -> Result<Template, Status>
|
||||||
Ok(Template::render(
|
Ok(Template::render(
|
||||||
"index",
|
"index",
|
||||||
context! {
|
context! {
|
||||||
title: &meta.title,
|
masters: &global.masters,
|
||||||
servers: servers,
|
servers: servers,
|
||||||
|
title: &meta.title,
|
||||||
|
version: &meta.version,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -48,6 +50,7 @@ fn rocket() -> _ {
|
||||||
})
|
})
|
||||||
.manage(Global {
|
.manage(Global {
|
||||||
format_time: config.format_time,
|
format_time: config.format_time,
|
||||||
|
masters: config.masters,
|
||||||
})
|
})
|
||||||
.manage(Meta {
|
.manage(Meta {
|
||||||
description: config.description,
|
description: config.description,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue