diff --git a/README.md b/README.md index 98fdb60..8d586c5 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,20 @@ Perfect for small to medium infrastructures and developers seeking a straightfor - **Check**: Process of verifying service availability and response ## How to run + It's really simple! Set up the config in `stbmon.toml` as you like, then run it with `cargo r -r`. The database is automatically created. ## How to use + Open the web UI by going to the address defined in `stbmon.toml` (default is `http://127.0.0.1:13337`). From there, you can view your monitors, and after logging in with the password defined in the config, you can add, delete and edit monitors. + +## Screenshots + +#### Main page +![The stb-mon main page](https://github.com/Strawberry-Foundations/stb-mon/raw/master/main-page.png) + +#### Main page +![The stb-mon admin page](https://github.com/Strawberry-Foundations/stb-mon/raw/master/admin.png) + +#### Main page +![The stb-mon monitor info page](https://github.com/Strawberry-Foundations/stb-mon/raw/master/monitor-info.png) \ No newline at end of file diff --git a/screenshots/admin.png b/screenshots/admin.png new file mode 100644 index 0000000..0506cf0 Binary files /dev/null and b/screenshots/admin.png differ diff --git a/screenshots/main-page.png b/screenshots/main-page.png new file mode 100644 index 0000000..caeb26a Binary files /dev/null and b/screenshots/main-page.png differ diff --git a/screenshots/monitor-info.png b/screenshots/monitor-info.png new file mode 100644 index 0000000..8ae6f81 Binary files /dev/null and b/screenshots/monitor-info.png differ diff --git a/src/templates/admin.rs b/src/templates/admin.rs index fd20543..dbd8459 100644 --- a/src/templates/admin.rs +++ b/src/templates/admin.rs @@ -5,7 +5,7 @@ use reqwest::StatusCode; use crate::{ config::CONFIG, database, - templates::{render_monitor_list, NEWCSS}, + templates::{render_monitor_list, HTML_HEADER_GLOB}, }; pub async fn admin_template(cookies: CookieJar) -> (StatusCode, Markup) { @@ -19,7 +19,7 @@ pub async fn admin_template(cookies: CookieJar) -> (StatusCode, Markup) { let render = html!( (DOCTYPE) head { - (NEWCSS) + (HTML_HEADER_GLOB) title { "Unauthorized" } } @@ -37,7 +37,7 @@ pub async fn admin_template(cookies: CookieJar) -> (StatusCode, Markup) { (DOCTYPE); html { head { - (NEWCSS); + (HTML_HEADER_GLOB); script src="/admin.js" {}; title { (CONFIG.get().unwrap().lock().await.instance_name) } } diff --git a/src/templates/index.rs b/src/templates/index.rs index cbebfce..0abbdf6 100644 --- a/src/templates/index.rs +++ b/src/templates/index.rs @@ -5,7 +5,7 @@ use reqwest::StatusCode; use crate::{ config::CONFIG, database, - templates::{render_monitor_list, NEWCSS}, + templates::{render_monitor_list, HTML_HEADER_GLOB}, }; pub async fn index_template(cookies: CookieJar) -> (StatusCode, Markup) { @@ -23,7 +23,7 @@ pub async fn index_template(cookies: CookieJar) -> (StatusCode, Markup) { (DOCTYPE); html { head { - (NEWCSS) + (HTML_HEADER_GLOB) script src="/index.js" {}; title { (CONFIG.get().unwrap().lock().await.instance_name) } } diff --git a/src/templates/mod.rs b/src/templates/mod.rs index 7ea79c6..b714f81 100644 --- a/src/templates/mod.rs +++ b/src/templates/mod.rs @@ -15,24 +15,14 @@ pub use index::index_template; pub use monitor::monitor_template; #[rustfmt::skip] -static NEWCSS: PreEscaped<&'static str> = PreEscaped(concat!( +static HTML_HEADER_GLOB: PreEscaped<&'static str> = PreEscaped(concat!( r#""#, r#""#, "" )); diff --git a/src/templates/monitor.rs b/src/templates/monitor.rs index 2d78e7f..d688f34 100644 --- a/src/templates/monitor.rs +++ b/src/templates/monitor.rs @@ -5,7 +5,7 @@ use crate::{ record::{MonitorRecord, RecordResult}, }, monitor::Monitor, - templates::{result_to_text_color, NEWCSS}, + templates::{result_to_text_color, HTML_HEADER_GLOB}, time_util::{self, current_unix_time}, }; @@ -167,7 +167,7 @@ pub async fn monitor_template(monitor_id: Path, cookies: CookieJar) -> (Sta (DOCTYPE) html { head { - (NEWCSS) + (HTML_HEADER_GLOB) title { "Not found" } } @@ -184,7 +184,7 @@ pub async fn monitor_template(monitor_id: Path, cookies: CookieJar) -> (Sta let render = html!( html { head { - (NEWCSS) + (HTML_HEADER_GLOB) @if can_view { title { "Monitor " (*monitor_id) } } @else { title { "Unauthorized" } } }