doc: set doc `html_root_url` and small update
This commit is contained in:
parent
3ab66a4ab8
commit
2d121ef5c8
|
@ -38,4 +38,6 @@
|
||||||
//!
|
//!
|
||||||
//! ## Configure
|
//! ## 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")]
|
||||||
|
|
|
@ -38,7 +38,6 @@ async fn main() {
|
||||||
.expect("start http server");
|
.expect("start http server");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Init logger
|
|
||||||
fn init_logger() -> anyhow::Result<()> {
|
fn init_logger() -> anyhow::Result<()> {
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
||||||
|
@ -55,7 +54,7 @@ fn init_logger() -> anyhow::Result<()> {
|
||||||
WriteLogger::new(
|
WriteLogger::new(
|
||||||
LevelFilter::Info,
|
LevelFilter::Info,
|
||||||
Config::default(),
|
Config::default(),
|
||||||
File::create("logs.log").expect("create logs file"),
|
File::create("logs.log")?,
|
||||||
),
|
),
|
||||||
])?;
|
])?;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![doc(html_root_url = "https://homedisk-doc.medzik.xyz")]
|
||||||
|
|
||||||
mod sqlite;
|
mod sqlite;
|
||||||
|
|
||||||
pub use homedisk_types::database::User;
|
pub use homedisk_types::database::User;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![doc(html_root_url = "https://homedisk-doc.medzik.xyz")]
|
||||||
|
|
||||||
mod auth;
|
mod auth;
|
||||||
mod error;
|
mod error;
|
||||||
mod fs;
|
mod fs;
|
||||||
|
|
|
@ -15,7 +15,6 @@ pub struct Request {
|
||||||
/// HTTP `/auth/login` Response
|
/// HTTP `/auth/login` Response
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Zeroize, ZeroizeOnDrop)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Zeroize, ZeroizeOnDrop)]
|
||||||
pub enum Response {
|
pub enum Response {
|
||||||
#[allow(missing_docs)]
|
|
||||||
LoggedIn {
|
LoggedIn {
|
||||||
/// User access token
|
/// User access token
|
||||||
access_token: String,
|
access_token: String,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//!
|
//!
|
||||||
//! Path to a config file is `config.toml` in the system configuration directory (`~/.config/homedisk/config.toml`).
|
//! Path to a config file is `config.toml` in the system configuration directory (`~/.config/homedisk/config.toml`).
|
||||||
//!
|
//!
|
||||||
//! Example config:
|
//! ## Example config
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! [http]
|
//! [http]
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
//! path = "/home/homedisk" # # Directory where user files will be stored
|
//! 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)
|
//! - [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
|
||||||
|
|
||||||
mod types;
|
mod types;
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub struct ConfigHTTP {
|
||||||
pub host: String,
|
pub host: String,
|
||||||
/// Port HTTP Port
|
/// Port HTTP Port
|
||||||
pub port: u16,
|
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>,
|
pub cors: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@ pub struct ConfigStorage {
|
||||||
|
|
||||||
#[cfg(feature = "config")]
|
#[cfg(feature = "config")]
|
||||||
impl Config {
|
impl Config {
|
||||||
/// Parse configuration file
|
/// Parse configuration file.
|
||||||
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// use homedisk_types::config::Config;
|
/// use homedisk_types::config::Config;
|
||||||
///
|
///
|
||||||
|
|
|
@ -13,10 +13,11 @@ pub struct User {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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;
|
/// use homedisk_types::database::User;
|
||||||
///
|
///
|
||||||
|
@ -50,9 +51,8 @@ impl User {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// User directory
|
/// The function returns the directory where the user file is located.
|
||||||
/// function returns the directory where the user file is located
|
///
|
||||||
/// e.g.
|
|
||||||
/// ```
|
/// ```
|
||||||
/// use homedisk_types::database::User;
|
/// use homedisk_types::database::User;
|
||||||
///
|
///
|
||||||
|
|
|
@ -3,7 +3,6 @@ use serde::{Deserialize, Serialize};
|
||||||
/// HTTP `/auth/*` Errors
|
/// HTTP `/auth/*` Errors
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, thiserror::Error)]
|
#[derive(Debug, Clone, Serialize, Deserialize, thiserror::Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// User not found!
|
|
||||||
/// Username or Password incorrect.
|
/// Username or Password incorrect.
|
||||||
#[error("user not found")]
|
#[error("user not found")]
|
||||||
UserNotFound,
|
UserNotFound,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/// Database Error
|
/// Database Error
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// User not found!
|
|
||||||
/// Username or Password incorrect.
|
/// Username or Password incorrect.
|
||||||
#[error("user not found")]
|
#[error("user not found")]
|
||||||
UserNotFound,
|
UserNotFound,
|
||||||
|
|
|
@ -18,16 +18,16 @@ pub enum Error {
|
||||||
/// Missing Json in Content-Type Header.
|
/// Missing Json in Content-Type Header.
|
||||||
#[error("missing json content type")]
|
#[error("missing json content type")]
|
||||||
MissingJsonContentType,
|
MissingJsonContentType,
|
||||||
/// Failed to deserialize json.
|
/// Failed to deserialize JSON.
|
||||||
#[error("error deserialize json")]
|
#[error("error deserialize json")]
|
||||||
JsonDataError,
|
JsonDataError,
|
||||||
/// Syntax error in JSON
|
/// Syntax error in JSON.
|
||||||
#[error("json syntax error")]
|
#[error("json syntax error")]
|
||||||
JsonSyntaxError,
|
JsonSyntaxError,
|
||||||
/// Failed to extract the Request body
|
/// Failed to extract the Request body.
|
||||||
#[error("failed to extract the request body")]
|
#[error("failed to extract the request body")]
|
||||||
BytesRejection,
|
BytesRejection,
|
||||||
/// Other error
|
/// Other error.
|
||||||
#[error("unknown error - {0}")]
|
#[error("unknown error - {0}")]
|
||||||
Other(String),
|
Other(String),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![doc(html_root_url = "https://homedisk-doc.medzik.xyz")]
|
||||||
|
|
||||||
pub mod auth;
|
pub mod auth;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
#[cfg(feature = "database")]
|
#[cfg(feature = "database")]
|
||||||
|
|
Loading…
Reference in New Issue