mirror of
https://git.alemi.dev/guestbook.rs.git
synced 2024-12-19 02:54:52 +01:00
feat: bundle and serve logo + favicon too
~500kB more, but binary is already ~24MB to change those just replace files inside ./web/ and rebuild, at runtime it's possible to add hrefs to other locations but not to change the static file served (because we don't read fs at runtime)
This commit is contained in:
parent
da2f1bf9d0
commit
5d83cf39b9
6 changed files with 22 additions and 3 deletions
|
@ -38,7 +38,7 @@ pub struct ConfigTemplate {
|
|||
#[serde_inline_default("guestbook".into())]
|
||||
pub title: String,
|
||||
|
||||
#[serde_inline_default("https://cdn.alemi.dev/social/someriver.jpg".into())]
|
||||
#[serde_inline_default("/logo.jpg".into())]
|
||||
pub logo: String,
|
||||
|
||||
#[serde_inline_default("you found my guestbook! please take a moment to sign it (:".into())]
|
||||
|
|
|
@ -16,6 +16,8 @@ pub fn create_router_with_app_routes(state: Context) -> Router {
|
|||
use sailfish::TemplateOnce;
|
||||
let template = state.template.clone();
|
||||
router = router
|
||||
.route("/favicon.ico", get(|| async { crate::web::STATIC_FAVICON }))
|
||||
.route("/logo.jpg", get(|| async { crate::web::STATIC_LOGO }))
|
||||
.route("/style.css", get(|| async { Css(crate::web::STATIC_CSS) }))
|
||||
.route("/infiniscroll.js", get(|| async { JavaScript(crate::web::STATIC_JS) }))
|
||||
.route("/", get(|| async move {
|
||||
|
|
|
@ -4,6 +4,8 @@ use crate::config::ConfigTemplate;
|
|||
|
||||
pub const STATIC_CSS : &str = include_str!("../web/style.css");
|
||||
pub const STATIC_JS : &str = include_str!("../web/infiniscroll.js");
|
||||
pub const STATIC_FAVICON : &[u8] = include_bytes!("../web/favicon.ico");
|
||||
pub const STATIC_LOGO : &[u8] = include_bytes!("../web/logo.jpg");
|
||||
|
||||
#[derive(Debug, TemplateOnce)]
|
||||
#[template(path = "index.stpl")]
|
||||
|
|
BIN
web/favicon.ico
Normal file
BIN
web/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
web/logo.jpg
Normal file
BIN
web/logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 500 KiB |
|
@ -49,6 +49,21 @@ table.center {
|
|||
font-size: .65em;
|
||||
}
|
||||
|
||||
.moreinfo {
|
||||
cursor: help;
|
||||
text-decoration: underline;
|
||||
color: #AAAAAA;
|
||||
}
|
||||
|
||||
.moreinfo:hover {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hidden-text {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
|
||||
img.avatar {
|
||||
border-radius: 50%;
|
||||
padding: .25em;
|
||||
|
@ -110,7 +125,7 @@ textarea:focus {
|
|||
}
|
||||
|
||||
@media screen and (max-width: 1600px) {
|
||||
img.pixar {
|
||||
img.round-cover {
|
||||
width: 60%;
|
||||
border: solid 15px var(--accent);
|
||||
}
|
||||
|
@ -138,7 +153,7 @@ textarea:focus {
|
|||
}
|
||||
|
||||
@media screen and (max-width: 700px) {
|
||||
img.pixar {
|
||||
img.round-cover {
|
||||
border: solid 10px var(--accent);
|
||||
padding: 15px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue