add live reloading to the client
This commit is contained in:
parent
7169e65244
commit
5ce9cfc022
6 changed files with 38 additions and 18 deletions
|
@ -103,9 +103,9 @@ async fn vfs_entry(
|
|||
}
|
||||
}
|
||||
|
||||
async fn system_page(target: &AsyncDir, path: &VPath) -> Response {
|
||||
async fn system_page(target: &AsyncDir, path: &VPath, status_code: StatusCode) -> Response {
|
||||
if let Some(content) = target.content(path).await {
|
||||
(StatusCode::NOT_FOUND, Html(content)).into_response()
|
||||
(status_code, Html(content)).into_response()
|
||||
} else {
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
|
@ -116,11 +116,11 @@ async fn system_page(target: &AsyncDir, path: &VPath) -> Response {
|
|||
}
|
||||
|
||||
async fn index(State(state): State<Arc<Server>>) -> Response {
|
||||
system_page(&state.target, system::INDEX).await
|
||||
system_page(&state.target, system::INDEX, StatusCode::OK).await
|
||||
}
|
||||
|
||||
async fn four_oh_four(State(state): State<Arc<Server>>) -> Response {
|
||||
system_page(&state.target, system::FOUR_OH_FOUR).await
|
||||
system_page(&state.target, system::FOUR_OH_FOUR, StatusCode::NOT_FOUND).await
|
||||
}
|
||||
|
||||
async fn branch(RawQuery(named_id): RawQuery, State(state): State<Arc<Server>>) -> Response {
|
||||
|
@ -175,8 +175,8 @@ async fn branch(RawQuery(named_id): RawQuery, State(state): State<Arc<Server>>)
|
|||
}
|
||||
}
|
||||
|
||||
system_page(&state.target, system::FOUR_OH_FOUR).await
|
||||
system_page(&state.target, system::FOUR_OH_FOUR, StatusCode::NOT_FOUND).await
|
||||
} else {
|
||||
system_page(&state.target, system::B_DOCS).await
|
||||
system_page(&state.target, system::B_DOCS, StatusCode::OK).await
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue