Fix: Checkboxes de eventos en formulario de webhook
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m2s
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m2s
This commit is contained in:
34
server/api/debug/blocklist/index.get.ts
Normal file
34
server/api/debug/blocklist/index.get.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* GET /api/debug/blocklist
|
||||
* Fetch the blocklist for an instance
|
||||
*/
|
||||
import { baileysManager } from '../../../services/baileys/manager'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const username = getHeader(event, 'x-authentik-username')
|
||||
if (!username) {
|
||||
throw createError({ statusCode: 401, message: 'Unauthorized' })
|
||||
}
|
||||
|
||||
const query = getQuery(event)
|
||||
const instanceId = query.instanceId as string
|
||||
|
||||
if (!instanceId) {
|
||||
throw createError({ statusCode: 400, message: 'instanceId is required' })
|
||||
}
|
||||
|
||||
const socket = baileysManager.getSocket(instanceId)
|
||||
if (!socket) {
|
||||
throw createError({ statusCode: 400, message: 'Instance not connected' })
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await socket.fetchBlocklist()
|
||||
return { success: true, data: result }
|
||||
} catch (error) {
|
||||
throw createError({
|
||||
statusCode: 500,
|
||||
message: `Failed to fetch blocklist: ${(error as Error).message}`
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user