diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/mod.rs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs index e3dad3f..b37dfea 100644 --- a/src/frontend/mod.rs +++ b/src/frontend/mod.rs @@ -234,7 +234,9 @@ mod templates { p { "Consider telling more about yourself, your skills and interests in this note " @markup::raw("—") - " though you're free to write anything you want. (By the way, you can use Markdown here to spice up your note!)" + " though you're free to write anything you want. (By the way, you can use " + a[href="https://daringfireball.net/projects/markdown/syntax"] { "Markdown" } + " here to spice up your note!)" } textarea#first_post_content[style="width: 100%; height: 8em", placeholder="Hello! I am really excited about #IndieWeb"] {} @@ -387,7 +389,13 @@ mod templates { @if photo.is_string() { img."u-photo"[src=photo.as_str().unwrap(), loading="lazy"]; } else if photo.is_array() { - img."u-photo"[src=photo["value"].as_str().unwrap(), loading="lazy", alt=photo["alt"].as_str().unwrap_or("")]; + @if photo["thumbnail"].is_string() { + a."u-photo"[href=photo["value"].as_str().unwrap()] { + img[src=photo["thumbnail"].as_str().unwrap(), loading="lazy", alt=photo["alt"].as_str().unwrap_or("")]; + } + } else { + img."u-photo"[src=photo["value"].as_str().unwrap(), loading="lazy", alt=photo["alt"].as_str().unwrap_or("")]; + } } } } @@ -524,7 +532,7 @@ mod templates { "JavaScript isn't a menace, stop fearing it or I will switch to WebAssembly " "and knock your nico-nico-kneecaps so fast with its speed you won't even notice that... " small { "omae ha mou shindeiru" } - // NANI?!!! + @markup::raw("<!-- NANI?!!! -->") } } } } @@ -745,7 +753,7 @@ pub async fn onboarding_receiver<S: Storage>(mut req: Request<ApplicationState<S req.set_ext(user); crate::micropub::post::new_post(req, hentry).await?; - return Ok(Response::builder(201).header("Location", "/").build()); + Ok(Response::builder(201).header("Location", "/").build()) } pub async fn coffee<S: Storage>(_: Request<ApplicationState<S>>) -> Result { @@ -800,7 +808,7 @@ pub async fn mainpage<S: Storage>(req: Request<ApplicationState<S>>) -> Result { ) .build()) } else { - return Err(feed_err.into()); + Err(feed_err.into()) } } else { Ok(Response::builder(200) @@ -809,7 +817,7 @@ pub async fn mainpage<S: Storage>(req: Request<ApplicationState<S>>) -> Result { Template { title: &format!("{} - Main page", url.host().unwrap().to_string()), blog_name: &backend - .get_setting("site_name", &url.host().unwrap().to_string()) + .get_setting("site_name", hcard_url) .await .unwrap_or_else(|_| "Kitty Box!".to_string()), endpoints: IndiewebEndpoints { @@ -862,6 +870,7 @@ pub async fn render_post<S: Storage>(req: Request<ApplicationState<S>>) -> Resul .into()) } }; + let origin = url.origin(); Ok(Response::builder(200) .content_type("text/html; charset=utf-8") @@ -873,7 +882,7 @@ pub async fn render_post<S: Storage>(req: Request<ApplicationState<S>>) -> Resul blog_name: &req .state() .storage - .get_setting("site_name", &url.host().unwrap().to_string()) + .get_setting("site_name", &(origin.ascii_serialization() + "/")) // XXX I'm pretty sure this is bound to cause issues with IDN-style domains .await .unwrap_or_else(|_| "Kitty Box!".to_string()), endpoints: IndiewebEndpoints { |