From ff67dbed2b2878ba0d8032bdde08e06bc0eead3e Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sat, 11 Jan 2020 02:41:35 -0600 Subject: pass monsterfork api exposure setting to all serializers + add `MONSTERFORK_API_FORCE_*` env vars to set api compatability modes for clients/apps --- app/controllers/api/web/embeds_controller.rb | 2 +- app/controllers/api/web/push_subscriptions_controller.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app/controllers/api/web') 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 -- cgit