Add antiproxying protection.
Try to prevent malicious sites like danbooru.me or idanbooru.com from proxying our site and inserting ads. If we detect that we're not running on the real site, then we redirect to the real site.
This commit is contained in:
@@ -19,6 +19,14 @@ $(function() {
|
||||
$('#notice').fadeOut("fast");
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
||||
window.submitInvisibleRecaptchaForm = function () {
|
||||
Reference in New Issue
Block a user