don't apply rollback limits to admins

This commit is contained in:
HF 2022-04-01 14:40:08 +02:00
parent e2dd53add6
commit 1b3a54224f
2 changed files with 4 additions and 2 deletions

View File

@ -292,6 +292,7 @@ export async function executeRollback(
brcoor, brcoor,
canvasid, canvasid,
logger = null, logger = null,
isAdmin = false,
) { ) {
if (!canvasid) { if (!canvasid) {
return [403, 'canvasid not defined']; return [403, 'canvasid not defined'];
@ -320,8 +321,8 @@ export async function executeRollback(
const width = u - x + 1; const width = u - x + 1;
const height = v - y + 1; const height = v - y + 1;
if (width * height > 1000000) { if (!isAdmin && width * height > 1000000) {
return [403, 'Can not rollback more than 1m pixels at onec']; return [403, 'Can not rollback more than 1m pixels at once'];
} }
const pxlCount = await rollbackCanvasArea( const pxlCount = await rollbackCanvasArea(

View File

@ -144,6 +144,7 @@ router.post('/', upload.single('image'), async (req, res, next) => {
brcoor, brcoor,
canvasid, canvasid,
aLogger, aLogger,
(req.user.userlvl === 1),
); );
res.status(ret).send(msg); res.status(ret).send(msg);
return; return;