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>
|
2023-04-06 12:24:09 +00:00
|
|
|
#include "blankie/murl.h"
|
2023-04-03 09:32:26 +00:00
|
|
|
#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);
|
2023-04-09 17:34:13 +00:00
|
|
|
std::string proxy_url(blankie::murl::Url base, blankie::murl::Url url);
|
2023-04-06 12:24:09 +00:00
|
|
|
std::string proxy_image_url(const Config& config, blankie::murl::Url url);
|