plugin system

This commit is contained in:
2025-08-22 18:02:37 +02:00
parent c8e82edc4c
commit 92f2e5c0d1
51 changed files with 15687 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import { NextRequest, NextResponse } from 'next/server'
export async function POST(
request: NextRequest,
{ params }: { params: { pluginId: string } }
) {
try {
// Extract authorization header from the incoming request
const authHeader = request.headers.get('authorization')
if (!authHeader) {
return NextResponse.json(
{ error: 'Authorization header required' },
{ status: 401 }
)
}
const { pluginId } = params
// Make request to backend plugins enable endpoint
const baseUrl = process.env.INTERNAL_API_URL || process.env.NEXT_PUBLIC_API_URL
const url = `${baseUrl}/api/v1/plugins/${pluginId}/enable`
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': authHeader,
'Content-Type': 'application/json'
}
})
const data = await response.json()
if (!response.ok) {
return NextResponse.json(data, { status: response.status })
}
return NextResponse.json(data)
} catch (error) {
console.error('Error enabling plugin:', error)
return NextResponse.json(
{ error: 'Failed to enable plugin' },
{ status: 500 }
)
}
}