:-'Generic Commit'
Some checks failed
Build-Test-Publish / Build (push) Failing after 2s

This commit is contained in:
Your Name
2025-05-29 22:33:19 +12:00
parent f9fee188e8
commit c0489ff4d9
4 changed files with 25 additions and 23 deletions

View File

@@ -153,25 +153,10 @@ void Server::setup_routes() {
});
// Welcome page
server_.Get("/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
if (req.path == "/") {
res.set_content(welcome_page(), "text/html");
return;
}
// if the path is not /, then it's a hash or label:tag
handle_get_object(req, res);
});
server_.Get("/index.html", [](const httplib::Request&, httplib::Response& res) {
res.set_content(welcome_page(), "text/html");
});
// Get object by hash or label:tag
server_.Get("/object/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
handle_get_object(req, res);
});
// Get hash for label:tag
server_.Get("/hash/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
handle_get_hash(req, res);
@@ -218,6 +203,22 @@ void Server::setup_routes() {
server_.Get("/status", [this](const httplib::Request& req, httplib::Response& res) {
res.set_content(nlohmann::json({{"result", "success"}, {"status", "ok"}}).dump(), "application/json");
});
// Get object by hash or label:tag
server_.Get("/object/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
handle_get_object(req, res);
});
// Welcome page and download object.
server_.Get("/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
if (req.path == "/") {
res.set_content(welcome_page(), "text/html");
return;
}
// if the path is not /, then it's a hash or label:tag
handle_get_object(req, res);
});
}
void Server::handle_cors_preflight(const httplib::Request& req, httplib::Response& res) {