Skip to content

Commit

Permalink
Add temporary favicon (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Aug 19, 2022
1 parent 700109f commit a1c33ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ impl Server {
.route("/block/:hash", get(Self::block))
.route("/bounties", get(Self::bounties))
.route("/faq", get(Self::faq))
.route("/favicon.ico", get(Self::favicon))
.route("/height", get(Self::height))
.route("/ordinal/:ordinal", get(Self::ordinal))
.route("/output/:output", get(Self::output))
Expand Down Expand Up @@ -329,6 +330,10 @@ impl Server {
)
}

async fn favicon() -> impl IntoResponse {
Self::static_asset(extract::Path("/favicon.png".to_string())).await
}

async fn static_asset(extract::Path(path): extract::Path<String>) -> impl IntoResponse {
match StaticAssets::get(if let Some(stripped) = path.strip_prefix('/') {
stripped
Expand Down
Binary file added static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,9 @@ fn bounties() {
r".*<title>Ordinal Bounties</title>.*<h1>Ordinal Bounties</h1>.*",
);
}

#[test]
fn favicon() {
let mut state = State::new();
state.request_expected("favicon.ico", 200, Expected::Ignore);
}

0 comments on commit a1c33ba

Please sign in to comment.