2023-04-03 15:10:08 +00:00
|
|
|
#include "routes.h"
|
2023-04-03 09:32:26 +00:00
|
|
|
#include "../servehelper.h"
|
2023-04-03 08:57:51 +00:00
|
|
|
|
2023-04-03 09:32:26 +00:00
|
|
|
void home_route(const httplib::Request& req, httplib::Response& res, const Config& config) {
|
2023-04-03 14:40:34 +00:00
|
|
|
std::string origin = get_origin(req, config);
|
|
|
|
auto get_artwork_element = [&](size_t illust_id, const char* illust_title, size_t author_id, const char* author_display_name) {
|
|
|
|
return Element("li", {
|
|
|
|
Element("a", {{"href", origin + "/artworks/" + std::to_string(illust_id)}}, {illust_title}),
|
|
|
|
" by ",
|
|
|
|
Element("a", {{"href", origin + "/users/" + std::to_string(author_id)}}, {author_display_name}),
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
Element body("body", {
|
2023-04-09 15:28:00 +00:00
|
|
|
"Pixwhile is an alternative frontend to Pixiv that utilizes no Javascript. (",
|
|
|
|
Element("a", {{"href", "https://gitlab.com/blankX/pixwhile"}}, {"source code"}),
|
|
|
|
")",
|
2023-04-28 10:32:01 +00:00
|
|
|
Element("form", {{"method", "get"}, {"action", "search"}}, {
|
|
|
|
Element("br"),
|
|
|
|
Element("input", {{"name", "q"}, {"required", ""}}, {}),
|
|
|
|
" ",
|
|
|
|
Element("button", {"Search for illustrations"})
|
|
|
|
}),
|
2023-04-03 14:40:34 +00:00
|
|
|
Element("h2", {"Try it out"}),
|
|
|
|
Element("ul", {
|
|
|
|
get_artwork_element(106623268, "アル社長の日常", 1960050, "torino"),
|
|
|
|
get_artwork_element(94449946, "Gura and Shion", 15961697, "ZWJ")
|
2023-04-09 15:28:00 +00:00
|
|
|
}),
|
|
|
|
Element("h2", {"Features"}),
|
|
|
|
Element("ul", {
|
|
|
|
Element("li", {"Does not contain an asinine amount of Javascript"}),
|
|
|
|
Element("li", {"Allows you to open the original versions of cover images and profile pictures"}),
|
2023-04-28 10:32:01 +00:00
|
|
|
Element("li", {"Can view illustrations and list user illustrations"}),
|
|
|
|
Element("li", {"Can search for newest and oldest illustrations"})
|
2023-04-09 15:28:00 +00:00
|
|
|
}),
|
|
|
|
Element("h2", {"Missing Features"}),
|
|
|
|
Element("p", {"This list is not exhaustive, nor does it mean that these are being worked on."}),
|
|
|
|
Element("ul", {
|
2023-04-28 10:32:01 +00:00
|
|
|
Element("li", {"Can only search for newest and oldest illustrations"}),
|
2023-04-09 15:28:00 +00:00
|
|
|
Element("li", {"No ability to login"}),
|
|
|
|
Element("li", {"No ability to see comments or like counts"}),
|
2023-04-03 14:40:34 +00:00
|
|
|
})
|
|
|
|
});
|
2023-04-03 09:32:26 +00:00
|
|
|
serve(req, res, config, "Pixwhile", std::move(body));
|
2023-04-03 08:57:51 +00:00
|
|
|
}
|