From 352d4e0a7acbe2faa575aa920d68192ab4983752 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 6 May 2024 10:55:18 +0200 Subject: [PATCH] new name --- Cargo.lock | 38 +++++++++---------- Cargo.toml | 2 +- {cops-web => rusty-library}/Cargo.toml | 2 +- {cops-web => rusty-library}/src/app_state.rs | 0 {cops-web => rusty-library}/src/basic_auth.rs | 0 {cops-web => rusty-library}/src/cli.rs | 0 {cops-web => rusty-library}/src/config.rs | 0 {cops-web => rusty-library}/src/data/book.rs | 0 rusty-library/src/handlers/authors.rs | 10 +++++ rusty-library/src/handlers/books.rs | 10 +++++ .../src/handlers/cover.rs | 0 .../src/handlers/download.rs | 0 .../src/handlers/error.rs | 0 .../src/handlers/recents.rs | 0 rusty-library/src/handlers/series.rs | 10 +++++ {cops-web => rusty-library}/src/main.rs | 6 +++ {cops-web => rusty-library}/src/templates.rs | 0 .../static/pico.min.css | 0 {cops-web => rusty-library}/static/style.css | 0 .../templates/base.html | 13 ++++++- .../templates/book_card.html | 0 .../templates/recents.html | 0 22 files changed, 69 insertions(+), 22 deletions(-) rename {cops-web => rusty-library}/Cargo.toml (95%) rename {cops-web => rusty-library}/src/app_state.rs (100%) rename {cops-web => rusty-library}/src/basic_auth.rs (100%) rename {cops-web => rusty-library}/src/cli.rs (100%) rename {cops-web => rusty-library}/src/config.rs (100%) rename {cops-web => rusty-library}/src/data/book.rs (100%) create mode 100644 rusty-library/src/handlers/authors.rs create mode 100644 rusty-library/src/handlers/books.rs rename {cops-web => rusty-library}/src/handlers/cover.rs (100%) rename {cops-web => rusty-library}/src/handlers/download.rs (100%) rename {cops-web => rusty-library}/src/handlers/error.rs (100%) rename {cops-web => rusty-library}/src/handlers/recents.rs (100%) create mode 100644 rusty-library/src/handlers/series.rs rename {cops-web => rusty-library}/src/main.rs (86%) rename {cops-web => rusty-library}/src/templates.rs (100%) rename {cops-web => rusty-library}/static/pico.min.css (100%) rename {cops-web => rusty-library}/static/style.css (100%) rename {cops-web => rusty-library}/templates/base.html (55%) rename {cops-web => rusty-library}/templates/book_card.html (100%) rename {cops-web => rusty-library}/templates/recents.html (100%) diff --git a/Cargo.lock b/Cargo.lock index 2eed675..782907c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,25 +286,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" -[[package]] -name = "cops-web" -version = "0.1.0" -dependencies = [ - "calibre-db", - "clap", - "once_cell", - "poem", - "rust-embed", - "serde", - "serde_json", - "tera", - "thiserror", - "tokio", - "tracing", - "tracing-subscriber", - "uuid", -] - [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -1266,6 +1247,25 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rusty-library" +version = "0.1.0" +dependencies = [ + "calibre-db", + "clap", + "once_cell", + "poem", + "rust-embed", + "serde", + "serde_json", + "tera", + "thiserror", + "tokio", + "tracing", + "tracing-subscriber", + "uuid", +] + [[package]] name = "ryu" version = "1.0.17" diff --git a/Cargo.toml b/Cargo.toml index 67269e4..424e8ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = [ - "calibre-db", "cops-web", + "calibre-db", "rusty-library", ] [workspace.dependencies] diff --git a/cops-web/Cargo.toml b/rusty-library/Cargo.toml similarity index 95% rename from cops-web/Cargo.toml rename to rusty-library/Cargo.toml index d72f021..a5eb8a5 100644 --- a/cops-web/Cargo.toml +++ b/rusty-library/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "cops-web" +name = "rusty-library" version = "0.1.0" edition = "2021" diff --git a/cops-web/src/app_state.rs b/rusty-library/src/app_state.rs similarity index 100% rename from cops-web/src/app_state.rs rename to rusty-library/src/app_state.rs diff --git a/cops-web/src/basic_auth.rs b/rusty-library/src/basic_auth.rs similarity index 100% rename from cops-web/src/basic_auth.rs rename to rusty-library/src/basic_auth.rs diff --git a/cops-web/src/cli.rs b/rusty-library/src/cli.rs similarity index 100% rename from cops-web/src/cli.rs rename to rusty-library/src/cli.rs diff --git a/cops-web/src/config.rs b/rusty-library/src/config.rs similarity index 100% rename from cops-web/src/config.rs rename to rusty-library/src/config.rs diff --git a/cops-web/src/data/book.rs b/rusty-library/src/data/book.rs similarity index 100% rename from cops-web/src/data/book.rs rename to rusty-library/src/data/book.rs diff --git a/rusty-library/src/handlers/authors.rs b/rusty-library/src/handlers/authors.rs new file mode 100644 index 0000000..73cd468 --- /dev/null +++ b/rusty-library/src/handlers/authors.rs @@ -0,0 +1,10 @@ +use std::sync::Arc; + +use poem::{handler, web::Data}; + +use crate::app_state::AppState; + +#[handler] +pub async fn handler(state: Data<&Arc>) -> Result { + Ok("authors".to_string()) +} diff --git a/rusty-library/src/handlers/books.rs b/rusty-library/src/handlers/books.rs new file mode 100644 index 0000000..bf18617 --- /dev/null +++ b/rusty-library/src/handlers/books.rs @@ -0,0 +1,10 @@ +use std::sync::Arc; + +use poem::{handler, web::Data}; + +use crate::app_state::AppState; + +#[handler] +pub async fn handler(state: Data<&Arc>) -> Result { + Ok("books".to_string()) +} diff --git a/cops-web/src/handlers/cover.rs b/rusty-library/src/handlers/cover.rs similarity index 100% rename from cops-web/src/handlers/cover.rs rename to rusty-library/src/handlers/cover.rs diff --git a/cops-web/src/handlers/download.rs b/rusty-library/src/handlers/download.rs similarity index 100% rename from cops-web/src/handlers/download.rs rename to rusty-library/src/handlers/download.rs diff --git a/cops-web/src/handlers/error.rs b/rusty-library/src/handlers/error.rs similarity index 100% rename from cops-web/src/handlers/error.rs rename to rusty-library/src/handlers/error.rs diff --git a/cops-web/src/handlers/recents.rs b/rusty-library/src/handlers/recents.rs similarity index 100% rename from cops-web/src/handlers/recents.rs rename to rusty-library/src/handlers/recents.rs diff --git a/rusty-library/src/handlers/series.rs b/rusty-library/src/handlers/series.rs new file mode 100644 index 0000000..9e900d9 --- /dev/null +++ b/rusty-library/src/handlers/series.rs @@ -0,0 +1,10 @@ +use std::sync::Arc; + +use poem::{handler, web::Data}; + +use crate::app_state::AppState; + +#[handler] +pub async fn handler(state: Data<&Arc>) -> Result { + Ok("series".to_string()) +} diff --git a/cops-web/src/main.rs b/rusty-library/src/main.rs similarity index 86% rename from cops-web/src/main.rs rename to rusty-library/src/main.rs index 63aaea7..117c31f 100644 --- a/cops-web/src/main.rs +++ b/rusty-library/src/main.rs @@ -18,10 +18,13 @@ mod data { pub mod book; } mod handlers { + pub mod authors; + pub mod books; pub mod cover; pub mod download; pub mod error; pub mod recents; + pub mod series; } mod templates; @@ -44,6 +47,9 @@ async fn main() -> Result<(), std::io::Error> { let app = Route::new() .at("/", get(handlers::recents::handler)) + .at("/books", get(handlers::books::handler)) + .at("/authors", get(handlers::authors::handler)) + .at("/series", get(handlers::series::handler)) .at("/cover/:id", get(handlers::cover::handler)) .at("/book/:id/:format", get(handlers::download::handler)) .nest("/static", EmbeddedFilesEndpoint::::new()) diff --git a/cops-web/src/templates.rs b/rusty-library/src/templates.rs similarity index 100% rename from cops-web/src/templates.rs rename to rusty-library/src/templates.rs diff --git a/cops-web/static/pico.min.css b/rusty-library/static/pico.min.css similarity index 100% rename from cops-web/static/pico.min.css rename to rusty-library/static/pico.min.css diff --git a/cops-web/static/style.css b/rusty-library/static/style.css similarity index 100% rename from cops-web/static/style.css rename to rusty-library/static/style.css diff --git a/cops-web/templates/base.html b/rusty-library/templates/base.html similarity index 55% rename from cops-web/templates/base.html rename to rusty-library/templates/base.html index ffee04f..a813a53 100644 --- a/cops-web/templates/base.html +++ b/rusty-library/templates/base.html @@ -6,10 +6,21 @@ - Hello world! + Rusty Library
+ {% block content %}{% endblock content %}
diff --git a/cops-web/templates/book_card.html b/rusty-library/templates/book_card.html similarity index 100% rename from cops-web/templates/book_card.html rename to rusty-library/templates/book_card.html diff --git a/cops-web/templates/recents.html b/rusty-library/templates/recents.html similarity index 100% rename from cops-web/templates/recents.html rename to rusty-library/templates/recents.html