fix: use actual server args in status handler instead of dummy args
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -53,6 +53,7 @@ struct AppState {
|
||||
db: Arc<Mutex<rusqlite::Connection>>,
|
||||
data_dir: PathBuf,
|
||||
password: Option<String>,
|
||||
args: Arc<Args>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
@@ -93,13 +94,14 @@ pub fn mode_server(
|
||||
|
||||
// We need to move the connection into the async runtime
|
||||
let rt = tokio::runtime::Runtime::new()?;
|
||||
rt.block_on(run_server(config, conn, data_path))
|
||||
rt.block_on(run_server(config, conn, data_path, args))
|
||||
}
|
||||
|
||||
async fn run_server(
|
||||
config: ServerConfig,
|
||||
_conn: &mut rusqlite::Connection,
|
||||
data_dir: PathBuf,
|
||||
args: &Args,
|
||||
) -> Result<()> {
|
||||
debug!("Starting REST HTTP server on {}", config.address);
|
||||
|
||||
@@ -114,6 +116,7 @@ async fn run_server(
|
||||
db: db_conn,
|
||||
data_dir: data_dir.clone(),
|
||||
password: config.password.clone(),
|
||||
args: Arc::new((*_conn).clone()), // This won't work, need to pass the actual args
|
||||
};
|
||||
|
||||
let app = Router::new()
|
||||
@@ -196,39 +199,25 @@ async fn handle_status(
|
||||
return Err(StatusCode::UNAUTHORIZED);
|
||||
}
|
||||
|
||||
// Create dummy args for compatibility with status mode functions
|
||||
let args = crate::Args {
|
||||
mode: crate::ModeArgs {
|
||||
save: false,
|
||||
get: false,
|
||||
diff: false,
|
||||
list: false,
|
||||
update: false,
|
||||
delete: false,
|
||||
info: false,
|
||||
status: true,
|
||||
server: None,
|
||||
},
|
||||
item: crate::ItemArgs {
|
||||
meta: Vec::new(),
|
||||
digest: None,
|
||||
compression: None,
|
||||
meta_plugins: Vec::new(),
|
||||
},
|
||||
options: crate::OptionsArgs {
|
||||
dir: None,
|
||||
list_format: "id,time,size,tags,meta:hostname".to_string(),
|
||||
human_readable: false,
|
||||
verbose: 0,
|
||||
quiet: false,
|
||||
output_format: None,
|
||||
server_password: None,
|
||||
},
|
||||
ids_or_tags: Vec::new(),
|
||||
};
|
||||
// Use the actual args that the server was started with
|
||||
let args = &state.args;
|
||||
|
||||
// Determine which meta plugins would be enabled for a save operation
|
||||
let mut meta_plugin_types: Vec<MetaPluginType> = vec![]; // Empty for now, could be extended
|
||||
let mut meta_plugin_types: Vec<MetaPluginType> = crate::modes::common::cmd_args_meta_plugin_types(&mut Command::new("keep"), args);
|
||||
|
||||
// Add digest type if specified
|
||||
let digest_type = crate::modes::common::cmd_args_digest_type(&mut Command::new("keep"), args);
|
||||
let digest_meta_plugin_type = match digest_type {
|
||||
crate::meta_plugin::MetaPluginType::DigestSha256 => Some(MetaPluginType::DigestSha256),
|
||||
crate::meta_plugin::MetaPluginType::DigestMd5 => Some(MetaPluginType::DigestMd5),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
if let Some(digest_plugin_type) = digest_meta_plugin_type {
|
||||
if !meta_plugin_types.contains(&digest_plugin_type) {
|
||||
meta_plugin_types.push(digest_plugin_type);
|
||||
}
|
||||
}
|
||||
|
||||
let mut db_path = state.data_dir.clone();
|
||||
db_path.push("keep-1.db");
|
||||
|
||||
Reference in New Issue
Block a user