Skip to content

Commit

Permalink
Adopt Fish Eye logo
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Jan 18, 2023
1 parent a082b40 commit 3e525dd
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 5 deletions.
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,6 @@ update-changelog:

preview-examples:
cargo run preview examples/*

convert-logo-to-favicon:
convert -background none -resize 256x256 logo.svg static/favicon.png
5 changes: 5 additions & 0 deletions logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 15 additions & 3 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ impl Server {
.route("/clock", get(Self::clock))
.route("/content/:inscription_id", get(Self::content))
.route("/faq", get(Self::faq))
.route("/favicon.ico", get(Self::favicon))
.route("/favicon.ico", get(Self::favicon_ico))
.route("/favicon.svg", get(Self::favicon_svg))
.route("/input/:block/:transaction/:input", get(Self::input))
.route("/inscription/:inscription_id", get(Self::inscription))
.route("/inscriptions", get(Self::inscriptions))
Expand Down Expand Up @@ -541,10 +542,21 @@ impl Server {
}
}

async fn favicon() -> ServerResult<Response> {
async fn favicon_ico() -> ServerResult<Response> {
Self::static_asset(Path("/favicon.png".to_string())).await
}

async fn favicon_svg() -> Response {
(
[(
header::CONTENT_SECURITY_POLICY,
HeaderValue::from_static("default-src 'unsafe-inline'"),
)],
Self::static_asset(Path("/favicon.svg".to_string())).await,
)
.into_response()
}

async fn static_asset(Path(path): Path<String>) -> ServerResult<Response> {
let content = StaticAssets::get(if let Some(stripped) = path.strip_prefix('/') {
stripped
Expand Down Expand Up @@ -628,7 +640,7 @@ impl Server {
);
headers.insert(
header::CONTENT_SECURITY_POLICY,
"default-src 'unsafe-eval' 'unsafe-inline'".parse().unwrap(),
HeaderValue::from_static("default-src 'unsafe-eval' 'unsafe-inline'"),
);

Some((headers, inscription.into_content()?))
Expand Down
Binary file modified 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.
18 changes: 18 additions & 0 deletions static/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
<meta property=og:image content='{{ url }}'>
%% }
<title>{{ self.content.title() }}</title>
<link href=/static/index.css rel=stylesheet>
<link href=/static/modern-normalize.css rel=stylesheet>
<link rel=icon type=image/svg+xml href=/favicon.svg>
<link rel=icon type=image/png href=/favicon.ico>
<link rel=stylesheet href=/static/index.css>
<link rel=stylesheet href=/static/modern-normalize.css>
<script src=/static/index.js defer></script>
</head>
<body>
Expand Down

0 comments on commit 3e525dd

Please sign in to comment.