Defined a new entry handler

This commit is contained in:
p11 2025-04-08 00:29:43 +02:00
parent 3cce8e8aa8
commit 9e180c2258

View File

@ -519,7 +519,12 @@ fn handle_relative_connection(
.rsplit_once('/')
.map_or(relative_path, |(_, title)| title);
let handle_entry = |mut entry: &str, output: &mut TcpStream, level: usize| {
fn entry_handler(
path: &Path,
relative_path: &str,
censored: bool,
) -> impl Fn(&str, &mut TcpStream, usize) {
move |mut entry, output, level| {
let level = level + 1;
let mut pki_path = path.to_path_buf();
let mut audio_path = path.to_path_buf();
@ -556,7 +561,8 @@ fn handle_relative_connection(
output,
level,
);
};
}
}
let Ok(pk_file) = File::open(file_paths.pk) else {
unreachable!();
@ -571,7 +577,7 @@ fn handle_relative_connection(
lines.map(Result::unwrap_or_default),
&mut stream,
Settings::default()
.with_handler(handle_entry)
.with_handler(entry_handler(path, relative_path, censored))
.with_start_level(start_level)
.with_use_textboxes(true),
);