Add proxy option for proxying images
This commit is contained in:
parent
5850bc7e6c
commit
5f004f5b45
|
@ -5,7 +5,7 @@
|
|||
|
||||
Config load_config(const char* path) {
|
||||
File config_file(path, "r");
|
||||
return nlohmann::json::parse(config_file.get());
|
||||
return nlohmann::json::parse(config_file.get(), nullptr, true, true);
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json& j, Config& config) {
|
||||
|
@ -16,4 +16,5 @@ void from_json(const nlohmann::json& j, Config& config) {
|
|||
if (config.bind_port < 0) {
|
||||
throw std::invalid_argument("Invalid port to bind to: "s + std::to_string(config.bind_port));
|
||||
}
|
||||
j.at("image_proxy_url").get_to(config.image_proxy_url);
|
||||
}
|
||||
|
|
1
config.h
1
config.h
|
@ -6,6 +6,7 @@
|
|||
struct Config {
|
||||
std::string bind_host = "127.0.0.1";
|
||||
int bind_port = 8080;
|
||||
std::string image_proxy_url = "https://i.pixiv.cat";
|
||||
};
|
||||
|
||||
Config load_config(const char* path);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"bind_host": "127.0.0.1",
|
||||
"bind_port": 8080
|
||||
"bind_host": "127.0.0.1", // What address to bind to
|
||||
"bind_port": 8080, // What port to bind to
|
||||
"image_proxy_url": "https://i.pixiv.cat" // URL to proxy images to (see https://pixiv.cat/reverseproxy.html)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue