mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
fix(api): 🚑 Fix incorrect builds
Everything under api/ should be a route, or it messes up bundling
This commit is contained in:
parent
d839c274b1
commit
7b3158c102
8 changed files with 246 additions and 252 deletions
55
classes/schemas/pushsubscription.ts
Normal file
55
classes/schemas/pushsubscription.ts
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import { z } from "@hono/zod-openapi";
|
||||
import { PushSubscription } from "@versia/kit/db";
|
||||
|
||||
export const WebPushSubscriptionInput = z
|
||||
.object({
|
||||
subscription: z.object({
|
||||
endpoint: z.string().url().openapi({
|
||||
example: "https://yourdomain.example/listener",
|
||||
description: "Where push alerts will be sent to.",
|
||||
}),
|
||||
keys: z
|
||||
.object({
|
||||
p256dh: z.string().base64().openapi({
|
||||
description:
|
||||
"User agent public key. Base64 encoded string of a public key from a ECDH keypair using the prime256v1 curve.",
|
||||
example:
|
||||
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEoKCJeHCy69ywHcb3dAR/T8Sud5ljSFHJkuiR6it1ycqAjGTe5F1oZ0ef5QiMX/zdQ+d4jSKiO7RztIz+o/eGuQ==",
|
||||
}),
|
||||
auth: z.string().base64().length(24).openapi({
|
||||
description:
|
||||
"Auth secret. Base64 encoded string of 16 bytes of random data.",
|
||||
example: "u67u09PXZW4ncK9l9mAXkA==",
|
||||
}),
|
||||
})
|
||||
.strict(),
|
||||
}),
|
||||
data: z
|
||||
.object({
|
||||
policy: z
|
||||
.enum(["all", "followed", "follower", "none"])
|
||||
.default("all")
|
||||
.openapi({
|
||||
description:
|
||||
"Specify whether to receive push notifications from all, followed, follower, or none users.",
|
||||
}),
|
||||
alerts: PushSubscription.schema.shape.alerts,
|
||||
})
|
||||
.strict()
|
||||
.default({
|
||||
policy: "all",
|
||||
alerts: {
|
||||
mention: false,
|
||||
favourite: false,
|
||||
reblog: false,
|
||||
follow: false,
|
||||
poll: false,
|
||||
follow_request: false,
|
||||
status: false,
|
||||
update: false,
|
||||
"admin.sign_up": false,
|
||||
"admin.report": false,
|
||||
},
|
||||
}),
|
||||
})
|
||||
.strict();
|
||||
Loading…
Add table
Add a link
Reference in a new issue