Browse Source

WASI folder endpoints fix

Yurii Sokolovskyi 3 months ago
parent
commit
f947eee802
2 changed files with 4 additions and 4 deletions
  1. 0 1
      src/main.rs
  2. 4 3
      src/server.rs

+ 0 - 1
src/main.rs

@@ -32,7 +32,6 @@ use axum::http::{Method, StatusCode};
 use axum::response::{IntoResponse, Response};
 use axum::response::{IntoResponse, Response};
 #[cfg(not(target_os = "wasi"))]
 #[cfg(not(target_os = "wasi"))]
 use axum::routing::{get, post};
 use axum::routing::{get, post};
-use axum::routing::any;
 #[cfg(not(target_os = "wasi"))]
 #[cfg(not(target_os = "wasi"))]
 use tower_http::cors::{Any, CorsLayer};
 use tower_http::cors::{Any, CorsLayer};
 
 

+ 4 - 3
src/server.rs

@@ -3,6 +3,7 @@ use crate::indexes::{SerializableMessage, SerializableThread};
 use serde::{Deserialize, Serialize};
 use serde::{Deserialize, Serialize};
 use std::fs::File;
 use std::fs::File;
 use std::io::{BufReader};
 use std::io::{BufReader};
+use crate::{create_folder_lar, delete_folder_lar, rename_folder_lar};
 use crate::util::read_and_decompress_file;
 use crate::util::read_and_decompress_file;
 
 
 pub async fn get_folders() -> String {
 pub async fn get_folders() -> String {
@@ -136,7 +137,7 @@ struct CreateFolderRequest {
 }
 }
 pub async fn create_folder(body: String) -> anyhow::Result<()>{
 pub async fn create_folder(body: String) -> anyhow::Result<()>{
     let data: CreateFolderRequest = serde_json::from_str(&*body)?;
     let data: CreateFolderRequest = serde_json::from_str(&*body)?;
-    crate::imap::create_folder(data.name.clone()).await
+    create_folder_lar(data.name.clone()).await
 }
 }
 
 
 #[derive(Deserialize)]
 #[derive(Deserialize)]
@@ -145,7 +146,7 @@ struct DeleteFolderRequest {
 }
 }
 pub async fn delete_folder(body: String) -> anyhow::Result<()>{
 pub async fn delete_folder(body: String) -> anyhow::Result<()>{
     let data: DeleteFolderRequest = serde_json::from_str(&*body)?;
     let data: DeleteFolderRequest = serde_json::from_str(&*body)?;
-    crate::imap::delete_folder(data.name.clone()).await
+    delete_folder_lar(data.name.clone()).await
 }
 }
 
 
 #[derive(Deserialize)]
 #[derive(Deserialize)]
@@ -155,5 +156,5 @@ struct RenameFolderRequest {
 }
 }
 pub async fn rename_folder(body: String) -> anyhow::Result<()>{
 pub async fn rename_folder(body: String) -> anyhow::Result<()>{
     let data: RenameFolderRequest = serde_json::from_str(&*body)?;
     let data: RenameFolderRequest = serde_json::from_str(&*body)?;
-    crate::imap::rename_folder(data.old_name.clone(), data.new_name.clone()).await
+    rename_folder_lar(data.old_name.clone(), data.new_name.clone()).await
 }
 }