mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Return a PushSubscription response
This commit is contained in:
parent
757b6c7e1c
commit
ff2553eb0f
1 changed files with 10 additions and 3 deletions
|
|
@ -58,7 +58,7 @@ export const pushSubscribeController: AppController = async (c) => {
|
|||
|
||||
const { subscription, data } = result.data;
|
||||
|
||||
await kysely
|
||||
const { id } = await kysely
|
||||
.insertInto('push_subscriptions')
|
||||
.values({
|
||||
pubkey: await signer.getPublicKey(),
|
||||
|
|
@ -68,7 +68,14 @@ export const pushSubscribeController: AppController = async (c) => {
|
|||
auth: subscription.keys.auth,
|
||||
data,
|
||||
})
|
||||
.execute();
|
||||
.returning('id')
|
||||
.executeTakeFirstOrThrow();
|
||||
|
||||
return c.json({});
|
||||
return c.json({
|
||||
id,
|
||||
endpoint: subscription.endpoint,
|
||||
alerts: data?.alerts ?? {},
|
||||
policy: data?.policy ?? 'all',
|
||||
// TODO: server_key
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue