Add home page
This commit is contained in:
parent
4124e84e25
commit
3c28b81405
|
@ -29,7 +29,7 @@ add_link_options(${FLAGS})
|
|||
|
||||
|
||||
add_executable(${PROJECT_NAME} main.cpp numberhelper.cpp config.cpp models.cpp client.cpp servehelper.cpp timeutils.cpp
|
||||
routes/css.cpp routes/user.cpp routes/status.cpp
|
||||
routes/home.cpp routes/css.cpp routes/user.cpp routes/status.cpp
|
||||
blankie/serializer.cpp blankie/escape.cpp)
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
|
|
4
main.cpp
4
main.cpp
|
@ -34,9 +34,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
httplib::Server server;
|
||||
|
||||
// server.Get("/", [&](const httplib::Request& req, httplib::Response& res) {
|
||||
// home_route(req, res, config);
|
||||
// });
|
||||
server.Get("/", home_route);
|
||||
server.Get("/style.css", css_route);
|
||||
server.Get("/(" DOMAIN_RE ")/@(" ACCT_RE ")(|/with_replies|/media)", user_route);
|
||||
server.Get("/(" DOMAIN_RE ")/users/(" ACCT_RE ")(|/with_replies|/media)", [](const httplib::Request& req, httplib::Response& res) {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#include "routes.h"
|
||||
#include "../servehelper.h"
|
||||
|
||||
void home_route(const httplib::Request& req, httplib::Response& res) {
|
||||
Element body("body", {
|
||||
Element("p", {"Coyote, a Javascript-less Mastodon frontend."}),
|
||||
Element("h2", {"Example links"}),
|
||||
Element("ul", {
|
||||
Element("li", {Element("a", {{"href", get_origin(req) + "/vt.social/@lina"}}, {"Asahi Lina (朝日リナ) // nullptr::live"})}),
|
||||
Element("li", {Element("a", {{"href", get_origin(req) + "/vt.social/@LucydiaLuminous/111290028216105435"}}, {"\"I love kids and their creativity. So I was explain…\""})}),
|
||||
}),
|
||||
Element("hr"),
|
||||
Element("p", {
|
||||
"The ", Element("a", {{"href", "https://gitlab.com/blankX/coyote"}}, {"source code"}), " to Coyote is available under the ",
|
||||
Element("a", {{"href", "https://gitlab.com/blankX/coyote/-/blob/master/LICENSE"}}, {"MIT license"}), ". "
|
||||
"Some icons are used from ", Element("a", {{"href", "https://fontawesome.com"}}, {"Font Awesome"}), " Free, which are created by Fonticons, Inc. and ",
|
||||
Element("a", {{"href", "https://fontawesome.com/license/free#icons"}}, {"licensed"}), " under the ",
|
||||
Element("a", {{"href", "https://creativecommons.org/licenses/by/4.0/"}}, {"CC-BY 4.0"}), ". "
|
||||
"Icons used are slightly modified for better accessibility."
|
||||
}),
|
||||
});
|
||||
|
||||
serve(req, res, "Coyote", std::move(body));
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
extern const uint64_t css_hash;
|
||||
|
||||
void home_route(const httplib::Request& req, httplib::Response& res);
|
||||
void css_route(const httplib::Request& req, httplib::Response& res);
|
||||
void user_route(const httplib::Request& req, httplib::Response& res);
|
||||
void status_route(const httplib::Request& req, httplib::Response& res);
|
||||
|
|
Loading…
Reference in New Issue