Post error message, build number

Made the error when you try to post without being logged in more
informative. It used to be very vague and confusing.

Added build number to home page and backend banner. It pulls the version
number from cargo at compile time.
This commit is contained in:
saw 2021-06-04 13:03:16 -04:00
parent 38a42fdbe3
commit f10be383f9
4 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "board_server"
version = "1.0.0"
version = "1.0.1"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -146,7 +146,7 @@ pub async fn board_post(
Ok(a) => a,
Err(e) => {
println!("{}", e);
return Err(HttpResponse::BadRequest().body("Bad Request: Could not parse cookie data"));
return Err(HttpResponse::BadRequest().body("Bad Request: Could not parse cookie data.\n Not logged in, or bad cookie."));
}
};
let mut mf = data.msg_factory.lock().unwrap();

View File

@ -59,12 +59,12 @@ impl PageBuilder {
#[get("/")]
async fn index() -> impl Responder {
HttpResponse::Ok().body(r#"
HttpResponse::Ok().body(format!(r#"
<html><head>
<link rel="stylesheet" type="text/css" href="https://orbitalfox.us/Music/index.css">
</head>
<body>
<h1>Boarders v1.0.0</h1>
<h1>Boarders v{}</h1>
<p>
<h2>What is it?</h2>
Boarders is an easily deployable message board written in Rust.
@ -88,7 +88,7 @@ Don't ruin the fun for everyone</li>
<h3 style="text-align: center;">------<a href="/boards/">[Get Started]</a>------</h3>
</body>
</html>
"#)
"#, env!("CARGO_PKG_VERSION")))
}
#[get("/debug/")]
@ -195,7 +195,7 @@ async fn main() -> std::io::Result<()> {
}).bind("127.0.0.1:8080")?
.run();
println!("Started server");
println!("{}", include_str!("res/banner"));
println!("{}v{}", include_str!("res/banner"), env!("CARGO_PKG_VERSION"));
let res = server.await;
println!("\nExiting...");
/*

View File

@ -1,5 +1,5 @@
__ __
/ /_ ____ ____ _ _____ ____/ / _____ _____
/ __ \ / __ \ / __ `// ___// __ / / ___// ___/
/ /_/ // /_/ // /_/ // / / /_/ /_ / / (__ )
/_.___/ \____/ \__,_//_/ \__,_/(_)/_/ /____/
____ __
/ __ ) ____ ____ _ _____ ____/ /___ _____ _____
/ __ |/ __ \ / __ `// ___// __ // _ \ / ___// ___/
/ /_/ // /_/ // /_/ // / / /_/ // __// / (__ )
/_____/ \____/ \__,_//_/ \__,_/ \___//_/ /____/