Compare commits

..

No commits in common. "3224c02d6f239b787acb090db57ee5e6697e467b" and "be38c16c8d0d149927051451a29f2340b42cd0d1" have entirely different histories.

6 changed files with 1014 additions and 1240 deletions

2222
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -8,18 +8,17 @@ edition = "2018"
reqwest = "0.9"
serde = { version = "1.0", features = ["derive"] }
ron = "0.5"
actix-web = { version = "1.0", default-features = false, features = ["brotli", "flate2-zlib"] }
actix-web = { version = "1.0.0-beta.3", default-features = false, features = ["brotli", "flate2-zlib"] }
actix = "0.8"
tokio = "0.1"
tera = "0.11"
env_logger = "0.6"
chrono = { version = "0.4", features = ["serde"] }
ring = "^0"
log="0.4"
rss = { version = "1.7.0", optional = true }
[features]
default = ["json", "webhooks"]
default = ["json"]
json = []
rss_feed = ["rss"]

View file

@ -1,9 +1,16 @@
#![forbid(unsafe_code)]
#[macro_use]
extern crate log;
extern crate actix;
extern crate actix_web;
extern crate chrono;
extern crate env_logger;
extern crate reqwest;
extern crate ron;
extern crate serde;
extern crate tokio;
#[macro_use]
extern crate tera;
extern crate ring;
#[cfg(feature = "rss_feed")]
extern crate rss;
@ -35,7 +42,7 @@ fn main() {
let conf_file_loc =
var("ENDSTAT_CONF").unwrap_or_else(|_| String::from("./config/endstat_conf.ron"));
let config = from_str::<Config>(
&read_to_string(&conf_file_loc).unwrap_or_else(|_| panic!("finding {}", conf_file_loc)),
&read_to_string(&conf_file_loc).expect(&format!("finding {}", conf_file_loc)),
)
.unwrap();
let bind_addr = &config.bind_address;

View file

@ -50,9 +50,7 @@ impl QueryResults {
($(($hook:ident, $cond:expr)),*) => {
$(if let Some(url) = &webhooks.$hook {
if new_endpoint.status == $cond {
if let Err(e) = client.post(url).json(new_endpoint).send() {
warn!("{}", e)
}
client.post(url).json(new_endpoint).send();
}
})*
};

View file

@ -74,8 +74,8 @@ fn get_result(
if let Some(expected_hash) = &endpoint.body_hash {
let expected = from_hex(expected_hash).unwrap();
let actual = digest(&SHA256, res_body.as_bytes());
if expected != actual.as_ref() {
let actual = digest(&SHA256, String::from(res_body).as_bytes());
if &expected != &actual.as_ref() {
errors.push(String::from("Body hash mismatch."));
}
} else if !body.is_empty() && res_body != body {
@ -112,7 +112,7 @@ fn get_result(
}
}
fn get_url(base: &Option<String>, path: &str, port: Option<u16>) -> Result<String, UrlError> {
fn get_url(base: &Option<String>, path: &String, port: Option<u16>) -> Result<String, UrlError> {
let mut url = if let Some(base) = base {
Url::parse(base)?.join(path)?
} else {

View file

@ -31,7 +31,7 @@
align-items: stretch;
background-color: #424242;
margin: 1rem 0;
border-radius: .5rem;
border-radius: 1rem;
}
p { margin: 0; }
@ -46,7 +46,7 @@
.indicator {
width: 1rem;
min-height: 100%;
border-radius: .5rem 0 0 .5rem;
border-radius: 1rem 0 0 1rem;
}
.ok { background-color: #4ed34e; }
.warn { background-color: #fcfc64; }