#include "routes.h" #include "../servehelper.h" #include "../client.h" #include "../models.h" void status_route(const httplib::Request& req, httplib::Response& res) { std::string server = req.matches.str(1); std::string id = req.matches.str(2); std::optional post; try { post = mastodon_client.get_post(server, id); } catch (const std::exception& e) { res.status = 500; serve_error(req, res, "500: Internal server error", "Failed to fetch post information", e.what()); return; } if (!post) { res.status = 404; serve_error(req, res, "404: Post not found"); return; } Element body("body", { serialize_post(req, server, *post), }); serve(req, res, "", std::move(body)); }