From 5c8839db2094c8089434cc20fe5fa2d21fc03ab5 Mon Sep 17 00:00:00 2001 From: Alec Murphy Date: Fri, 21 Mar 2025 08:28:51 -0400 Subject: [PATCH] Slon/Static/html/about: Add about page You can set the content for this page using the "about_page_content" key in database settings. --- Slon/Endpoints/Get/Web.HC | 24 +++++++++++++++++++++++- Slon/Static/js/statuses.js | 9 ++++++++- scripts/build-all | 8 +++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/Slon/Endpoints/Get/Web.HC b/Slon/Endpoints/Get/Web.HC index 625880b..e373d5e 100644 --- a/Slon/Endpoints/Get/Web.HC +++ b/Slon/Endpoints/Get/Web.HC @@ -4,13 +4,22 @@ if (String.EndsWith(".css", session->path())) { return; } +if (!StrICmp("/json/about.json", session->path())) { + JsonArray* about = Json.CreateArray(session->mem_task); + about->append(Json.CreateObject(session->mem_task), JSON_OBJECT); + about->o(0)->set("url", "_About this instance", JSON_STRING); + about->o(0)->set("content", db->o("settings")->@("about_page_content"), JSON_STRING); + session->send(about); + return; +} + if (!StrICmp("/js/header.js", session->path())) { session->content_type("text/javascript"); @slon_http_send_file(session, "M:/Slon/Static/js/header.js"); return; } -if (String.EndsWith(".js", session->path())) { +if (!StrICmp("/js/statuses.js", session->path())) { session->content_type("text/javascript"); @slon_http_send_file(session, "M:/Slon/Static/js/statuses.js"); return; @@ -20,3 +29,16 @@ if (String.BeginsWith("/@", session->path())) { @slon_web_user_get(session); return; } + +if (!StrICmp("/about", session->path())) { + @slon_http_send_file(session, "M:/Slon/Static/html/about.html"); + return; +} + +if (!StrICmp("/", session->path()) || !StrICmp("/index.html", session->path())) { + session->header("Location", "/about"); + session->status(302); + return; +} + +//