mirror of
https://github.com/YGGverse/hlstate-rs.git
synced 2026-04-01 01:25:38 +00:00
make xash3d-query script path configurable
This commit is contained in:
parent
44a60cff11
commit
9caeb461d3
4 changed files with 11 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ use rocket::serde::Deserialize;
|
|||
use std::{
|
||||
collections::HashSet,
|
||||
net::{IpAddr, SocketAddr},
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
|
@ -11,5 +12,6 @@ pub struct Config {
|
|||
pub host: IpAddr,
|
||||
pub masters: HashSet<SocketAddr>,
|
||||
pub port: u16,
|
||||
pub query: PathBuf,
|
||||
pub title: String,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
use rocket::serde::Serialize;
|
||||
use std::collections::HashSet;
|
||||
use std::{collections::HashSet, path::PathBuf};
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
#[serde(crate = "rocket::serde")]
|
||||
pub struct Global {
|
||||
pub masters: HashSet<std::net::SocketAddr>,
|
||||
pub query: PathBuf,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use rocket_dyn_templates::{Template, context};
|
|||
fn index(meta: &State<Meta>, global: &State<Global>) -> Result<Template, Status> {
|
||||
// @TODO: requires library impl
|
||||
// https://github.com/FWGS/xash3d-master/issues/4
|
||||
let scrape = std::process::Command::new("xash3d-query")
|
||||
let scrape = std::process::Command::new(&global.query)
|
||||
.arg("all")
|
||||
.arg("-M")
|
||||
.arg(
|
||||
|
|
@ -78,6 +78,7 @@ fn rocket() -> _ {
|
|||
})
|
||||
.manage(Global {
|
||||
masters: config.masters,
|
||||
query: config.query,
|
||||
})
|
||||
.manage(Meta {
|
||||
title: config.title,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue