Skip to content

Commit fdf7cfa

Browse files
Gargronhiyuki2578
authored andcommitted
Add vapid_key to the application entity in the REST API (mastodon#10058)
Fix mastodon#8785
1 parent 98a3a9f commit fdf7cfa

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

app/controllers/api/v1/apps/credentials_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ class Api::V1::Apps::CredentialsController < Api::BaseController
66
respond_to :json
77

88
def show
9-
render json: doorkeeper_token.application, serializer: REST::StatusSerializer::ApplicationSerializer
9+
render json: doorkeeper_token.application, serializer: REST::ApplicationSerializer, fields: %i(name website vapid_key)
1010
end
1111
end

app/serializers/rest/application_serializer.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class REST::ApplicationSerializer < ActiveModel::Serializer
44
attributes :id, :name, :website, :redirect_uri,
5-
:client_id, :client_secret
5+
:client_id, :client_secret, :vapid_key
66

77
def id
88
object.id.to_s
@@ -19,4 +19,8 @@ def client_secret
1919
def website
2020
object.website.presence
2121
end
22+
23+
def vapid_key
24+
Rails.configuration.x.vapid_public_key
25+
end
2226
end

0 commit comments

Comments
 (0)