Geometric logo

This commit is contained in:
spikecodes
2021-02-25 09:07:45 -08:00
parent a3ec44149c
commit 5d643277bc
10 changed files with 22 additions and 51 deletions

View File

@ -63,7 +63,7 @@ async fn iphone_logo(_req: Request<()>) -> tide::Result {
Ok(
Response::builder(200)
.content_type("image/png")
.body(include_bytes!("../static/touch-icon-iphone.png").as_ref())
.body(include_bytes!("../static/apple-touch-icon.png").as_ref())
.build(),
)
}
@ -71,9 +71,9 @@ async fn iphone_logo(_req: Request<()>) -> tide::Result {
async fn favicon(_req: Request<()>) -> tide::Result {
Ok(
Response::builder(200)
.content_type("image/vnd.microsoft.icon")
.content_type("image/png")
.header("Cache-Control", "public, max-age=1209600, s-maxage=86400")
.body(include_bytes!("../static/favicon.ico").as_ref())
.body(include_bytes!("../static/favicon.png").as_ref())
.build(),
)
}
@ -154,9 +154,11 @@ async fn main() -> tide::Result<()> {
// Read static files
app.at("/style.css/").get(|_| resource(include_str!("../static/style.css"), "text/css", false));
app.at("/manifest.json/").get(|_| resource(include_str!("../static/manifest.json"), "application/json", false));
app
.at("/manifest.json/")
.get(|_| resource(include_str!("../static/manifest.json"), "application/json", false));
app.at("/robots.txt/").get(|_| resource("User-agent: *\nAllow: /", "text/plain", true));
app.at("/favicon.ico/").get(favicon);
app.at("/favicon.png/").get(favicon);
app.at("/logo.png/").get(pwa_logo);
app.at("/touch-icon-iphone.png/").get(iphone_logo);
app.at("/apple-touch-icon.png/").get(iphone_logo);

View File

@ -143,7 +143,8 @@ pub struct GalleryMedia {
impl GalleryMedia {
fn parse(items: &Value, metadata: &Value) -> Vec<Self> {
items.as_array()
items
.as_array()
.unwrap_or(&Vec::new())
.iter()
.map(|item| {
@ -497,7 +498,12 @@ pub fn redirect(path: String) -> Response {
}
pub async fn error(req: Request<()>, msg: String) -> tide::Result {
let body = ErrorTemplate { msg, prefs: Preferences::new(req) }.render().unwrap_or_default();
let body = ErrorTemplate {
msg,
prefs: Preferences::new(req),
}
.render()
.unwrap_or_default();
Ok(Response::builder(404).content_type("text/html").body(body).build())
}