about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2017-07-15 14:33:15 -0700
committerkibigo! <marrus-sh@users.noreply.github.com>2017-07-15 14:33:15 -0700
commit09cfc079b0958c42fe619e2d88c3f9fd1d7c7900 (patch)
tree156de790a5bec0fdf050e392bee8a64b220d3a9d /config/initializers
parent08d021916db9e350259b925d7e562aa13ba37422 (diff)
parent695439775eacea081c7257aabab39d0ec6b492dc (diff)
Merge upstream (#81)
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/inflections.rb2
-rw-r--r--config/initializers/mime_types.rb5
-rw-r--r--config/initializers/vapid.rb17
3 files changed, 21 insertions, 3 deletions
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index a7b1ef690..26275d092 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -14,4 +14,6 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
   inflect.acronym 'StatsD'
   inflect.acronym 'OEmbed'
   inflect.acronym 'ActivityPub'
+  inflect.acronym 'PubSubHubbub'
+  inflect.acronym 'ActivityStreams'
 end
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index b1b73c846..30e91ad63 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -1,5 +1,4 @@
 # Be sure to restart your server when you modify this file.
 
-Mime::Type.register "application/json",           :json, %w( text/x-json application/jsonrequest application/jrd+json )
-Mime::Type.register "text/xml",                   :xml,  %w( application/xml application/atom+xml application/xrd+xml )
-Mime::Type.register "application/activity+json",  :activitystreams2
+Mime::Type.register 'application/json', :json, %w(text/x-json application/jsonrequest application/jrd+json application/activity+json)
+Mime::Type.register 'text/xml',         :xml,  %w(application/xml application/atom+xml application/xrd+xml)
diff --git a/config/initializers/vapid.rb b/config/initializers/vapid.rb
new file mode 100644
index 000000000..618f5a3fb
--- /dev/null
+++ b/config/initializers/vapid.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+Rails.application.configure do
+
+  # You can generate the keys using the following command (first is the private key, second is the public one)
+  # You should only generate this once per instance. If you later decide to change it, all push subscription will
+  # be invalidated, requiring the users to access the website again to resubscribe.
+  #
+  # Generate with `rake mastodon:webpush:generate_vapid_key` task (`docker-compose run --rm web rake mastodon:webpush:generate_vapid_key` if you use docker compose)
+  #
+  # For more information visit https://rossta.net/blog/using-the-web-push-api-with-vapid.html
+
+  if Rails.env.production?
+    config.x.vapid_private_key = ENV['VAPID_PRIVATE_KEY']
+    config.x.vapid_public_key = ENV['VAPID_PUBLIC_KEY']
+  end
+end