Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY /patches ./patches
COPY package*.json ./
RUN npm pkg delete scripts.prepare
RUN npm ci --force --ignore-scripts
RUN npm rebuild canvas sharp
RUN npm rebuild canvas sharp skia-canvas
RUN npm run copy:assets
RUN npm run apply:patches

Expand Down
461 changes: 162 additions & 299 deletions code/package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"publish:snapshot": "nx run-many -t publish:snapshot -- --verbose --tag next --registry $NPM_PUBLISHING_REGISTRY --unsafe-perm",
"start": "node --experimental-specifier-resolution=node --env-file=.env --loader ts-node/esm dist/server.js",
"storage:cleanup": "tsx --env-file=./src/actions/storage-cleanup/.env ./src/actions/storage-cleanup/action.ts",
"verify": "npm ci --force --ignore-scripts && npm rebuild canvas sharp && npm run copy:assets && npm run apply:patches && npm run lint && npm run build",
"verify": "npm ci --force --ignore-scripts && npm rebuild canvas sharp skia-canvas && npm run copy:assets && npm run apply:patches && npm run lint && npm run build",
"version:development": "export BUMP_DEVELOP_VERSION=$(npm version $(npm version minor)-SNAPSHOT) && lerna version $BUMP_DEVELOP_VERSION --no-git-tag-version --no-push --force-publish --exact --yes && npm version $(npm version minor)-SNAPSHOT",
"version:release": "npm ci && lerna version --no-git-tag-version --no-push --force-publish --exact --yes $RELEASE_VERSION && npm version $RELEASE_VERSION"
},
Expand Down Expand Up @@ -77,18 +77,18 @@
"@inditextech/weave-store-standalone": "5.2.2",
"@inditextech/weave-types": "5.2.2",
"@mastra/ai-sdk": "1.4.3",
"@mastra/core": "1.36.0",
"@mastra/core": "1.64.0",
"@mastra/libsql": "1.11.1",
"@mastra/loggers": "1.1.1",
"@mastra/mcp": "1.8.0",
"@mastra/memory": "1.19.0",
"@mastra/memory": "1.28.2",
"@mastra/pg": "1.11.1",
"@modelcontextprotocol/node": "^2.0.0-alpha.2",
"@modelcontextprotocol/server": "^2.0.0-alpha.2",
"ai": "6.0.188",
"archiver": "^7.0.1",
"axios": "^1.10.0",
"better-auth": "^1.5.6",
"better-auth": "^1.7.3",
"brotli-compress": "^1.3.3",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
Expand All @@ -103,7 +103,6 @@
"file-type": "^21.3.0",
"google-auth-library": "^10.1.0",
"helmet": "^8.0.0",
"image-size": "^2.0.2",
"install": "^0.13.0",
"jsdom": "^26.1.0",
"konva": "10.0.2",
Expand Down
2 changes: 1 addition & 1 deletion code/src/api/v1/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function setupApiV1Router(app: Application) {
const routerBasePath = "/api/v1";

// Setup multer to upload files
const upload = multer();
const upload = multer({ limits: { fileSize: 100 * 1024 * 1024 } });

// Setup cors
const cors = getCorsMiddleware(routerBasePath);
Expand Down
6 changes: 3 additions & 3 deletions code/src/api/v2/controllers/postUploadImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

import { Request, Response } from "express";
import { imageSize } from "image-size";
import sharp from "sharp";
import { ImagesPersistenceHandler } from "../../../images/persistence.js";
import { createImage } from "../../../database/controllers/image.js";
import { ImageModel } from "../../../database/models/image.js";
Expand Down Expand Up @@ -34,8 +34,6 @@ export const postUploadImageController = () => {
const mimeType = file?.mimetype ?? "application/octet-stream";
const data = file?.buffer ?? new Uint8Array();

const dimensions = imageSize(data);

const fileName = `${roomId}/${imageId}`;

if (await persistenceHandler.exists(fileName)) {
Expand All @@ -45,6 +43,8 @@ export const postUploadImageController = () => {

try {
if (file) {
const dimensions = await sharp(data).metadata();

await persistenceHandler.persist(
fileName,
{ size: file.size, mimeType },
Expand Down
2 changes: 1 addition & 1 deletion code/src/api/v2/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function setupApiV2Router(app: Express) {
const routerBasePath = "/api/v2";

// Setup multer to upload files
const upload = multer();
const upload = multer({ limits: { fileSize: 100 * 1024 * 1024 } });

// Setup cors
const cors = getCorsMiddleware(routerBasePath);
Expand Down
3 changes: 1 addition & 2 deletions code/src/workloads/jobs/flip-image/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import { v4 as uuidv4 } from "uuid";
import fs from "node:fs";
import path from "node:path";
import { imageSize } from "image-size";
import pgBoss from "pg-boss";
import { ImagesPersistenceHandler } from "../../../images/persistence.js";
import {
Expand Down Expand Up @@ -265,7 +264,7 @@ export class FlipImageJob {
const imageBuffer = Buffer.from(image.dataBase64, "base64");

if (imageBuffer) {
const dimensions = imageSize(imageBuffer);
const dimensions = await sharp(imageBuffer).metadata();

const fileName = `${roomId}/${newImageId}`;

Expand Down
3 changes: 1 addition & 2 deletions code/src/workloads/jobs/grayscale-image/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import { v4 as uuidv4 } from "uuid";
import fs from "node:fs";
import path from "node:path";
import { imageSize } from "image-size";
import pgBoss from "pg-boss";
import { ImagesPersistenceHandler } from "../../../images/persistence.js";
import {
Expand Down Expand Up @@ -252,7 +251,7 @@ export class GrayscaleImageJob {
const imageBuffer = Buffer.from(image.dataBase64, "base64");

if (imageBuffer) {
const dimensions = imageSize(imageBuffer);
const dimensions = await sharp(imageBuffer).metadata();

const fileName = `${roomId}/${newImageId}`;

Expand Down
3 changes: 1 addition & 2 deletions code/src/workloads/jobs/negate-image/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import { v4 as uuidv4 } from "uuid";
import fs from "node:fs";
import path from "node:path";
import { imageSize } from "image-size";
import pgBoss from "pg-boss";
import { ImagesPersistenceHandler } from "../../../images/persistence.js";
import {
Expand Down Expand Up @@ -250,7 +249,7 @@ export class NegateImageJob {
const imageBuffer = Buffer.from(image.dataBase64, "base64");

if (imageBuffer) {
const dimensions = imageSize(imageBuffer);
const dimensions = await sharp(imageBuffer).metadata();

const fileName = `${roomId}/${newImageId}`;

Expand Down
4 changes: 2 additions & 2 deletions code/src/workloads/jobs/remove-image-background/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import { v4 as uuidv4 } from "uuid";
import fs from "node:fs";
import path from "node:path";
import { imageSize } from "image-size";
import pgBoss from "pg-boss";
import { ImagesPersistenceHandler } from "../../../images/persistence.js";
import {
Expand All @@ -20,6 +19,7 @@ import { JOB_REMOVE_IMAGE_BACKGROUND_QUEUE_NAME } from "./constants.js";
import { getLogger } from "../../../logger/logger.js";
import { saveBase64ToFile } from "../../../utils.js";
import { removeBackground } from "@imgly/background-removal-node";
import sharp from "sharp";
import { createTask, updateTask } from "../../../database/controllers/task.js";
import {
createImage,
Expand Down Expand Up @@ -254,7 +254,7 @@ export class RemoveImageBackgroundJob {
const imageBuffer = Buffer.from(image.dataBase64, "base64");

if (imageBuffer) {
const dimensions = imageSize(imageBuffer);
const dimensions = await sharp(imageBuffer).metadata();

const fileName = `${roomId}/${newImageId}`;

Expand Down
Loading