mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Add VAPID public key to instance serializer (#28006)
Co-authored-by: Renaud Chaput <renchap@gmail.com>
This commit is contained in:
parent
c40cfc5d09
commit
603b245cc6
3 changed files with 14 additions and 1 deletions
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
class REST::ApplicationSerializer < ActiveModel::Serializer
|
class REST::ApplicationSerializer < ActiveModel::Serializer
|
||||||
attributes :id, :name, :website, :scopes, :redirect_uri,
|
attributes :id, :name, :website, :scopes, :redirect_uri,
|
||||||
:client_id, :client_secret, :vapid_key
|
:client_id, :client_secret
|
||||||
|
|
||||||
|
# NOTE: Deprecated in 4.3.0, needs to be removed in 5.0.0
|
||||||
|
attribute :vapid_key
|
||||||
|
|
||||||
def id
|
def id
|
||||||
object.id.to_s
|
object.id.to_s
|
||||||
|
|
|
@ -48,6 +48,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||||
status: object.status_page_url,
|
status: object.status_page_url,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
vapid: {
|
||||||
|
public_key: Rails.configuration.x.vapid_public_key,
|
||||||
|
},
|
||||||
|
|
||||||
accounts: {
|
accounts: {
|
||||||
max_featured_tags: FeaturedTag::LIMIT,
|
max_featured_tags: FeaturedTag::LIMIT,
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,5 +10,11 @@ describe REST::InstanceSerializer do
|
||||||
it 'returns recent usage data' do
|
it 'returns recent usage data' do
|
||||||
expect(serialization['usage']).to eq({ 'users' => { 'active_month' => 0 } })
|
expect(serialization['usage']).to eq({ 'users' => { 'active_month' => 0 } })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'returns the VAPID public key' do
|
||||||
|
expect(serialization['configuration']['vapid']).to eq({
|
||||||
|
'public_key' => Rails.configuration.x.vapid_public_key,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue