Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
confighttp.h
Go to the documentation of this file.
1
5#pragma once
6
7// standard includes
8#include <functional>
9#include <chrono>
10#include <string>
11#include <unordered_map>
12#include <string_view>
13
14// lib includes
15#include <nlohmann/json.hpp>
16
17// local includes
18#include "thread_safe.h"
19
20#define WEB_DIR HERMES_ASSETS_DIR "/web/"
21
22using namespace std::chrono_literals;
23
24namespace confighttp {
25 constexpr auto PORT_HTTPS = 1;
26 constexpr auto SESSION_EXPIRE_DURATION = 24h * 15;
27 void start();
28
35 nlohmann::json hestia_preflight_json();
36
45 nlohmann::json hestia_capabilities_json();
46
54 nlohmann::json computed_config_json();
55
66 nlohmann::json &overlay_config_file(nlohmann::json &response, const std::unordered_map<std::string, std::string> &file_values);
67
73 bool local_api_token_origin_allowed(std::string_view address);
74} // namespace confighttp
75
76// mime types map
77const std::map<std::string, std::string> mime_types = {
78 {"css", "text/css"},
79 {"gif", "image/gif"},
80 {"htm", "text/html"},
81 {"html", "text/html"},
82 {"ico", "image/x-icon"},
83 {"jpeg", "image/jpeg"},
84 {"jpg", "image/jpeg"},
85 {"js", "application/javascript"},
86 {"json", "application/json"},
87 {"png", "image/png"},
88 {"svg", "image/svg+xml"},
89 {"ttf", "font/ttf"},
90 {"txt", "text/plain"},
91 {"woff2", "font/woff2"},
92 {"xml", "text/xml"},
93};
bool local_api_token_origin_allowed(std::string_view address)
Whether an address may authenticate with the Game Mode local token.
nlohmann::json hestia_capabilities_json()
The Hestia extension capabilities document.
nlohmann::json computed_config_json()
Get the configuration settings.
nlohmann::json & overlay_config_file(nlohmann::json &response, const std::unordered_map< std::string, std::string > &file_values)
Overlay a parsed hermes.conf onto response, in place.
void start()
Start the HTTPS server.
nlohmann::json hestia_preflight_json()
Aggregate "is the host ready to stream?" checks.
Declarations for thread-safe data structures.