[FIX] Styling & auth issues

This commit is contained in:
Dunemask 2024-03-11 19:50:58 -06:00
parent ccfc1abc8e
commit fb60de692c
2 changed files with 11 additions and 2 deletions

View file

@ -3,6 +3,7 @@ import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import { basename } from "node:path";
import { getServerEntry } from "../database/queries/server-queries.js";
import { ERR } from "../util/logging.js";
import { checkAuthorization } from "../database/queries/server-queries.js";
const s3Region = "us-east-1";
async function getS3BackupData(serverId) {
@ -27,6 +28,11 @@ async function getS3BackupData(serverId) {
export async function listS3Backups(req, res) {
const serverSpec = req.body;
if (!serverSpec.id) return res.status(400).send("Server id missing!");
const authorized = await checkAuthorization(serverSpec.id, req.cairoId);
if (!authorized)
return res
.status(403)
.send("You do not have permission to access that server!");
const s3Data = await getS3BackupData(serverSpec.id);
if (!s3Data) return res.status(409).send("Backup not configured!");
const { s3Config, bucket, backupPrefix } = s3Data;
@ -55,7 +61,11 @@ export async function getS3BackupUrl(req, res) {
if (!serverSpec.id) return res.status(400).send("Server id missing!");
if (!serverSpec.backupPath)
return res.status(400).send("Backup path missing!");
const authorized = await checkAuthorization(serverSpec.id, req.cairoId);
if (!authorized)
return res
.status(403)
.send("You do not have permission to access that server!");
const s3Data = await getS3BackupData(serverSpec.id);
if (!s3Data) return res.status(409).send("Backup not configured!");
const { s3Config, bucket } = s3Data;

View file

@ -57,7 +57,6 @@ export default function BackupDialog(props) {
<Toolbar sx={{ display: { md: "none" } }} />
<DialogTitle>Backups</DialogTitle>
<DialogContent sx={{ height: "100%" }}>
<h1>Thine Backups {serverId}</h1>
{backups.map((backup, i) => (
<Stack key={i} sx={{ width: "100%" }} direction="row">
<Typography variant="subtitle2" sx={{ m: "auto 0", width: "40%" }}>