Fix antiproxying (again).
Fuck it, just hardcode it. They rewrite certain parts of our markup so we can't rely on anything in the html.
This commit is contained in:
@@ -272,6 +272,8 @@ module ApplicationHelper
|
||||
current_item_data_attributes = data_attributes_for(current_item, model_name, model_attributes)
|
||||
end
|
||||
|
||||
config_data_attributes = data_attributes_for(Danbooru.config, "config", [:hostname, :domain])
|
||||
|
||||
controller_param = params[:controller].parameterize.dasherize
|
||||
action_param = params[:action].parameterize.dasherize
|
||||
|
||||
@@ -282,8 +284,11 @@ module ApplicationHelper
|
||||
controller: controller_param,
|
||||
action: action_param,
|
||||
layout: controller.class.send(:_layout),
|
||||
"current-user-ip-addr": request.remote_ip,
|
||||
**current_user_data_attributes,
|
||||
**current_item_data_attributes.to_h
|
||||
**current_item_data_attributes.to_h,
|
||||
**config_data_attributes,
|
||||
"config-environment": Rails.env,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
@@ -20,8 +20,8 @@ $(function() {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
if (Danbooru.config["enable_antiproxying?"] && !location.hostname.endsWith(Danbooru.config.domain)) {
|
||||
location.hostname = Danbooru.config.hostname;
|
||||
if (location.hostname.endsWith("danbooru.me")) {
|
||||
location.hostname = "danbooru.donmai.us";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -120,7 +120,6 @@
|
||||
window.Danbooru = {};
|
||||
}
|
||||
|
||||
window.Danbooru.config = <%= [:hostname, :domain, :enable_antiproxying?].map { |opt| [opt, Danbooru.config.send(opt)] }.to_h.to_json.html_safe %>;
|
||||
window.Danbooru.notice = Danbooru.Utility.notice;
|
||||
window.Danbooru.error = Danbooru.Utility.error;
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user