Fix antiproxying config options.

Don't embed config options directly in Javascript. Including them in the
Javascript forces us to recompile the Javascript whenever these options
change, which requires us to redeploy the entire site instead of just
restarting the app server.
This commit is contained in:
evazion
2020-06-02 18:38:58 -05:00
parent 18ce552dae
commit 91640447c0
2 changed files with 3 additions and 6 deletions

View File

@@ -20,12 +20,8 @@ $(function() {
e.preventDefault();
});
const CANONICAL_DOMAIN = <%= Danbooru.config.domain.to_json.html_safe %>;
const CANONICAL_HOSTNAME = <%= Danbooru.config.hostname.to_json.html_safe %>;
const ENABLE_ANTIPROXYING = <%= Danbooru.config.enable_antiproxying?.to_json.html_safe %>;
if (ENABLE_ANTIPROXYING && !location.hostname.endsWith(CANONICAL_DOMAIN)) {
location.hostname = CANONICAL_HOSTNAME;
if (Danbooru.config["enable_antiproxying?"] && !location.hostname.endsWith(Danbooru.config.domain)) {
location.hostname = Danbooru.config.hostname;
}
});