Skip to content

Commit

Permalink
add screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Paddyk45 committed Feb 8, 2025
1 parent 4fedc2e commit 8362cec
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 22 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Binary file added screenshots/admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/main-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/monitor-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/templates/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -19,7 +19,7 @@ pub async fn admin_template(cookies: CookieJar) -> (StatusCode, Markup) {
let render = html!(
(DOCTYPE)
head {
(NEWCSS)
(HTML_HEADER_GLOB)
title { "Unauthorized" }
}

Expand All @@ -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) }
}
Expand Down
4 changes: 2 additions & 2 deletions src/templates/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) }
}
Expand Down
18 changes: 4 additions & 14 deletions src/templates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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#"<link rel="stylesheet" href="https://fonts.xz.style/serve/inter.css">"#,
r#"<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css">"#,
"<style>",
"body {",
"max-width: 65%;",
"}",

"body { max-width: 65%; }",
"#addform {",
"input {",
"min-width: 30%;",
"display: block;",
"}",

"label {",
"margin-down: 3px;",
"display: block;",
"}",
"input { min-width: 30%; display: block; }",
"label { margin-down: 3px; display: block; }",
"}",
"</style>"
));
Expand Down
6 changes: 3 additions & 3 deletions src/templates/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};

Expand Down Expand Up @@ -167,7 +167,7 @@ pub async fn monitor_template(monitor_id: Path<u64>, cookies: CookieJar) -> (Sta
(DOCTYPE)
html {
head {
(NEWCSS)
(HTML_HEADER_GLOB)
title { "Not found" }
}

Expand All @@ -184,7 +184,7 @@ pub async fn monitor_template(monitor_id: Path<u64>, cookies: CookieJar) -> (Sta
let render = html!(
html {
head {
(NEWCSS)
(HTML_HEADER_GLOB)
@if can_view { title { "Monitor " (*monitor_id) } }
@else { title { "Unauthorized" } }
}
Expand Down

0 comments on commit 8362cec

Please sign in to comment.