mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-01-26 08:11:17 +01:00
Return VAPID public key when registering an app
This commit is contained in:
parent
b082e53c8c
commit
5a2e8341a2
@ -615,6 +615,11 @@ func (c *Converter) AccountToAdminAPIAccount(ctx context.Context, a *gtsmodel.Ac
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Converter) AppToAPIAppSensitive(ctx context.Context, a *gtsmodel.Application) (*apimodel.Application, error) {
|
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{
|
return &apimodel.Application{
|
||||||
ID: a.ID,
|
ID: a.ID,
|
||||||
Name: a.Name,
|
Name: a.Name,
|
||||||
@ -622,6 +627,7 @@ func (c *Converter) AppToAPIAppSensitive(ctx context.Context, a *gtsmodel.Applic
|
|||||||
RedirectURI: a.RedirectURI,
|
RedirectURI: a.RedirectURI,
|
||||||
ClientID: a.ClientID,
|
ClientID: a.ClientID,
|
||||||
ClientSecret: a.ClientSecret,
|
ClientSecret: a.ClientSecret,
|
||||||
|
VapidKey: vapidKeyPair.Public,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1755,7 +1761,7 @@ func (c *Converter) InstanceToAPIV2Instance(ctx context.Context, i *gtsmodel.Ins
|
|||||||
|
|
||||||
vapidKeyPair, err := c.state.DB.GetVAPIDKeyPair(ctx)
|
vapidKeyPair, err := c.state.DB.GetVAPIDKeyPair(ctx)
|
||||||
if err != nil {
|
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
|
instance.Configuration.VAPID.PublicKey = vapidKeyPair.Public
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user