feat(auth): add authentication middleware to export controller
This commit is contained in:
parent
630b34ee10
commit
dc5c88efcd
1 changed files with 8 additions and 5 deletions
|
|
@ -18,6 +18,7 @@ import {
|
||||||
type SecretsMode,
|
type SecretsMode,
|
||||||
type FullExportBody,
|
type FullExportBody,
|
||||||
} from "./config-export.dto";
|
} from "./config-export.dto";
|
||||||
|
import { requireAuth } from "../auth/auth.middleware";
|
||||||
|
|
||||||
const COOKIE_NAME = "session_id";
|
const COOKIE_NAME = "session_id";
|
||||||
const COOKIE_OPTIONS = {
|
const COOKIE_OPTIONS = {
|
||||||
|
|
@ -175,11 +176,13 @@ function transformBackupSchedules(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const configExportController = new Hono().post(
|
export const configExportController = new Hono()
|
||||||
"/export",
|
.use(requireAuth)
|
||||||
fullExportDto,
|
.post(
|
||||||
validator("json", fullExportBodySchema),
|
"/export",
|
||||||
async (c) => {
|
fullExportDto,
|
||||||
|
validator("json", fullExportBodySchema),
|
||||||
|
async (c) => {
|
||||||
try {
|
try {
|
||||||
const body = c.req.valid("json") as FullExportBody;
|
const body = c.req.valid("json") as FullExportBody;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue