[-] Remove listing generation

This commit is contained in:
Azalea Gui
2023-02-23 14:17:37 -05:00
parent 737e0826dd
commit 891647fbdb
2 changed files with 6 additions and 30 deletions
-27
View File
@@ -1,5 +1,3 @@
use crate::macros::*;
use crate::utils::*;
use std::fs;
@@ -16,13 +14,6 @@ use crate::thumbnailer::{Thumbnailers};
const DOT_PATH: &str = ".meow_index";
#[derive(Serialize, Deserialize)]
pub struct ReturnPath {
pub(crate) name: String,
pub(crate) file_type: String,
pub(crate) mtime: i64
}
pub struct Generator {
pub(crate) mime_db: SharedMimeInfo,
pub(crate) thumbnailers: Thumbnailers,
@@ -112,24 +103,6 @@ impl Generator {
}
});
// Check if directory listing needs update
let d_info = self.dot_path(&dir).with_extension(".json");
let d_mtime = d_info.metadata()?.mtime();
if files.iter().any(|(f, m)| m.mtime() > d_mtime) {
// Update directory listing
let paths: Vec<ReturnPath> = files.iter()
.filter_map(|(f, m)| Some(ReturnPath {
name: f.file_name().to_str()?.to_string(),
file_type: f.path().file_type().to_string(),
mtime: m.mtime(),
})).collect();
let json = serde_json::to_string(&paths)?;
// fs::write(d_info, json)?;
}
Ok(())
}
}
+6 -3
View File
@@ -4,16 +4,19 @@ mod generator;
mod utils;
mod thumbnailer;
use generator::*;
use macros::*;
use std::convert::Infallible;
use std::{env, fs};
use std::net::SocketAddr;
use std::os::unix::fs::MetadataExt;
use std::path::Path;
use hyper::{Body, http, Request, Response, Server};
use hyper::service::{make_service_fn, service_fn};
use path_clean::{clean};
use macros::StringExt;
use crate::macros::PathExt;
use generator::*;
use anyhow::{Result};
use serde::{Deserialize, Serialize};
extern crate pretty_env_logger;
#[macro_use] extern crate log;