From 38800bb33c3c8958aa87aed8edea3a0f4e0be16e Mon Sep 17 00:00:00 2001 From: Dietrich Date: Wed, 16 Jun 2021 09:38:23 +0200 Subject: [PATCH] dependency cleanup, documentation --- Cargo.lock | 63 +++---------------------------------- app/src/pages/list_links.rs | 4 +-- app/src/pages/list_users.rs | 4 +-- pslink/Cargo.toml | 3 -- pslink/src/lib.rs | 7 +++++ 5 files changed, 14 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad7e005..6c590c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -196,19 +196,6 @@ dependencies = [ "pin-project 0.4.28", ] -[[package]] -name = "actix-slog" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c697a62a2f51c5c26af6b1dded0622f15bec690da191615947e0c1b2b7b75198" -dependencies = [ - "actix-web", - "chrono", - "futures 0.3.15", - "pin-project 0.4.28", - "slog", -] - [[package]] name = "actix-testing" version = "1.0.1" @@ -453,12 +440,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "anyhow" -version = "1.0.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61" - [[package]] name = "app" version = "0.3.1" @@ -1533,16 +1514,6 @@ dependencies = [ "version_check 0.9.3", ] -[[package]] -name = "gethostname" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e692e296bfac1d2533ef168d0b60ff5897b8b70a4009276834014dd8924cc028" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "getopts" version = "0.2.21" @@ -1612,9 +1583,9 @@ checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "globset" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" +checksum = "f0fc1b9fa0e64ffb1aa5b95daa0f0f167734fd528b7c02eabc581d9d843649b1" dependencies = [ "aho-corasick", "bstr", @@ -1874,9 +1845,9 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b287fb45c60bb826a0dc68ff08742b9d88a2fea13d6e0c286b3172065aaf878c" +checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" dependencies = [ "crossbeam-utils", "globset", @@ -2733,10 +2704,8 @@ dependencies = [ "actix-identity", "actix-rt", "actix-server", - "actix-slog", "actix-web", "actix-web-static-files", - "anyhow", "argonautica", "async-trait", "chrono", @@ -2761,7 +2730,6 @@ dependencies = [ "tokio 0.2.25", "tracing", "tracing-actix-web", - "tracing-bunyan-formatter", "tracing-opentelemetry", "tracing-subscriber", ] @@ -3469,12 +3437,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" -[[package]] -name = "slog" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8347046d4ebd943127157b94d63abb990fcf729dc4e9978927fdf4ac3c998d06" - [[package]] name = "smallvec" version = "1.6.1" @@ -4100,23 +4062,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tracing-bunyan-formatter" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce1eae70720bd6bb3944f7cf501761aeae658bd1f9293aa373c71a195064910" -dependencies = [ - "chrono", - "gethostname", - "log", - "serde", - "serde_json", - "tracing", - "tracing-core", - "tracing-log", - "tracing-subscriber", -] - [[package]] name = "tracing-core" version = "0.1.18" diff --git a/app/src/pages/list_links.rs b/app/src/pages/list_links.rs index 28eb9fc..a560566 100644 --- a/app/src/pages/list_links.rs +++ b/app/src/pages/list_links.rs @@ -3,8 +3,8 @@ use fluent::fluent_args; use image::{DynamicImage, ImageOutputFormat, Luma}; use qrcode::{render::svg, QrCode}; use seed::{ - a, attrs, button, div, h1, img, input, log, nodes, prelude::*, raw, section, span, table, td, - th, tr, Url, C, IF, + a, attrs, div, h1, img, input, log, nodes, prelude::*, raw, section, span, table, td, th, tr, + Url, C, IF, }; use shared::{ diff --git a/app/src/pages/list_users.rs b/app/src/pages/list_users.rs index 2670e67..72804db 100644 --- a/app/src/pages/list_users.rs +++ b/app/src/pages/list_users.rs @@ -1,7 +1,5 @@ use enum_map::EnumMap; -use seed::{ - a, attrs, button, div, h1, input, log, p, prelude::*, section, table, td, th, tr, Url, C, IF, -}; +use seed::{a, attrs, div, h1, input, log, p, prelude::*, section, table, td, th, tr, Url, C, IF}; use shared::{ apirequests::general::{Operation, Ordering}, apirequests::{ diff --git a/pslink/Cargo.toml b/pslink/Cargo.toml index 4546fb1..6bfb098 100644 --- a/pslink/Cargo.toml +++ b/pslink/Cargo.toml @@ -16,11 +16,9 @@ actix-web-static-files = "3.0" [dependencies] actix-identity = "0.3" actix-rt = "1.1" -actix-slog = "0.2" actix-web = "3" actix-web-static-files = "3" actix-files = "0.5" -anyhow = "1.0" argonautica = "0.2" clap = "2.33" dotenv = "0.15.0" @@ -34,7 +32,6 @@ rpassword = "5.0" serde = "1.0" thiserror = "1.0" tracing-actix-web = "0.2.1" -tracing-bunyan-formatter = "0.2.0" tracing-opentelemetry = "0.12" async-trait = "0.1" enum-map = {version="1", features = ["serde"]} diff --git a/pslink/src/lib.rs b/pslink/src/lib.rs index 775dfdf..703509c 100644 --- a/pslink/src/lib.rs +++ b/pslink/src/lib.rs @@ -18,6 +18,7 @@ use thiserror::Error; use tracing::{error, info, trace}; use tracing_actix_web::TracingLogger; +/// The Error type that is returned by most function calls if anything failed. #[derive(Error, Debug)] pub enum ServerError { #[error("Failed to encrypt the password {0} - aborting!")] @@ -42,6 +43,7 @@ impl From for ServerError { } } +/// Any error can be rendered to a html string. impl ServerError { fn render_error(title: &str, content: &str) -> String { format!( @@ -68,6 +70,7 @@ impl ServerError { } } +/// Make the error type work nicely with the actix server. impl actix_web::error::ResponseError for ServerError { fn error_response(&self) -> HttpResponse { match self { @@ -119,6 +122,7 @@ impl actix_web::error::ResponseError for ServerError { } } +/// The qr-code can contain two different protocolls #[derive(Debug, Clone)] pub enum Protocol { Http, @@ -146,6 +150,7 @@ impl FromStr for Protocol { } } +/// The configuration of the server. It is accessible by the views and other parts of the program. Globally valid settings should be stored here. #[derive(Debug, Clone)] pub struct ServerConfig { pub secret: Secret, @@ -159,6 +164,7 @@ pub struct ServerConfig { pub brand_name: String, } +/// The configuration can be serialized into an environment-file. impl ServerConfig { #[must_use] pub fn to_env_strings(&self) -> Vec { @@ -186,6 +192,7 @@ impl ServerConfig { } } +// include the static files into the binary include!(concat!(env!("OUT_DIR"), "/generated.rs")); static_loader! {