summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Reeder <colin@vpzom.click>2020-06-30 08:38:15 -0600
committerColin Reeder <colin@vpzom.click>2020-06-30 08:38:15 -0600
commit921ccbee04a96b31829207237d04536f34e247ac (patch)
tree57d2060c702fadee848d1aa574e15adf15f5957b
parent34126a8421eab043202b693fb55df13d3334a8f7 (diff)
Add basic About page
-rw-r--r--src/components/mod.rs1
-rw-r--r--src/routes/mod.rs29
2 files changed, 30 insertions, 0 deletions
diff --git a/src/components/mod.rs b/src/components/mod.rs
index d60282d..43e762a 100644
--- a/src/components/mod.rs
+++ b/src/components/mod.rs
@@ -155,6 +155,7 @@ pub fn HTPage<'base_data, Children: render::Render>(
<div class={"left actionList"}>
<a href={"/"} class={"siteName"}>{"lotide"}</a>
<a href={"/communities"}>{"Communities"}</a>
+ <a href={"/about"}>{"About"}</a>
</div>
<div class={"right actionList"}>
{
diff --git a/src/routes/mod.rs b/src/routes/mod.rs
index 06f5448..15c4bc0 100644
--- a/src/routes/mod.rs
+++ b/src/routes/mod.rs
@@ -93,6 +93,31 @@ fn html_response(html: String) -> hyper::Response<hyper::Body> {
res
}
+async fn page_about(
+ _: (),
+ ctx: Arc<crate::RouteContext>,
+ req: hyper::Request<hyper::Body>,
+) -> Result<hyper::Response<hyper::Body>, crate::Error> {
+ let cookies = get_cookie_map_for_req(&req)?;
+
+ let base_data = fetch_base_data(&ctx.backend_host, &ctx.http_client, &cookies).await?;
+
+ Ok(html_response(render::html! {
+ <HTPage base_data={&base_data}>
+ <h2>{"What is lotide?"}</h2>
+ <p>
+ {"lotide is an attempt to build a federated forum. "}
+ {"Users can create communities to share links and text posts and discuss them with other users, including those registered on other servers through "}
+ <a href={"https://activitypub.rocks"}>{"ActivityPub"}</a>{"."}
+ </p>
+ <p>
+ {"For more information or to view the source code, check out the "}
+ <a href={"https://sr.ht/~vpzom/lotide/"}>{"SourceHut page"}</a>{"."}
+ </p>
+ </HTPage>
+ }))
+}
+
async fn page_comment(
params: (i64,),
ctx: Arc<crate::RouteContext>,
@@ -623,6 +648,10 @@ pub fn route_root() -> crate::RouteNode<()> {
crate::RouteNode::new()
.with_handler_async("GET", page_home)
.with_child(
+ "about",
+ crate::RouteNode::new().with_handler_async("GET", page_about),
+ )
+ .with_child(
"comments",
crate::RouteNode::new().with_child_parse::<i64, _>(
crate::RouteNode::new()