Skip to content

Commit

Permalink
Add vapid_key to the application entity in the REST API (mastodon#10058)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored Feb 16, 2019
1 parent 492c3c4 commit cdbd893
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/apps/credentials_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ class Api::V1::Apps::CredentialsController < Api::BaseController
respond_to :json

def show
render json: doorkeeper_token.application, serializer: REST::StatusSerializer::ApplicationSerializer
render json: doorkeeper_token.application, serializer: REST::ApplicationSerializer, fields: %i(name website vapid_key)
end
end
6 changes: 5 additions & 1 deletion app/serializers/rest/application_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class REST::ApplicationSerializer < ActiveModel::Serializer
attributes :id, :name, :website, :redirect_uri,
:client_id, :client_secret
:client_id, :client_secret, :vapid_key

def id
object.id.to_s
Expand All @@ -19,4 +19,8 @@ def client_secret
def website
object.website.presence
end

def vapid_key
Rails.configuration.x.vapid_public_key
end
end

0 comments on commit cdbd893

Please sign in to comment.