feat: dynamically generate supported meta plugins list
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -3,6 +3,7 @@ use axum::{
|
|||||||
http::StatusCode,
|
http::StatusCode,
|
||||||
response::Json,
|
response::Json,
|
||||||
};
|
};
|
||||||
|
use strum::IntoEnumIterator;
|
||||||
|
|
||||||
use crate::modes::server::common::{AppState, ApiResponse, StatusInfoResponse};
|
use crate::modes::server::common::{AppState, ApiResponse, StatusInfoResponse};
|
||||||
use crate::common::status::{generate_status_info, StatusInfo};
|
use crate::common::status::{generate_status_info, StatusInfo};
|
||||||
@@ -33,33 +34,11 @@ pub async fn handle_status(
|
|||||||
let db_path = state.db.lock().await.path().unwrap_or("unknown").to_string();
|
let db_path = state.db.lock().await.path().unwrap_or("unknown").to_string();
|
||||||
|
|
||||||
// Get all meta plugin types that are supported
|
// Get all meta plugin types that are supported
|
||||||
let supported_meta_plugins: Vec<MetaPluginType> = [
|
let supported_meta_plugins: Vec<MetaPluginType> = MetaPluginType::iter()
|
||||||
MetaPluginType::FileMagic,
|
|
||||||
MetaPluginType::FileMime,
|
|
||||||
MetaPluginType::FileEncoding,
|
|
||||||
MetaPluginType::LineCount,
|
|
||||||
MetaPluginType::WordCount,
|
|
||||||
MetaPluginType::Cwd,
|
|
||||||
MetaPluginType::Binary,
|
|
||||||
MetaPluginType::Uid,
|
|
||||||
MetaPluginType::User,
|
|
||||||
MetaPluginType::Gid,
|
|
||||||
MetaPluginType::Shell,
|
|
||||||
MetaPluginType::ShellPid,
|
|
||||||
MetaPluginType::KeepPid,
|
|
||||||
MetaPluginType::Hostname,
|
|
||||||
MetaPluginType::FullHostname,
|
|
||||||
MetaPluginType::DigestSha256,
|
|
||||||
MetaPluginType::DigestMd5,
|
|
||||||
MetaPluginType::ReadTime,
|
|
||||||
MetaPluginType::ReadRate,
|
|
||||||
]
|
|
||||||
.iter()
|
|
||||||
.filter(|mpt| {
|
.filter(|mpt| {
|
||||||
let plugin = crate::meta_plugin::get_meta_plugin((*mpt).clone());
|
let plugin = crate::meta_plugin::get_meta_plugin((*mpt).clone());
|
||||||
plugin.is_supported()
|
plugin.is_supported()
|
||||||
})
|
})
|
||||||
.cloned()
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Default to LZ4 compression for the API status endpoint
|
// Default to LZ4 compression for the API status endpoint
|
||||||
|
|||||||
Reference in New Issue
Block a user