doc: set doc `html_root_url` and small update

This commit is contained in:
MedzikUser 2022-06-21 12:51:22 +02:00
parent 3ab66a4ab8
commit 2d121ef5c8
No known key found for this signature in database
GPG Key ID: A5FAC1E185C112DB
12 changed files with 25 additions and 20 deletions

View File

@ -38,4 +38,6 @@
//!
//! ## Configure
//!
//! Go to [config](../homedisk_types/config/index.html) module
//! Go to [config](homedisk_types::config) module
#![doc(html_root_url = "https://homedisk-doc.medzik.xyz")]

View File

@ -38,7 +38,6 @@ async fn main() {
.expect("start http server");
}
/// Init logger
fn init_logger() -> anyhow::Result<()> {
use std::fs::File;
@ -55,7 +54,7 @@ fn init_logger() -> anyhow::Result<()> {
WriteLogger::new(
LevelFilter::Info,
Config::default(),
File::create("logs.log").expect("create logs file"),
File::create("logs.log")?,
),
])?;

View File

@ -1,3 +1,5 @@
#![doc(html_root_url = "https://homedisk-doc.medzik.xyz")]
mod sqlite;
pub use homedisk_types::database::User;

View File

@ -1,3 +1,5 @@
#![doc(html_root_url = "https://homedisk-doc.medzik.xyz")]
mod auth;
mod error;
mod fs;

View File

@ -15,7 +15,6 @@ pub struct Request {
/// HTTP `/auth/login` Response
#[derive(Debug, Serialize, Deserialize, Clone, Zeroize, ZeroizeOnDrop)]
pub enum Response {
#[allow(missing_docs)]
LoggedIn {
/// User access token
access_token: String,

View File

@ -2,7 +2,7 @@
//!
//! Path to a config file is `config.toml` in the system configuration directory (`~/.config/homedisk/config.toml`).
//!
//! Example config:
//! ## Example config
//!
//! ```toml
//! [http]
@ -18,7 +18,7 @@
//! path = "/home/homedisk" # # Directory where user files will be stored
//! ```
//!
//! ## External docs
//! ### External docs
//! - [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
mod types;

View File

@ -24,7 +24,7 @@ pub struct ConfigHTTP {
pub host: String,
/// Port HTTP Port
pub port: u16,
/// CORS Domains (e.g ["site1.example.com", "site2.example.com"])
/// [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) Domains (e.g ["site1.example.com", "site2.example.com"])
pub cors: Vec<String>,
}
@ -46,7 +46,8 @@ pub struct ConfigStorage {
#[cfg(feature = "config")]
impl Config {
/// Parse configuration file
/// Parse configuration file.
///
/// ```no_run
/// use homedisk_types::config::Config;
///

View File

@ -13,10 +13,11 @@ pub struct User {
}
impl User {
/// **Note this doesn't create a new user in the database!**
/// The function create a unique user UUID and create SHA-512 hash from salted user password
/// and returns the [User] type.
///
/// **Note: This doesn't create a user in the database!**
///
/// This function creates a unique UUID for a user and creates a password hash using SHA-512
/// and returns in the User type
/// ```
/// use homedisk_types::database::User;
///
@ -50,9 +51,8 @@ impl User {
}
}
/// User directory
/// function returns the directory where the user file is located
/// e.g.
/// The function returns the directory where the user file is located.
///
/// ```
/// use homedisk_types::database::User;
///

View File

@ -3,7 +3,6 @@ use serde::{Deserialize, Serialize};
/// HTTP `/auth/*` Errors
#[derive(Debug, Clone, Serialize, Deserialize, thiserror::Error)]
pub enum Error {
/// User not found!
/// Username or Password incorrect.
#[error("user not found")]
UserNotFound,

View File

@ -1,7 +1,6 @@
/// Database Error
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// User not found!
/// Username or Password incorrect.
#[error("user not found")]
UserNotFound,

View File

@ -18,16 +18,16 @@ pub enum Error {
/// Missing Json in Content-Type Header.
#[error("missing json content type")]
MissingJsonContentType,
/// Failed to deserialize json.
/// Failed to deserialize JSON.
#[error("error deserialize json")]
JsonDataError,
/// Syntax error in JSON
/// Syntax error in JSON.
#[error("json syntax error")]
JsonSyntaxError,
/// Failed to extract the Request body
/// Failed to extract the Request body.
#[error("failed to extract the request body")]
BytesRejection,
/// Other error
/// Other error.
#[error("unknown error - {0}")]
Other(String),
}

View File

@ -1,3 +1,5 @@
#![doc(html_root_url = "https://homedisk-doc.medzik.xyz")]
pub mod auth;
pub mod config;
#[cfg(feature = "database")]