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:
Andrew Phillips
2025-08-25 17:50:10 -03:00
parent 0fe61de89e
commit dc8ed09b06

View File

@@ -3,6 +3,7 @@ use axum::{
http::StatusCode,
response::Json,
};
use strum::IntoEnumIterator;
use crate::modes::server::common::{AppState, ApiResponse, StatusInfoResponse};
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();
// Get all meta plugin types that are supported
let supported_meta_plugins: Vec<MetaPluginType> = [
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()
let supported_meta_plugins: Vec<MetaPluginType> = MetaPluginType::iter()
.filter(|mpt| {
let plugin = crate::meta_plugin::get_meta_plugin((*mpt).clone());
plugin.is_supported()
})
.cloned()
.collect();
// Default to LZ4 compression for the API status endpoint