mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
feat(frontend) add Activities.tsx
This commit is contained in:
44 files changed
+501
-253
No files matched your search
@@ -1,4 +1,5 @@
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
use std::fs::remove_dir_all;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
@@ -89,24 +90,22 @@ pub fn task(db_connection: &Pool<Postgres>) {
|
||||
for update in updates {
|
||||
if [Delta::Deleted, Delta::Untracked].contains(&update.status) {
|
||||
if let Some(path) = &update.old_path {
|
||||
if drop_index(
|
||||
match drop_index(
|
||||
&get_md_file_basename(
|
||||
path.file_name().unwrap().to_str().unwrap(),
|
||||
),
|
||||
db_connection,
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
info!(
|
||||
) {
|
||||
Ok(_) => info!(
|
||||
"blog content git({}) file `{}` is detected as deleted/untracked, index dropped",
|
||||
&git_url,
|
||||
&path.display()
|
||||
);
|
||||
} else {
|
||||
error!(
|
||||
"blog content git({}) file `{}` is detected as deleted/untracked, failed to drop index",
|
||||
),
|
||||
Err(e) => error!(
|
||||
"blog content git({}) file `{}` is detected as deleted/untracked, failed to drop index: {}",
|
||||
&git_url,
|
||||
&path.display()
|
||||
&path.display(),
|
||||
e
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -114,7 +113,8 @@ pub fn task(db_connection: &Pool<Postgres>) {
|
||||
if path.components().any(|comp| comp.as_os_str() == "posts")
|
||||
&& path.extension().is_some_and(|ext| ext == "md")
|
||||
{
|
||||
update_md.push(path.to_path_buf());
|
||||
// update_md.push(path.to_path_buf());
|
||||
update_md.push(dbg!(path.to_path_buf()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ pub fn search_md(entry: PathBuf) -> Vec<PathBuf> {
|
||||
pub fn index_files(files: &[PathBuf], db_conn: &Pool<Postgres>) {
|
||||
let rt = Runtime::new().unwrap();
|
||||
rt.block_on(async {
|
||||
let files_clone = files.to_owned();
|
||||
let files_clone = dbg!(files).to_owned();
|
||||
let handlers = files_clone
|
||||
.into_iter()
|
||||
.map(|file: PathBuf| {
|
||||
|
||||
@@ -7,7 +7,8 @@ pub mod check_update;
|
||||
pub fn get_tasks(db_connection: Pool<Postgres>) -> Vec<Box<dyn Task>> {
|
||||
let db_conn_clone = db_connection.clone();
|
||||
vec![
|
||||
BasicTask::new(move || check_update::task(&db_conn_clone), "0/15 * * * * *")
|
||||
// BasicTask::new(move || check_update::task(&db_conn_clone), "0/15 * * * * *")
|
||||
BasicTask::new(move || check_update::task(&db_conn_clone), "* * * * * *")
|
||||
.unwrap()
|
||||
.to_task(),
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user