[M] Move ReturnPath to Generator
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
use std::os::unix::fs::MetadataExt;
|
use std::os::unix::fs::MetadataExt;
|
||||||
use pathdiff::diff_paths;
|
use pathdiff::diff_paths;
|
||||||
use std::path::{PathBuf};
|
use std::path::{PathBuf};
|
||||||
|
use serde::{de, Deserialize, ser, Serialize};
|
||||||
|
|
||||||
const DOT_PATH: &str = ".meow_index";
|
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
|
// Thumbnail already up to date
|
||||||
(Ok(tm), Ok(fm)) => if tm.mtime() >= fm.mtime() { return Ok(()) },
|
(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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ use std::net::SocketAddr;
|
|||||||
use std::os::unix::fs::MetadataExt;
|
use std::os::unix::fs::MetadataExt;
|
||||||
use hyper::{Body, http, Request, Response, Server};
|
use hyper::{Body, http, Request, Response, Server};
|
||||||
use hyper::service::{make_service_fn, service_fn};
|
use hyper::service::{make_service_fn, service_fn};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use path_clean::{clean};
|
use path_clean::{clean};
|
||||||
use macros::StringExt;
|
use macros::StringExt;
|
||||||
use crate::macros::PathExt;
|
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>> {
|
async fn hello_world(_req: Request<Body>) -> http::Result<Response<Body>> {
|
||||||
let path = format!(".{}", clean(_req.uri().path()));
|
let path = format!(".{}", clean(_req.uri().path()));
|
||||||
println!("Raw path: {} | Sanitized path: {path}", _req.uri().path());
|
println!("Raw path: {} | Sanitized path: {path}", _req.uri().path());
|
||||||
|
|||||||
Reference in New Issue
Block a user