mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-14 22:48:38 +09:00
feat: Instatus webhooks (#1349)
Co-authored-by: Hampus <[email protected]>
This commit is contained in:
1 parent
8dd230ea2f
commit
dec7b63d07
14 files changed
+1300
-27
No files matched your search
@@ -12,6 +12,7 @@ import {
|
||||
import {MessageRequestSchema} from '@fluxer/schema/src/domains/message/MessageRequestSchemas';
|
||||
import {MessageResponseSchema} from '@fluxer/schema/src/domains/message/MessageResponseSchemas';
|
||||
import {GitHubWebhook} from '@fluxer/schema/src/domains/webhook/GitHubWebhookSchemas';
|
||||
import {InstatusWebhook} from '@fluxer/schema/src/domains/webhook/InstatusWebhookSchemas';
|
||||
import {
|
||||
SlackWebhookRequest,
|
||||
WebhookCreateRequest,
|
||||
@@ -489,6 +490,31 @@ export function WebhookController(app: HonoApp) {
|
||||
return ctx.body('ok', 200);
|
||||
},
|
||||
);
|
||||
app.post(
|
||||
'/webhooks/:webhook_id/:token/instatus',
|
||||
RateLimitMiddleware(RateLimitConfigs.WEBHOOK_INSTATUS),
|
||||
OpenAPI({
|
||||
operationId: 'execute_instatus_webhook',
|
||||
summary: 'Execute Instatus webhook',
|
||||
description:
|
||||
'Receives and processes Instatus status page webhook events, formatting them as messages in the configured channel.',
|
||||
responseSchema: null,
|
||||
statusCode: 204,
|
||||
tags: ['Webhooks'],
|
||||
}),
|
||||
Validator('param', WebhookIdTokenParam),
|
||||
Validator('json', InstatusWebhook),
|
||||
async (ctx) => {
|
||||
const {webhook_id: webhookId, token} = ctx.req.valid('param');
|
||||
await ctx.get('webhookRequestService').executeInstatusWebhook({
|
||||
webhookId: createWebhookID(webhookId),
|
||||
token: createWebhookToken(token),
|
||||
data: ctx.req.valid('json'),
|
||||
requestCache: ctx.get('requestCache'),
|
||||
});
|
||||
return ctx.body(null, 204);
|
||||
},
|
||||
);
|
||||
app.post('/webhooks/livekit', async (ctx) => {
|
||||
const response = await ctx.get('webhookRequestService').handleLiveKitWebhook({
|
||||
body: await ctx.req.text(),
|
||||
|
||||
Reference in new issue
Block a user