parent
86749d3fbf
commit
fef9a2f36e
|
@ -8,7 +8,7 @@ void serve(const httplib::Request& req, httplib::Response& res, const Config& co
|
|||
|
||||
std::string css_url = get_origin(req, config) + "/style.css";
|
||||
res.set_header("Content-Security-Policy", "default-src 'none'; style-src "s + css_url
|
||||
+ "; img-src " + config.image_proxy_url.get_origin());
|
||||
+ "; img-src https://s.pximg.net " + config.image_proxy_url.get_origin());
|
||||
|
||||
Element html("html", {
|
||||
Element("head", {
|
||||
|
@ -73,6 +73,10 @@ std::string get_origin(const httplib::Request& req, const Config& config) {
|
|||
}
|
||||
|
||||
std::string proxy_image_url(const Config& config, blankie::murl::Url url) {
|
||||
if (url.hostname == "s.pximg.net") {
|
||||
return url.to_string();
|
||||
}
|
||||
|
||||
blankie::murl::Url new_url = config.image_proxy_url;
|
||||
if (!url.path.empty() && url.path[0] != '/') {
|
||||
new_url.path += '/';
|
||||
|
|
Loading…
Reference in New Issue