Added a new section at the beginning

This commit is contained in:
p11 2023-11-20 22:24:03 +01:00
parent a0f0999c8f
commit 4519c5c7ab

View File

@ -374,12 +374,24 @@ fn handle_relative_connection(
let _ = write!(stream, "Content-Type: text/html; charset=\"utf-8\"\r\n"); let _ = write!(stream, "Content-Type: text/html; charset=\"utf-8\"\r\n");
let _ = write!(stream, "\r\n"); let _ = write!(stream, "\r\n");
let parent_path = relative_path
.rsplit_once('/')
.map(|(path, _)| path)
.unwrap_or_default();
let section = |stream: &mut TcpStream| {
let _ = writeln!(stream, "<hr>");
let _ = writeln!(stream, "<a href=\"/{parent_path}\">&lt;&lt; Back</a>");
};
let _ = writeln!( let _ = writeln!(
stream, stream,
"<p>👁️{} 💖️{} 💔️{}</p>", "<p>👁️{} 💖️{} 💔️{}</p>",
info.visits, info.up, info.down info.visits, info.up, info.down
); );
section(&mut stream);
let title = relative_path let title = relative_path
.rsplit_once('/') .rsplit_once('/')
.map(|(_, title)| title) .map(|(_, title)| title)
@ -503,16 +515,6 @@ fn handle_relative_connection(
unreachable!(); unreachable!();
} }
let parent_path = relative_path
.rsplit_once('/')
.map(|(path, _)| path)
.unwrap_or_default();
let section = |stream: &mut TcpStream| {
let _ = writeln!(stream, "<hr>");
let _ = writeln!(stream, "<a href=\"/{parent_path}\">&lt;&lt; Back</a>");
};
section(&mut stream); section(&mut stream);
if let Some(pki_path) = pki_path { if let Some(pki_path) = pki_path {