feat: update vps-panel backup and notification features

This commit is contained in:
mstfyldz
2026-06-05 23:53:57 +03:00
parent 29d03604f9
commit c1f04735d6
22 changed files with 1029 additions and 372 deletions
+14 -4
View File
@@ -1,10 +1,14 @@
import { NextResponse } from 'next/server'
import { NextRequest, NextResponse } from 'next/server'
import pool from '@/lib/appDb'
import { generateId } from '@/lib/config'
import { reloadBackupCrons } from '@/lib/cronWorker'
import { requireAuth } from '@/lib/auth'
// GET configs and logs for a dbId
export async function GET(req: Request) {
export async function GET(req: NextRequest) {
const err = await requireAuth(req)
if (err) return err
const { searchParams } = new URL(req.url)
const dbId = searchParams.get('dbId')
if (!dbId) return NextResponse.json({ error: 'Missing dbId' }, { status: 400 })
@@ -23,7 +27,10 @@ export async function GET(req: Request) {
}
// Create or update a backup config
export async function POST(req: Request) {
export async function POST(req: NextRequest) {
const err = await requireAuth(req)
if (err) return err
try {
const body = await req.json()
const { db_id, schedule, cloud_type, credentials, gdrive_folder_id } = body
@@ -57,7 +64,10 @@ export async function POST(req: Request) {
}
// Delete backup config
export async function DELETE(req: Request) {
export async function DELETE(req: NextRequest) {
const err = await requireAuth(req)
if (err) return err
try {
const body = await req.json()
const { db_id } = body