allow more configuration
This commit is contained in:
parent
f25c8e97b3
commit
6601686581
1 changed files with 18 additions and 10 deletions
28
src/main.rs
28
src/main.rs
|
@ -1,13 +1,18 @@
|
|||
///////////////////////////////////////////
|
||||
// //
|
||||
// TO EDIT NETWORK STUFF EDIT BELOW: //
|
||||
// - const IPADDRESS //
|
||||
// - const PORT //
|
||||
// //
|
||||
///////////////////////////////////////////
|
||||
/////////////////////////////////////
|
||||
// //
|
||||
// TO EDIT NETWORK STUFF EDIT: //
|
||||
// - const IPADDRESS //
|
||||
// - const PORT //
|
||||
// //
|
||||
// TO EDIT FONT: //
|
||||
// - Add your font to root dir //
|
||||
// - edit const FONTFILENAME //
|
||||
// //
|
||||
/////////////////////////////////////
|
||||
|
||||
const IPADDRESS: &str = "69";
|
||||
const IPADDRESS: &str = "0.0.0.0";
|
||||
const PORT: &str = "8080";
|
||||
const FONTFILENAME: &str = "Roboto-Regular.ttf"
|
||||
|
||||
use std::{io::Cursor, net::SocketAddr};
|
||||
|
||||
|
@ -19,12 +24,15 @@ use imageproc::drawing::{self, text_size};
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let fontfile = include_bytes!("../Roboto-Regular.ttf");
|
||||
let networkaddress = format!("{IPADDRESS}:{PORT}");
|
||||
let fontname2 = format!("../{FONTFILENAME}")
|
||||
|
||||
let fontfile = include_bytes!(fontname2);
|
||||
let font = FontRef::try_from_slice(fontfile).unwrap();
|
||||
|
||||
let app = Router::new().route("/ip.png", get(ip_png)).with_state(font);
|
||||
|
||||
let list = tokio::net::TcpListener::bind("0.0.0.0:8080").await.unwrap();
|
||||
let list = tokio::net::TcpListener::bind(networkaddress).await.unwrap();
|
||||
axum::serve(
|
||||
list,
|
||||
app.into_make_service_with_connect_info::<SocketAddr>(),
|
||||
|
|
Loading…
Reference in a new issue