@gallop.software/studio 2.3.107 → 2.3.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@
11
11
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
12
12
  }
13
13
  </style>
14
- <script type="module" crossorigin src="/assets/index-DBR9Z-gV.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-hfdKcjZr.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-DfPQBmNf.css">
16
16
  </head>
17
17
  <body>
@@ -4484,17 +4484,23 @@ async function handleEditImage(request) {
4484
4484
  const exifMeta = await sharp7(exifCorrectedBuffer).metadata();
4485
4485
  const exifWidth = exifMeta.width || 0;
4486
4486
  const exifHeight = exifMeta.height || 0;
4487
- const cropX = Math.max(0, Math.min(crop.x, exifWidth - 1));
4488
- const cropY = Math.max(0, Math.min(crop.y, exifHeight - 1));
4489
- const cropWidth = Math.min(crop.width, exifWidth - cropX);
4490
- const cropHeight = Math.min(crop.height, exifHeight - cropY);
4487
+ const cropX = Math.max(0, Math.min(Math.round(crop.x), exifWidth - 1));
4488
+ const cropY = Math.max(0, Math.min(Math.round(crop.y), exifHeight - 1));
4489
+ const cropWidth = Math.max(1, Math.min(Math.round(crop.width), exifWidth - cropX));
4490
+ const cropHeight = Math.max(1, Math.min(Math.round(crop.height), exifHeight - cropY));
4491
4491
  let pipeline = sharp7(exifCorrectedBuffer);
4492
4492
  if (cropX > 0 || cropY > 0 || cropWidth < exifWidth || cropHeight < exifHeight) {
4493
+ if (cropX + cropWidth > exifWidth || cropY + cropHeight > exifHeight) {
4494
+ return jsonResponse(
4495
+ { error: `Invalid crop area: ${cropX},${cropY} ${cropWidth}x${cropHeight} exceeds image ${exifWidth}x${exifHeight}` },
4496
+ { status: 400 }
4497
+ );
4498
+ }
4493
4499
  pipeline = pipeline.extract({
4494
- left: Math.round(cropX),
4495
- top: Math.round(cropY),
4496
- width: Math.round(cropWidth),
4497
- height: Math.round(cropHeight)
4500
+ left: cropX,
4501
+ top: cropY,
4502
+ width: cropWidth,
4503
+ height: cropHeight
4498
4504
  });
4499
4505
  }
4500
4506
  if (rotation !== 0) {
@@ -4687,7 +4693,15 @@ async function startServer(options) {
4687
4693
  );
4688
4694
  app.post("/api/studio/delete", wrapHandler(handleDelete));
4689
4695
  app.post("/api/studio/delete-stream", wrapHandler(handleDeleteStream, true));
4690
- app.use(express.static(join(workspace, "public")));
4696
+ app.use(express.static(join(workspace, "public"), {
4697
+ etag: false,
4698
+ lastModified: false,
4699
+ setHeaders: (res) => {
4700
+ res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
4701
+ res.setHeader("Pragma", "no-cache");
4702
+ res.setHeader("Expires", "0");
4703
+ }
4704
+ }));
4691
4705
  const clientDir = resolve(__dirname, "../client");
4692
4706
  app.get("/", (req, res) => {
4693
4707
  const htmlPath = join(clientDir, "index.html");
@@ -4704,7 +4718,15 @@ async function startServer(options) {
4704
4718
  res.status(404).send("Client not built. Run npm run build first.");
4705
4719
  }
4706
4720
  });
4707
- app.use(express.static(clientDir));
4721
+ app.use(express.static(clientDir, {
4722
+ etag: false,
4723
+ lastModified: false,
4724
+ setHeaders: (res) => {
4725
+ res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
4726
+ res.setHeader("Pragma", "no-cache");
4727
+ res.setHeader("Expires", "0");
4728
+ }
4729
+ }));
4708
4730
  const title = `Gallop - Studio (${version})`;
4709
4731
  app.listen(port, () => {
4710
4732
  console.log(`