mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-02-05 07:37:02 +01:00
Return VAPID public key when registering an app
This commit is contained in:
parent
86fcc61879
commit
db2ba34630
1 changed files with 7 additions and 1 deletions
|
@ -616,6 +616,11 @@ func (c *Converter) AccountToAdminAPIAccount(ctx context.Context, a *gtsmodel.Ac
|
|||
}
|
||||
|
||||
func (c *Converter) AppToAPIAppSensitive(ctx context.Context, a *gtsmodel.Application) (*apimodel.Application, error) {
|
||||
vapidKeyPair, err := c.state.DB.GetVAPIDKeyPair(ctx)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("error getting VAPID public key: %w", err)
|
||||
}
|
||||
|
||||
return &apimodel.Application{
|
||||
ID: a.ID,
|
||||
Name: a.Name,
|
||||
|
@ -623,6 +628,7 @@ func (c *Converter) AppToAPIAppSensitive(ctx context.Context, a *gtsmodel.Applic
|
|||
RedirectURI: a.RedirectURI,
|
||||
ClientID: a.ClientID,
|
||||
ClientSecret: a.ClientSecret,
|
||||
VapidKey: vapidKeyPair.Public,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -1880,7 +1886,7 @@ func (c *Converter) InstanceToAPIV2Instance(ctx context.Context, i *gtsmodel.Ins
|
|||
|
||||
vapidKeyPair, err := c.state.DB.GetVAPIDKeyPair(ctx)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("error getting VAPID key pair: %w", err)
|
||||
return nil, gtserror.Newf("error getting VAPID public key: %w", err)
|
||||
}
|
||||
instance.Configuration.VAPID.PublicKey = vapidKeyPair.Public
|
||||
|
||||
|
|
Loading…
Reference in a new issue