feat: restructure project, implement askama templating #26

Merged
theo merged 21 commits from restructure-project into main 2024-07-26 14:42:03 +02:00
35 changed files with 31 additions and 48 deletions
Showing only changes of commit 86a6d2b9d3 - Show all commits

24
Cargo.lock generated
View File

@ -1487,25 +1487,6 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "include_dir"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd"
dependencies = [
"include_dir_macros",
]
[[package]]
name = "include_dir_macros"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75"
dependencies = [
"proc-macro2",
"quote",
]
[[package]]
name = "indexmap"
version = "1.9.3"
@ -2101,9 +2082,9 @@ dependencies = [
[[package]]
name = "object"
version = "0.36.1"
version = "0.36.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce"
checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e"
dependencies = [
"memchr",
]
@ -3270,7 +3251,6 @@ version = "0.1.0"
dependencies = [
"axum",
"clego",
"include_dir",
"tauri",
"tauri-build",
"tokio",

View File

@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = [
florian_briand marked this conversation as resolved
Review

Packages :

  • tauri/src devient crates/app -> Interfaces et code métier via Axum + Askama + HTMx
  • tauri/src-tauri devient crates/desktop
  • clego devient crates/sesam-vitale
Packages : - `tauri/src` devient `crates/app` -> Interfaces et code métier via Axum + Askama + HTMx - `tauri/src-tauri` devient `crates/desktop` - `clego` devient `crates/sesam-vitale`
"clego",
"tauri"
"crates/clego",
"crates/tauri"
florian_briand marked this conversation as resolved Outdated

J'avais fait le choix de mettre les modules à la racine, plutôt que dans sous dossier crates, car ça vient, à mon goût, surcharger l'arborescence sans qu'on en ai réellement besoin n

J'avais fait le choix de mettre les modules à la racine, plutôt que dans sous dossier crates, car ça vient, à mon goût, surcharger l'arborescence sans qu'on en ai réellement besoin n
Outdated
Review

les deux me vont, on peut partir sur ca

les deux me vont, on peut partir sur ca
]

View File

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

After

Width:  |  Height:  |  Size: 974 B

View File

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

After

Width:  |  Height:  |  Size: 903 B

View File

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

After

Width:  |  Height:  |  Size: 85 KiB

View File

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -5,29 +5,7 @@ use tauri::{path::BaseDirectory, Manager};
use tokio::sync::Mutex;
use tower::{Service, ServiceExt};
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.setup(|app| {
let resource_path_buf = app
.path()
.resolve("assets", BaseDirectory::Resource)
.expect("Path should be resolvable");
let router = Arc::new(Mutex::new(
clego::get_router(resource_path_buf.as_path()).clone(),
));
app.manage(router);
Ok(())
})
.register_asynchronous_uri_scheme_protocol("axum", move |app, request, responder| {
let router = Arc::clone(&app.state::<Arc<Mutex<axum::Router>>>());
tauri::async_runtime::spawn(async move {
let mut router = router.lock().await;
async fn process_tauri_request(request: tauri::http::Request<>, router: axum:Router ){
let (parts, body) = request.into_parts();
let body = axum::body::Body::from(body);
@ -50,7 +28,32 @@ pub fn run() {
};
let response = tauri::http::Response::from_parts(parts, body);
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.setup(|app| {
// Create a router and adds it the the app state
let resource_path_buf = app
.path()
.resolve("assets", BaseDirectory::Resource)
.expect("Path should be resolvable");
let router = Arc::new(Mutex::new(
clego::get_router(resource_path_buf.as_path()).clone(),
));
app.manage(router);
Ok(())
})
.register_asynchronous_uri_scheme_protocol("axum", move |app, request, responder| {
let router = Arc::clone(&app.state::<Arc<Mutex<axum::Router>>>());
tauri::async_runtime::spawn(async move {
let mut router = router.lock().await;
responder.respond(response);
});
})