about summary refs log tree commit diff
path: root/app/controllers/api/web
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-01-11 02:41:35 -0600
committermultiple creatures <dev@multiple-creature.party>2020-01-11 02:41:35 -0600
commitff67dbed2b2878ba0d8032bdde08e06bc0eead3e (patch)
tree805919a162596e67dc8803f9db7892eefc289ea4 /app/controllers/api/web
parentd9a9a18afae94ec0a2160e746265e47d7b639eaf (diff)
pass monsterfork api exposure setting to all serializers + add `MONSTERFORK_API_FORCE_*` env vars to set api compatability modes for clients/apps
Diffstat (limited to 'app/controllers/api/web')
-rw-r--r--app/controllers/api/web/embeds_controller.rb2
-rw-r--r--app/controllers/api/web/push_subscriptions_controller.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/api/web/embeds_controller.rb b/app/controllers/api/web/embeds_controller.rb
index 6231733b7..3e7919184 100644
--- a/app/controllers/api/web/embeds_controller.rb
+++ b/app/controllers/api/web/embeds_controller.rb
@@ -7,7 +7,7 @@ class Api::Web::EmbedsController < Api::Web::BaseController
 
   def create
     status = StatusFinder.new(params[:url]).status
-    render json: status, serializer: OEmbedSerializer, width: 400
+    render json: status, serializer: OEmbedSerializer, width: 400, monsterfork_api: monsterfork_api
   rescue ActiveRecord::RecordNotFound
     oembed = FetchOEmbedService.new.call(params[:url])
     oembed[:html] = Formatter.instance.sanitize(oembed[:html], Sanitize::Config::MASTODON_OEMBED) if oembed[:html].present?
diff --git a/app/controllers/api/web/push_subscriptions_controller.rb b/app/controllers/api/web/push_subscriptions_controller.rb
index d8153e082..af3e09d24 100644
--- a/app/controllers/api/web/push_subscriptions_controller.rb
+++ b/app/controllers/api/web/push_subscriptions_controller.rb
@@ -39,7 +39,7 @@ class Api::Web::PushSubscriptionsController < Api::Web::BaseController
 
     active_session.update!(web_push_subscription: web_subscription)
 
-    render json: web_subscription, serializer: REST::WebPushSubscriptionSerializer
+    render json: web_subscription, serializer: REST::WebPushSubscriptionSerializer, monsterfork_api: monsterfork_api
   end
 
   def update
@@ -48,7 +48,7 @@ class Api::Web::PushSubscriptionsController < Api::Web::BaseController
     web_subscription = ::Web::PushSubscription.find(params[:id])
     web_subscription.update!(data: data_params)
 
-    render json: web_subscription, serializer: REST::WebPushSubscriptionSerializer
+    render json: web_subscription, serializer: REST::WebPushSubscriptionSerializer, monsterfork_api: monsterfork_api
   end
 
   private