diff options
author | boastful-squirrel <boastful.squirrel@gmail.com> | 2019-05-01 11:17:13 +0000 |
---|---|---|
committer | boastful-squirrel <boastful.squirrel@gmail.com> | 2019-05-01 11:17:13 +0000 |
commit | f53a09b8d79c85b86b161c1ec7ca6f7cff5e169f (patch) | |
tree | 91debd6f936e9da20e5bdcd6fb7afa363bcff61c /src/renderer.rs | |
parent | Make error page uniform (diff) | |
download | miniserve-f53a09b8d79c85b86b161c1ec7ca6f7cff5e169f.tar.gz miniserve-f53a09b8d79c85b86b161c1ec7ca6f7cff5e169f.zip |
Display HTTP authentication errors
Diffstat (limited to 'src/renderer.rs')
-rw-r--r-- | src/renderer.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index ecc6bfe..03c46d8 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -32,7 +32,7 @@ pub fn page( ); html! { - (page_header(serve_path, color_scheme, file_upload)) + (page_header(serve_path, color_scheme, file_upload, false)) body#drop-container { @if file_upload { div.drag-form { @@ -760,14 +760,23 @@ fn chevron_down() -> Markup { } /// Partial: page header -fn page_header(serve_path: &str, color_scheme: ColorScheme, file_upload: bool) -> Markup { +fn page_header( + serve_path: &str, + color_scheme: ColorScheme, + file_upload: bool, + is_error: bool, +) -> Markup { html! { (DOCTYPE) html { meta charset="utf-8"; meta http-equiv="X-UA-Compatible" content="IE=edge"; meta name="viewport" content="width=device-width, initial-scale=1"; - title { "Index of " (serve_path) } + @if is_error { + title { (serve_path) } + } else { + title { "Index of " (serve_path) } + } style { (css(color_scheme)) } @if file_upload { (PreEscaped(r#" @@ -858,7 +867,7 @@ pub fn render_error( html! { body { - (page_header("Error", color_scheme, false)) + (page_header("Error", color_scheme, false, true)) div.error { p { "Error" } @for error in error_description.lines() { |