mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-22 02:16:30 +00:00
set up favicon
This commit is contained in:
parent
dff0f8d6e3
commit
f34d87d60a
4 changed files with 11 additions and 1 deletions
BIN
assets/favicon.png
vendored
Normal file
BIN
assets/favicon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -9,3 +9,5 @@ pub static BADGE_UNKNOWN_SVG: &'static [u8; 972] =
|
|||
|
||||
pub static STATIC_STYLE_CSS: &'static str =
|
||||
include_str!(concat!(env!("OUT_DIR"), "/style.css"));
|
||||
pub static STATIC_FAVICON_PNG: &'static [u8; 1338] =
|
||||
include_bytes!("../../assets/favicon.png");
|
||||
|
|
|
@ -22,7 +22,8 @@ enum StatusFormat {
|
|||
|
||||
#[derive(Clone, Copy)]
|
||||
enum StaticFile {
|
||||
StyleCss
|
||||
StyleCss,
|
||||
FaviconPng
|
||||
}
|
||||
|
||||
enum Route {
|
||||
|
@ -44,6 +45,7 @@ impl Server {
|
|||
router.add("/", Route::Index);
|
||||
|
||||
router.add("/static/style.css", Route::Static(StaticFile::StyleCss));
|
||||
router.add("/static/favicon.png", Route::Static(StaticFile::FaviconPng));
|
||||
|
||||
router.add("/repo/:site/:qual/:name", Route::Status(StatusFormat::Html));
|
||||
router.add("/repo/:site/:qual/:name/status.json", Route::Status(StatusFormat::Json));
|
||||
|
@ -163,6 +165,11 @@ impl Server {
|
|||
Response::new()
|
||||
.with_header(ContentType("text/css".parse().unwrap()))
|
||||
.with_body(assets::STATIC_STYLE_CSS)
|
||||
},
|
||||
StaticFile::FaviconPng => {
|
||||
Response::new()
|
||||
.with_header(ContentType("image/png".parse().unwrap()))
|
||||
.with_body(assets::STATIC_FAVICON_PNG.to_vec())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ fn render_html<B: Render>(title: &str, body: B) -> Response {
|
|||
meta charset="utf-8";
|
||||
meta name="viewport" content="width=device-width, initial-scale=1";
|
||||
title (title)
|
||||
link rel="icon" type="image/png" href="/static/favicon.png";
|
||||
link rel="stylesheet" type="text/css" href="/static/style.css";
|
||||
link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600";
|
||||
link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Source+Code+Pro";
|
||||
|
|
Loading…
Reference in a new issue