2023-04-03 09:32:26 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-04-03 15:27:07 +00:00
|
|
|
#include <optional>
|
|
|
|
|
2023-04-03 09:32:26 +00:00
|
|
|
#include <httplib/httplib.h>
|
|
|
|
#include "blankie/serializer.h"
|
|
|
|
|
|
|
|
struct Config; // forward declaration from config.h
|
|
|
|
using Element = blankie::html::Element;
|
|
|
|
|
|
|
|
void serve(const httplib::Request& req, httplib::Response& res, const Config& config, std::string title, Element element);
|
2023-04-03 15:27:07 +00:00
|
|
|
void serve_error(const httplib::Request& req, httplib::Response& res, const Config& config,
|
|
|
|
std::string title, std::optional<std::string> subtitle = std::nullopt, std::optional<std::string> info = std::nullopt);
|
2023-04-04 08:33:48 +00:00
|
|
|
void serve_redirect(const httplib::Request& req, httplib::Response& res, const Config& config, std::string url);
|
2023-04-03 14:40:34 +00:00
|
|
|
std::string get_origin(const httplib::Request& req, const Config& config);
|