Fix webfinger response
FossilOrigin-Name: 23d6ff8d0f2ecbb1fc3b695d4471194180f62cb7bb6c5738935a87199f666156
This commit is contained in:
parent
a26e6aae4e
commit
ace295b683
5 changed files with 30 additions and 3 deletions
|
@ -9,6 +9,7 @@ set(sources src/main.cpp
|
|||
src/http/microhttpd_server.cpp
|
||||
src/http/request.cpp
|
||||
src/http/response.cpp
|
||||
src/protocol/webfinger//webfinger.cpp
|
||||
src/config/config_http.cpp
|
||||
src/config/config_db.cpp
|
||||
src/config/config_loader.cpp
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace HTTP
|
|||
* map to a function
|
||||
*/
|
||||
void add_routes(std::initializer_list<RequestCallbackPair_t> requests);
|
||||
void add_route(RequestCallbackPair_t requests);
|
||||
void add_route(RequestCallbackPair_t request);
|
||||
|
||||
/**
|
||||
* @brief Handles a crafted HTTP Request
|
||||
|
|
|
@ -26,6 +26,13 @@
|
|||
#include "http/microhttpd_server.h"
|
||||
#include "logger.h"
|
||||
#include "route_args.h"
|
||||
#include "protocol/webfinger/webfinger.h"
|
||||
|
||||
void init_routes(const std::unique_ptr<HTTP::Server>& server)
|
||||
{
|
||||
Protocol::Webfinger::init_webfinger(server.get());
|
||||
|
||||
}
|
||||
|
||||
int start_wormhole()
|
||||
{
|
||||
|
@ -70,6 +77,8 @@ int start_wormhole()
|
|||
|
||||
database->try_migration();
|
||||
|
||||
init_routes(server);
|
||||
|
||||
// TODO Move to another file
|
||||
server->add_routes({
|
||||
{ {HTTP::Request::Type::GET, "/"}, [](std::any& args, const HTTP::RequestArgs_t& arg){
|
||||
|
|
|
@ -16,11 +16,20 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
#include "http/response.h"
|
||||
#include "webfinger.h"
|
||||
#include "http/httpserver.h"
|
||||
#include "http/request.h"
|
||||
|
||||
using namespace Protocol;
|
||||
|
||||
void init_webfinger()
|
||||
HTTP::Response Route::webfinger(std::any& args, const HTTP::RequestArgs_t& arg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Webfinger::init_webfinger(HTTP::Server* server)
|
||||
{
|
||||
server->add_route({{HTTP::Request::Type::GET, "/.well-known/webfinger"}, Route::webfinger});
|
||||
}
|
||||
|
|
|
@ -18,10 +18,18 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "http/httpserver.h"
|
||||
#include "http/response.h"
|
||||
|
||||
namespace Route
|
||||
{
|
||||
HTTP::Response webfinger(std::any& args, const HTTP::RequestArgs_t& arg);
|
||||
}
|
||||
|
||||
namespace Protocol
|
||||
{
|
||||
namespace Webfinger
|
||||
{
|
||||
|
||||
void init_webfinger(HTTP::Server* server);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue