[M] Move ReturnPath to Generator

This commit is contained in:
Azalea Gui
2023-02-23 11:51:20 -05:00
parent 732b289ca2
commit 57d2b1946a
2 changed files with 7 additions and 8 deletions
+7
View File
@@ -1,6 +1,7 @@
use std::os::unix::fs::MetadataExt;
use pathdiff::diff_paths;
use std::path::{PathBuf};
use serde::{de, Deserialize, ser, Serialize};
const DOT_PATH: &str = ".meow_index";
@@ -16,6 +17,12 @@ pub fn generate_thumb(base: PathBuf, file: PathBuf) -> Result<(), String>
// Thumbnail already up to date
(Ok(tm), Ok(fm)) => if tm.mtime() >= fm.mtime() { return Ok(()) },
_ => {}
#[derive(Serialize, Deserialize)]
pub struct ReturnPath {
pub(crate) name: String,
pub(crate) file_type: String,
pub(crate) mtime: i64
}
}
}
-8
View File
@@ -9,7 +9,6 @@ use std::net::SocketAddr;
use std::os::unix::fs::MetadataExt;
use hyper::{Body, http, Request, Response, Server};
use hyper::service::{make_service_fn, service_fn};
use serde::{Deserialize, Serialize};
use path_clean::{clean};
use macros::StringExt;
use crate::macros::PathExt;
@@ -39,13 +38,6 @@ async fn main() {
}
}
#[derive(Serialize, Deserialize)]
struct ReturnPath {
name: String,
file_type: String,
mtime: i64
}
async fn hello_world(_req: Request<Body>) -> http::Result<Response<Body>> {
let path = format!(".{}", clean(_req.uri().path()));
println!("Raw path: {} | Sanitized path: {path}", _req.uri().path());