version history MVP
implement basic version history support; there's now an icon in the footer that lets you see the previous versions and their sources I'm a bit worried about spoilers but honestly it's yet another way to hint yourself at the cool secrets so I don't mind
This commit is contained in:
parent
46dee56331
commit
c58c07d846
28 changed files with 1066 additions and 330 deletions
|
@ -193,9 +193,11 @@ async fn branch(RawQuery(named_id): RawQuery, State(state): State<Arc<Server>>)
|
|||
.or_else(|| state.treehouse.branch_redirects.get(&named_id).copied());
|
||||
if let Some(branch_id) = branch_id {
|
||||
let branch = state.treehouse.tree.branch(branch_id);
|
||||
if let Source::Tree { input, tree_path } = state.treehouse.source(branch.file_id) {
|
||||
let file_path = state.target_dir.join(format!("{tree_path}.html"));
|
||||
match std::fs::read_to_string(&file_path) {
|
||||
if let Source::Tree {
|
||||
input, target_path, ..
|
||||
} = state.treehouse.source(branch.file_id)
|
||||
{
|
||||
match std::fs::read_to_string(target_path) {
|
||||
Ok(content) => {
|
||||
let branch_markdown_content = input[branch.content.clone()].trim();
|
||||
let mut per_page_metadata =
|
||||
|
@ -212,7 +214,7 @@ async fn branch(RawQuery(named_id): RawQuery, State(state): State<Arc<Server>>)
|
|||
));
|
||||
}
|
||||
Err(e) => {
|
||||
error!("error while reading file {file_path:?}: {e:?}");
|
||||
error!("error while reading file {target_path:?}: {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue