Move modules to individual projects. Change API syntax.

This commit is contained in:
Michael Mikovsky
2025-12-17 13:17:58 -07:00
parent 41c47048be
commit 6e73cb8a8e
22 changed files with 546 additions and 164 deletions
+18
View File
@@ -1,9 +1,15 @@
use axum::extract::{Path, State};
use axum::{Extension, Json};
use chrono::Local;
use unshell_lib::debug;
// use lazy_static::lazy_static;
use std::fs::{self, File, OpenOptions};
use std::io::{BufRead, BufReader, Write};
use std::path::PathBuf;
use crate::Server;
use crate::api::CurrentUser;
// --- Constants ---
/// The directory where log files will be stored.
const LOG_DIR: &str = "logs";
@@ -125,6 +131,18 @@ impl Logger {
}
}
}
// Route the "keys" api for each tree
pub async fn poll_logs_api(
State(_): State<Server>,
Extension(_): Extension<CurrentUser>,
Path(offset): Path<usize>,
) -> axum::Json<serde_json::Value> {
debug!("GET /api/log/{}", offset);
let result = Self::poll_logs(offset);
Json(serde_json::to_value(result).unwrap())
}
}
// --- Example Usage ---