mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-09 06:47:59 -06:00
Move modules to individual projects. Change API syntax.
This commit is contained in:
@@ -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 ---
|
||||
|
||||
Reference in New Issue
Block a user