fix: revert back to crates dir layout

This commit is contained in:
theo 2024-07-24 11:58:03 +02:00
parent 18758ff2fe
commit 86a6d2b9d3
No known key found for this signature in database
35 changed files with 31 additions and 48 deletions

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 = [
"clego",
"tauri"
"crates/clego",
"crates/tauri"
]

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 974 B

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 903 B

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -5,10 +5,37 @@ use tauri::{path::BaseDirectory, Manager};
use tokio::sync::Mutex;
use tower::{Service, ServiceExt};
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);
let request = axum::extract::Request::from_parts(parts, body);
let response = match router.as_service().ready().await {
Ok(ready_service) => ready_service.call(request).await,
Err(_error) => panic!("Failed to get ready service"),
};
let response = match response {
Ok(response) => response,
Err(_error) => panic!("Problem getting response from request."),
};
let (parts, body) = response.into_parts();
let body = match axum::body::to_bytes(body, usize::MAX).await {
Ok(bytes) => bytes.to_vec(),
Err(_error) => panic!("Problem converting response body to bytes."),
};
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)
@ -27,30 +54,6 @@ pub fn run() {
tauri::async_runtime::spawn(async move {
let mut router = router.lock().await;
let (parts, body) = request.into_parts();
let body = axum::body::Body::from(body);
let request = axum::extract::Request::from_parts(parts, body);
let response = match router.as_service().ready().await {
Ok(ready_service) => ready_service.call(request).await,
Err(_error) => panic!("Failed to get ready service"),
};
let response = match response {
Ok(response) => response,
Err(_error) => panic!("Problem getting response from request."),
};
let (parts, body) = response.into_parts();
let body = match axum::body::to_bytes(body, usize::MAX).await {
Ok(bytes) => bytes.to_vec(),
Err(_error) => panic!("Problem converting response body to bytes."),
};
let response = tauri::http::Response::from_parts(parts, body);
responder.respond(response);
});
})