[Internal] Add in house visitor metrics support.

This commit is contained in:
Kira 2022-09-20 11:11:03 -07:00
parent fb1fb87047
commit 344dd032be
3 changed files with 20 additions and 13 deletions

View File

@ -146,6 +146,9 @@
<%= render "static/guest_warning" %>
<% end %>
<%= render "static/footer" %>
<% if Danbooru.config.enable_visitor_metrics? %>
<%= javascript_include_tag "https://plausible.dragonfru.it/js/script.js", nonce: true, defer: true, data: {domain: Danbooru.config.domain} %>
<% end %>
<%= render "static/deferred_posts" %>
<% end %>
</html>

View File

@ -302,43 +302,43 @@ fart'
def max_numbered_pages
750
end
def blip_max_size
1_000
end
def comment_max_size
10_000
end
def dmail_max_size
50_000
end
def forum_post_max_size
50_000
end
def note_max_size
1_000
end
def pool_descr_max_size
10_000
end
def post_descr_max_size
50_000
end
def ticket_max_size
5_000
end
def user_about_max_size
50_000
end
def wiki_page_max_size
250_000
end
@ -825,6 +825,10 @@ fart'
def readonly_mode?
false
end
def enable_visitor_metrics?
true
end
end
class EnvironmentConfiguration

View File

@ -6,15 +6,15 @@
Rails.application.config.content_security_policy do |policy|
policy.default_src :self
policy.script_src :self, 'ads.dragonfru.it', 'js-agent.newrelic.com', 'bam.nr-data.net', 'https://www.google.com/recaptcha/', 'https://www.gstatic.com/recaptcha/', 'https://www.recaptcha.net/', 'https://mc.yandex.ru/', 'https://yastatic.net'
policy.script_src :self, 'ads.dragonfru.it', 'js-agent.newrelic.com', 'bam.nr-data.net', 'https://www.google.com/recaptcha/', 'https://www.gstatic.com/recaptcha/', 'https://www.recaptcha.net/'
policy.style_src :self, :unsafe_inline
policy.connect_src :self, 'ads.dragonfru.it', 'bam.nr-data.net', 'https://mc.yandex.ru', 'https://yastatic.net'
policy.connect_src :self, 'ads.dragonfru.it', 'bam.nr-data.net', 'plausible.dragonfru.it'
policy.object_src :self, 'static1.e621.net', 'static1.e926.net'
policy.media_src :self, 'static1.e621.net', 'static1.e926.net'
policy.frame_ancestors :none
policy.frame_src 'https://www.google.com/recaptcha/', 'https://www.recaptcha.net/'
policy.font_src :self
policy.img_src :self, :data, 'static1.e621.net', 'static1.e926.net', 'ads.dragonfru.it', 'https://mc.yandex.ru', 'https://yastatic.net'
policy.img_src :self, :data, 'static1.e621.net', 'static1.e926.net', 'ads.dragonfru.it'
policy.child_src :none
policy.form_action :self, 'discord.e621.net', 'discord.com'
# # If you are using webpack-dev-server then specify webpack-dev-server host