Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

refactor(backend:users): replace pdfjs-dist and @napi-rs/canvas with unpdf + text-to-svg + sharp

johaven7f0238c9c12b
diff --git a/backend/package.json b/backend/package.json
index 0e7daeaf..4a3b00fd 100755
--- a/backend/package.json
+++ b/backend/package.json
@@ -50,8 +50,8 @@
"@nestjs/platform-socket.io": "^11.0.15",
"@nestjs/schedule": "^6.0.0",
"@nestjs/websockets": "^11.0.15",
- "@resvg/resvg-js": "^2.6.2",
"@socket.io/cluster-adapter": "^0.3.0",
+ "@types/text-to-svg": "^3.1.4",
"archiver": "^7.0.1",
"bcryptjs": "^3.0.0",
"class-transformer": "^0.5.1",
@@ -71,14 +71,15 @@
"passport-http": "^0.3.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
- "pdfjs-dist": "^5.2.133",
"pino-pretty": "^13.0.0",
"qrcode-generator": "^2.0.4",
"sax": "^1.4.1",
"sharp": "^0.34.4",
"socket.io": "^4.8.1",
"tar": "^7.4.3",
+ "text-to-svg": "^3.1.5",
"time2fa": "^1.4.2",
+ "unpdf": "^1.3.2",
"yauzl": "^3.2.0"
},
"optionalDependencies": {
diff --git a/backend/src/applications/files/files.controller.spec.ts b/backend/src/applications/files/files.controller.spec.ts
index beb14efd..303d11bc 100644
--- a/backend/src/applications/files/files.controller.spec.ts
+++ b/backend/src/applications/files/files.controller.spec.ts
@@ -20,7 +20,7 @@ describe(FilesController.name, () => {
const fakeUser: any = { id: 1, login: 'john', role: 1 }
const fakeSpace: any = { id: 42, key: 'space-key', url: '/space/a', realPath: '/data/space/a', realBasePath: '/data/space' }
const fakeReq: any = { user: fakeUser, space: fakeSpace, headers: {}, method: 'GET', ip: '127.0.0.1' }
- const fakeRes: any = { header: jest.fn().mockReturnThis(), status: jest.fn().mockReturnThis(), send: jest.fn() }
+ const fakeRes: any = { header: jest.fn().mockReturnThis(), status: jest.fn().mockReturnThis(), type: jest.fn().mockReturnThis(), send: jest.fn() }
// Mocks
const filesMethodsMock = {
@@ -142,20 +142,36 @@ describe(FilesController.name, () => {
filesMethodsMock.genThumbnail.mockResolvedValue(stream)
// pass undefined to exercise controller default parameter
- const result = await filesController.genThumbnail(fakeSpace, undefined as unknown as number)
+ const result = await filesController.genThumbnail(fakeSpace, undefined as unknown as number, fakeRes)
expect(filesMethodsMock.genThumbnail).toHaveBeenCalledWith(fakeSpace, 256)
- expect(result).toBe(stream)
+ expect(fakeRes.type).toHaveBeenCalled()
+ expect(fakeRes.send).toHaveBeenCalledWith(stream)
+ expect(result).toBeUndefined()
})
it('genThumbnail() should pass provided size', async () => {
const stream = {} as any
filesMethodsMock.genThumbnail.mockResolvedValue(stream)
- const result = await filesController.genThumbnail(fakeSpace, 512)
+ const result = await filesController.genThumbnail(fakeSpace, 512, fakeRes)
expect(filesMethodsMock.genThumbnail).toHaveBeenCalledWith(fakeSpace, 512)
- expect(result).toBe(stream)
+ expect(fakeRes.type).toHaveBeenCalled()
+ expect(fakeRes.send).toHaveBeenCalledWith(stream)
+ expect(result).toBeUndefined()
+ })
+
+ it('genThumbnail() should reduce size larger than 1024', async () => {
+ const stream = {} as any
+ filesMethodsMock.genThumbnail.mockResolvedValue(stream)
+
+ const result = await filesController.genThumbnail(fakeSpace, 2048, fakeRes)
+
+ expect(filesMethodsMock.genThumbnail).toHaveBeenCalledWith(fakeSpace, 1024)
+ expect(fakeRes.type).toHaveBeenCalled()
+ expect(fakeRes.send).toHaveBeenCalledWith(stream)
+ expect(result).toBeUndefined()
})
})
diff --git a/backend/src/applications/files/files.controller.ts b/backend/src/applications/files/files.controller.ts
index d2755edc..d5ecb571 100644
--- a/backend/src/applications/files/files.controller.ts
+++ b/backend/src/applications/files/files.controller.ts
@@ -4,8 +4,26 @@
* See the LICENSE file for licensing details
*/
-import { Body, Controller, Copy, Delete, Get, Head, Logger, Move, Post, Query, Req, Res, Search, StreamableFile, UseGuards } from '@nestjs/common'
+import {
+ Body,
+ Controller,
+ Copy,
+ Delete,
+ Get,
+ Head,
+ Logger,
+ Move,
+ ParseIntPipe,
+ Post,
+ Query,
+ Req,
+ Res,
+ Search,
+ StreamableFile,
+ UseGuards
+} from '@nestjs/common'
import { FastifyReply } from 'fastify'
+import { pngMimeType } from '../../common/image'
import { SkipSpaceGuard } from '../spaces/decorators/space-skip-guard.decorator'
import { SkipSpacePermissionsCheck } from '../spaces/decorators/space-skip-permissions.decorator'
import { GetSpace } from '../spaces/decorators/space.decorator'
@@ -89,8 +107,15 @@ export class FilesController {
}
@Get(`${FILES_ROUTE.OPERATION}/${FILE_OPERATION.THUMBNAIL}/*`)
- async genThumbnail(@GetSpace() space: SpaceEnv, @Query('size') size: number = 256): Promise<StreamableFile> {
- return this.filesMethods.genThumbnail(space, size)
+ async genThumbnail(
+ @GetSpace() space: SpaceEnv,
+ @Query('size', new ParseIntPipe({ optional: true })) size = 256,
+ @Res() res: FastifyReply
+ ): Promise<StreamableFile> {
+ if (size > 1024) size = 1024
+ const thumb = await this.filesMethods.genThumbnail(space, size)
+ res.type(pngMimeType)
+ return res.send(thumb)
}
// TASKS OPERATIONS
diff --git a/backend/src/applications/files/services/files-methods.service.ts b/backend/src/applications/files/services/files-methods.service.ts
index 0f369a91..f6b86e43 100644
--- a/backend/src/applications/files/services/files-methods.service.ts
+++ b/backend/src/applications/files/services/files-methods.service.ts
@@ -7,7 +7,7 @@
import { HttpException, HttpStatus, Injectable, Logger, StreamableFile } from '@nestjs/common'
import { FastifyReply } from 'fastify'
import path from 'node:path'
-import { pngMimeType } from '../../../common/image'
+import { Readable } from 'node:stream'
import { FastifySpaceRequest } from '../../spaces/interfaces/space-request.interface'
import { SpaceEnv } from '../../spaces/models/space-env.model'
import { SpacesManager } from '../../spaces/services/spaces-manager.service'
@@ -146,10 +146,9 @@ export class FilesMethods {
}
}
- async genThumbnail(space: SpaceEnv, size: number): Promise<StreamableFile> {
+ async genThumbnail(space: SpaceEnv, size: number): Promise<Readable> {
try {
- const pngStream = await this.filesManager.generateThumbnail(space, size)
- return new StreamableFile(pngStream, { type: pngMimeType })
+ return await this.filesManager.generateThumbnail(space, size)
} catch (e) {
this.handleError(space, this.genThumbnail.name, e)
}
diff --git a/backend/src/applications/files/utils/doc-textify/adapters/pdf.ts b/backend/src/applications/files/utils/doc-textify/adapters/pdf.ts
index 8ffc4893..a2d7196a 100644
--- a/backend/src/applications/files/utils/doc-textify/adapters/pdf.ts
+++ b/backend/src/applications/files/utils/doc-textify/adapters/pdf.ts
@@ -3,17 +3,17 @@
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/
-import path from 'node:path'
-import { getDocument, GlobalWorkerOptions, PDFDocumentProxy, VerbosityLevel } from 'pdfjs-dist/legacy/build/pdf.mjs'
-import { DocTextifyOptions } from '../interfaces/doc-textify.interfaces'
-
-// Enable parallel PDF parsing via Node.js worker threads
-GlobalWorkerOptions.workerSrc = require.resolve('pdfjs-dist/legacy/build/pdf.worker.mjs')
-const pdfjsDistDir = path.dirname(require.resolve('pdfjs-dist/package.json'))
-const standardFontsDir = path.join(pdfjsDistDir, 'standard_fonts') + '/'
+import { readFile } from 'node:fs/promises'
+import { getDocumentProxy } from 'unpdf'
+import type { PDFDocumentProxy } from 'unpdf/pdfjs'
+import type { DocTextifyOptions } from '../interfaces/doc-textify.interfaces'
// Type guard to filter true text items
-function isTextItem(item: any): item is { str: string; transform: [number, number, number, number, number, number] } {
+interface TextItem {
+ str: string
+ transform: [number, number, number, number, number, number]
+}
+function isTextItem(item: any): item is TextItem {
return typeof item.str === 'string' && Array.isArray(item.transform)
}
@@ -22,11 +22,14 @@ const ignorePdfBadFormat = new Set([0x0000, 0x0001])
/** Parse PDF files */
export async function parsePdf(filePath: string, options: DocTextifyOptions): Promise<string> {
let doc: PDFDocumentProxy
+ const buffer = await readFile(filePath)
try {
// Load the document, allowing system fonts as fallback
- const loadingTask = getDocument({ url: filePath, disableFontFace: true, standardFontDataUrl: standardFontsDir, verbosity: VerbosityLevel.ERRORS })
- doc = await loadingTask.promise
+ const doc = await getDocumentProxy(new Uint8Array(buffer), {
+ disableFontFace: true,
+ verbosity: 0
+ })
const fragments: string[] = []
let lastY: number | undefined = undefined
diff --git a/backend/src/applications/users/services/users-manager.service.ts b/backend/src/applications/users/services/users-manager.service.ts
index a8fb0cfa..2194c414 100755
--- a/backend/src/applications/users/services/users-manager.service.ts
+++ b/backend/src/applications/users/services/users-manager.service.ts
@@ -10,7 +10,6 @@ import bcrypt from 'bcryptjs'
import { WriteStream } from 'fs'
import { createWriteStream } from 'node:fs'
import path from 'node:path'
-import { Readable } from 'node:stream'
import { pipeline } from 'node:stream/promises'
import { AUTH_SCOPE } from '../../../authentication/constants/scope'
import { LoginResponseDto } from '../../../authentication/dto/login-response.dto'
@@ -217,7 +216,7 @@ export class UsersManager {
throw new HttpException(`avatar not found`, HttpStatus.NOT_FOUND)
}
const avatarFile: WriteStream = createWriteStream(avatarPath)
- const avatarStream = Readable.from(await generateAvatar(user.getInitials()))
+ const avatarStream: NodeJS.ReadableStream = await generateAvatar(user.getInitials())
try {
await pipeline(avatarStream, avatarFile)
} catch (e) {
diff --git a/backend/src/common/image.ts b/backend/src/common/image.ts
index fd311d30..eb2acc9d 100644
--- a/backend/src/common/image.ts
+++ b/backend/src/common/image.ts
@@ -4,76 +4,66 @@
* See the LICENSE file for licensing details
*/
-import { Resvg } from '@resvg/resvg-js'
import fs from 'node:fs/promises'
+import os from 'node:os'
import path from 'node:path'
import { Readable } from 'node:stream'
+import { promisify } from 'node:util'
import sharp from 'sharp'
+import TextToSVG from 'text-to-svg' // Sharp settings
+// Sharp settings
+sharp.cache(false)
+sharp.concurrency(Math.min(2, os.cpus()?.length || 1))
+
+// Constants
export const pngMimeType = 'image/png'
export const svgMimeType = 'image/svg+xml'
-sharp.cache(false)
+const avatarSize = 256
+const fontPath = path.join(__dirname, 'fonts', 'avatar.ttf')
+const loadTextToSVG = promisify(TextToSVG.load.bind(TextToSVG))
+let textToSvgCache: Promise<TextToSVG> | null = null
export async function generateThumbnail(filePath: string, size: number): Promise<Readable> {
- const image = sharp(filePath, { autoOrient: true })
- let { width, height } = await image.metadata()
-
- if (!width || !height) throw new Error('Invalid image dimensions')
-
- // Calculate the new dimensions, maintaining the aspect ratio
- if (width > height) {
- if (width > size) {
- height = Math.round((height * size) / width)
- width = size
- }
- } else {
- if (height > size) {
- width = Math.round((width * size) / height)
- height = size
- }
- }
-
- return image.resize(width, height, { fit: 'inside' }).png({ compressionLevel: 0 })
+ return sharp(filePath, {
+ sequentialRead: true, // sequential read = more efficient I/O
+ limitInputPixels: 268e6 // protects against extremely large images
+ })
+ .rotate()
+ .resize({
+ width: size,
+ height: size,
+ fit: 'inside',
+ kernel: 'lanczos3',
+ withoutEnlargement: true,
+ fastShrinkOnLoad: true // true by default, added for clarity
+ })
+ .png({
+ compressionLevel: 1,
+ palette: true
+ })
}
-export async function generateAvatar(initials: string): Promise<Buffer> {
- const width = 256
- const height = 256
+export async function generateAvatar(initials: string): Promise<NodeJS.ReadableStream> {
+ const tts = await getTextToSvg()
const { backgroundColor, foregroundColor } = randomColor()
+ const fontSize = fitFontSize(tts, initials, avatarSize * 0.8, 170)
- const fontPath = path.join(__dirname, 'fonts', 'avatar.ttf')
- const fontBase64 = (await fs.readFile(fontPath)).toString('base64')
+ const d = tts.getD(initials, {
+ x: avatarSize / 2,
+ y: avatarSize / 2.1,
+ fontSize,
+ anchor: 'center middle'
+ })
const svg = `
- <svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
- <style>
- @font-face {
- font-family: 'Avatar';
- src: url('data:font/ttf;base64,${fontBase64}') format('truetype');
- }
- text {
- font-family: 'Avatar', sans-serif;
- font-size: 150px;
- fill: ${foregroundColor};
- dominant-baseline: central;
- text-anchor: middle;
- }
- </style>
- <rect width="100%" height="100%" fill="${backgroundColor}" />
- <text x="50%" y="50%">${initials}</text>
- </svg>
- `
-
- // Rasterize SVG to PNG
- const resvg = new Resvg(svg, {
- fitTo: { mode: 'width', value: width },
- font: {
- fontFiles: [fontPath],
- loadSystemFonts: false
- }
- })
+<svg width="${avatarSize}" height="${avatarSize}" viewBox="0 0 ${avatarSize} ${avatarSize}"
+ xmlns="http://www.w3.org/2000/svg">
+ <rect width="100%" height="100%" fill="${backgroundColor}"/>
+ <path d="${d}" fill="${foregroundColor}" />
+</svg>`.trim()
- return resvg.render().asPng()
+ return sharp(Buffer.from(svg, 'utf8')).png()
}
export async function convertImageToBase64(imgPath: string) {
@@ -100,3 +90,19 @@ function randomColor() {
foregroundColor: brightness > 180 ? '#000000' : '#ffffff'
}
}
+
+function fitFontSize(tts: TextToSVG, text: string, box: number, start = 170): number {
+ // Heuristic to make the text occupy ~80% of the available width
+ let size = start
+ // Lower bound to prevent infinite loops when the font renders very small
+ while (size > 20) {
+ const m = tts.getMetrics(text, { fontSize: size, anchor: 'center middle' })
+ if (m.width <= box) break
+ size -= 4
+ }
+ return size
+}
+
+function getTextToSvg(): Promise<TextToSVG> {
+ return (textToSvgCache ??= loadTextToSVG(fontPath) as Promise<TextToSVG>)
+}
diff --git a/package-lock.json b/package-lock.json
index d677b514..53c96dde 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -36,6 +36,7 @@
"devDependencies": {
"commit-and-tag-version": "^12.5.1",
"husky": "^9.1.7",
+ "noop3": "^1000.0.0",
"prettier": "^3.4.1"
},
"engines": {
@@ -63,8 +64,8 @@
"@nestjs/platform-socket.io": "^11.0.15",
"@nestjs/schedule": "^6.0.0",
"@nestjs/websockets": "^11.0.15",
- "@resvg/resvg-js": "^2.6.2",
"@socket.io/cluster-adapter": "^0.3.0",
+ "@types/text-to-svg": "^3.1.4",
"archiver": "^7.0.1",
"bcryptjs": "^3.0.0",
"class-transformer": "^0.5.1",
@@ -84,14 +85,15 @@
"passport-http": "^0.3.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
- "pdfjs-dist": "^5.2.133",
"pino-pretty": "^13.0.0",
"qrcode-generator": "^2.0.4",
"sax": "^1.4.1",
"sharp": "^0.34.4",
"socket.io": "^4.8.1",
"tar": "^7.4.3",
+ "text-to-svg": "^3.1.5",
"time2fa": "^1.4.2",
+ "unpdf": "^1.3.2",
"yauzl": "^3.2.0"
},
"devDependencies": {
@@ -7878,191 +7880,6 @@
"win32"
]
},
- "node_modules/@napi-rs/canvas": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas/-/canvas-0.1.77.tgz",
- "integrity": "sha512-N9w2DkEKE1AXGp3q55GBOP6BEoFrqChDiFqJtKViTpQCWNOSVuMz7LkoGehbnpxtidppbsC36P0kCZNqJKs29w==",
- "license": "MIT",
- "optional": true,
- "workspaces": [
- "e2e/*"
- ],
- "engines": {
- "node": ">= 10"
- },
- "optionalDependencies": {
- "@napi-rs/canvas-android-arm64": "0.1.77",
- "@napi-rs/canvas-darwin-arm64": "0.1.77",
- "@napi-rs/canvas-darwin-x64": "0.1.77",
- "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.77",
- "@napi-rs/canvas-linux-arm64-gnu": "0.1.77",
- "@napi-rs/canvas-linux-arm64-musl": "0.1.77",
- "@napi-rs/canvas-linux-riscv64-gnu": "0.1.77",
- "@napi-rs/canvas-linux-x64-gnu": "0.1.77",
- "@napi-rs/canvas-linux-x64-musl": "0.1.77",
- "@napi-rs/canvas-win32-x64-msvc": "0.1.77"
- }
- },
- "node_modules/@napi-rs/canvas-android-arm64": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-android-arm64/-/canvas-android-arm64-0.1.77.tgz",
- "integrity": "sha512-jC8YX0rbAnu9YrLK1A52KM2HX9EDjrJSCLVuBf9Dsov4IC6GgwMLS2pwL9GFLJnSZBFgdwnA84efBehHT9eshA==",
- "cpu": [
- "arm64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@napi-rs/canvas-darwin-arm64": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-arm64/-/canvas-darwin-arm64-0.1.77.tgz",
- "integrity": "sha512-VFaCaCgAV0+hPwXajDIiHaaGx4fVCuUVYp/CxCGXmTGz699ngIEBx3Sa2oDp0uk3X+6RCRLueb7vD44BKBiPIg==",
- "cpu": [
- "arm64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@napi-rs/canvas-darwin-x64": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-x64/-/canvas-darwin-x64-0.1.77.tgz",
- "integrity": "sha512-uD2NSkf6I4S3o0POJDwweK85FE4rfLNA2N714MgiEEMMw5AmupfSJGgpYzcyEXtPzdaca6rBfKcqNvzR1+EyLQ==",
- "cpu": [
- "x64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@napi-rs/canvas-linux-arm-gnueabihf": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm-gnueabihf/-/canvas-linux-arm-gnueabihf-0.1.77.tgz",
- "integrity": "sha512-03GxMMZGhHRQxiA4gyoKT6iQSz8xnA6T9PAfg/WNJnbkVMFZG782DwUJUb39QIZ1uE1euMCPnDgWAJ092MmgJQ==",
- "cpu": [
- "arm"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@napi-rs/canvas-linux-arm64-gnu": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-gnu/-/canvas-linux-arm64-gnu-0.1.77.tgz",
- "integrity": "sha512-ZO+d2gRU9JU1Bb7SgJcJ1k9wtRMCpSWjJAJ+2phhu0Lw5As8jYXXXmLKmMTGs1bOya2dBMYDLzwp7KS/S/+aCA==",
- "cpu": [
- "arm64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@napi-rs/canvas-linux-arm64-musl": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-musl/-/canvas-linux-arm64-musl-0.1.77.tgz",
- "integrity": "sha512-S1KtnP1+nWs2RApzNkdNf8X4trTLrHaY7FivV61ZRaL8NvuGOkSkKa+gWN2iedIGFEDz6gecpl/JAUSewwFXYg==",
- "cpu": [
- "arm64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@napi-rs/canvas-linux-riscv64-gnu": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-riscv64-gnu/-/canvas-linux-riscv64-gnu-0.1.77.tgz",
- "integrity": "sha512-A4YIKFYUwDtrSzCtdCAO5DYmRqlhCVKHdpq0+dBGPnIEhOQDFkPBTfoTAjO3pjlEnorlfKmNMOH21sKQg2esGA==",
- "cpu": [
- "riscv64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@napi-rs/canvas-linux-x64-gnu": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-gnu/-/canvas-linux-x64-gnu-0.1.77.tgz",
- "integrity": "sha512-Lt6Sef5l0+5O1cSZ8ysO0JI+x+rSrqZyXs5f7+kVkCAOVq8X5WTcDVbvWvEs2aRhrWTp5y25Jf2Bn+3IcNHOuQ==",
- "cpu": [
- "x64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@napi-rs/canvas-linux-x64-musl": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-musl/-/canvas-linux-x64-musl-0.1.77.tgz",
- "integrity": "sha512-NiNFvC+D+omVeJ3IjYlIbyt/igONSABVe9z0ZZph29epHgZYu4eHwV9osfpRt1BGGOAM8LkFrHk4LBdn2EDymA==",
- "cpu": [
- "x64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@napi-rs/canvas-win32-x64-msvc": {
- "version": "0.1.77",
- "resolved": "https://registry.npmjs.org/@napi-rs/canvas-win32-x64-msvc/-/canvas-win32-x64-msvc-0.1.77.tgz",
- "integrity": "sha512-fP6l0hZiWykyjvpZTS3sI46iib8QEflbPakNoUijtwyxRuOPTTBfzAWZUz5z2vKpJJ/8r305wnZeZ8lhsBHY5A==",
- "cpu": [
- "x64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
"node_modules/@napi-rs/nice": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@napi-rs/nice/-/nice-1.1.1.tgz",
@@ -9781,221 +9598,6 @@
"@redis/client": "^5.9.0"
}
},
- "node_modules/@resvg/resvg-js": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js/-/resvg-js-2.6.2.tgz",
- "integrity": "sha512-xBaJish5OeGmniDj9cW5PRa/PtmuVU3ziqrbr5xJj901ZDN4TosrVaNZpEiLZAxdfnhAe7uQ7QFWfjPe9d9K2Q==",
- "license": "MPL-2.0",
- "engines": {
- "node": ">= 10"
- },
- "optionalDependencies": {
- "@resvg/resvg-js-android-arm-eabi": "2.6.2",
- "@resvg/resvg-js-android-arm64": "2.6.2",
- "@resvg/resvg-js-darwin-arm64": "2.6.2",
- "@resvg/resvg-js-darwin-x64": "2.6.2",
- "@resvg/resvg-js-linux-arm-gnueabihf": "2.6.2",
- "@resvg/resvg-js-linux-arm64-gnu": "2.6.2",
- "@resvg/resvg-js-linux-arm64-musl": "2.6.2",
- "@resvg/resvg-js-linux-x64-gnu": "2.6.2",
- "@resvg/resvg-js-linux-x64-musl": "2.6.2",
- "@resvg/resvg-js-win32-arm64-msvc": "2.6.2",
- "@resvg/resvg-js-win32-ia32-msvc": "2.6.2",
- "@resvg/resvg-js-win32-x64-msvc": "2.6.2"
- }
- },
- "node_modules/@resvg/resvg-js-android-arm-eabi": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-android-arm-eabi/-/resvg-js-android-arm-eabi-2.6.2.tgz",
- "integrity": "sha512-FrJibrAk6v29eabIPgcTUMPXiEz8ssrAk7TXxsiZzww9UTQ1Z5KAbFJs+Z0Ez+VZTYgnE5IQJqBcoSiMebtPHA==",
- "cpu": [
- "arm"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-android-arm64": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-android-arm64/-/resvg-js-android-arm64-2.6.2.tgz",
- "integrity": "sha512-VcOKezEhm2VqzXpcIJoITuvUS/fcjIw5NA/w3tjzWyzmvoCdd+QXIqy3FBGulWdClvp4g+IfUemigrkLThSjAQ==",
- "cpu": [
- "arm64"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-darwin-arm64": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-darwin-arm64/-/resvg-js-darwin-arm64-2.6.2.tgz",
- "integrity": "sha512-nmok2LnAd6nLUKI16aEB9ydMC6Lidiiq2m1nEBDR1LaaP7FGs4AJ90qDraxX+CWlVuRlvNjyYJTNv8qFjtL9+A==",
- "cpu": [
- "arm64"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-darwin-x64": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-darwin-x64/-/resvg-js-darwin-x64-2.6.2.tgz",
- "integrity": "sha512-GInyZLjgWDfsVT6+SHxQVRwNzV0AuA1uqGsOAW+0th56J7Nh6bHHKXHBWzUrihxMetcFDmQMAX1tZ1fZDYSRsw==",
- "cpu": [
- "x64"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-linux-arm-gnueabihf": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-linux-arm-gnueabihf/-/resvg-js-linux-arm-gnueabihf-2.6.2.tgz",
- "integrity": "sha512-YIV3u/R9zJbpqTTNwTZM5/ocWetDKGsro0SWp70eGEM9eV2MerWyBRZnQIgzU3YBnSBQ1RcxRZvY/UxwESfZIw==",
- "cpu": [
- "arm"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-linux-arm64-gnu": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-linux-arm64-gnu/-/resvg-js-linux-arm64-gnu-2.6.2.tgz",
- "integrity": "sha512-zc2BlJSim7YR4FZDQ8OUoJg5holYzdiYMeobb9pJuGDidGL9KZUv7SbiD4E8oZogtYY42UZEap7dqkkYuA91pg==",
- "cpu": [
- "arm64"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-linux-arm64-musl": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-linux-arm64-musl/-/resvg-js-linux-arm64-musl-2.6.2.tgz",
- "integrity": "sha512-3h3dLPWNgSsD4lQBJPb4f+kvdOSJHa5PjTYVsWHxLUzH4IFTJUAnmuWpw4KqyQ3NA5QCyhw4TWgxk3jRkQxEKg==",
- "cpu": [
- "arm64"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-linux-x64-gnu": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-linux-x64-gnu/-/resvg-js-linux-x64-gnu-2.6.2.tgz",
- "integrity": "sha512-IVUe+ckIerA7xMZ50duAZzwf1U7khQe2E0QpUxu5MBJNao5RqC0zwV/Zm965vw6D3gGFUl7j4m+oJjubBVoftw==",
- "cpu": [
- "x64"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-linux-x64-musl": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-linux-x64-musl/-/resvg-js-linux-x64-musl-2.6.2.tgz",
- "integrity": "sha512-UOf83vqTzoYQO9SZ0fPl2ZIFtNIz/Rr/y+7X8XRX1ZnBYsQ/tTb+cj9TE+KHOdmlTFBxhYzVkP2lRByCzqi4jQ==",
- "cpu": [
- "x64"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-win32-arm64-msvc": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-win32-arm64-msvc/-/resvg-js-win32-arm64-msvc-2.6.2.tgz",
- "integrity": "sha512-7C/RSgCa+7vqZ7qAbItfiaAWhyRSoD4l4BQAbVDqRRsRgY+S+hgS3in0Rxr7IorKUpGE69X48q6/nOAuTJQxeQ==",
- "cpu": [
- "arm64"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-win32-ia32-msvc": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-win32-ia32-msvc/-/resvg-js-win32-ia32-msvc-2.6.2.tgz",
- "integrity": "sha512-har4aPAlvjnLcil40AC77YDIk6loMawuJwFINEM7n0pZviwMkMvjb2W5ZirsNOZY4aDbo5tLx0wNMREp5Brk+w==",
- "cpu": [
- "ia32"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@resvg/resvg-js-win32-x64-msvc": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/@resvg/resvg-js-win32-x64-msvc/-/resvg-js-win32-x64-msvc-2.6.2.tgz",
- "integrity": "sha512-ZXtYhtUr5SSaBrUDq7DiyjOFJqBVL/dOBN7N/qmi/pO0IgiWW/f/ue3nbvu9joWE5aAKDoIzy/CxsY0suwGosQ==",
- "cpu": [
- "x64"
- ],
- "license": "MPL-2.0",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
"node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.52.3",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.52.3.tgz",
@@ -12260,6 +11862,12 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/opentype.js": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/@types/opentype.js/-/opentype.js-1.3.8.tgz",
+ "integrity": "sha512-H6qeTp03jrknklSn4bpT1/9+1xCAEIU2CnjcWPkicJy8A1SKuthanbvoHYMiv79/2W3Xn1XE4gfSJFzt2U3JSw==",
+ "license": "MIT"
+ },
"node_modules/@types/passport": {
"version": "1.0.17",
"resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.17.tgz",
@@ -12454,6 +12062,15 @@
"@types/estree": "*"
}
},
+ "node_modules/@types/text-to-svg": {
+ "version": "3.1.4",
+ "resolved": "https://registry.npmjs.org/@types/text-to-svg/-/text-to-svg-3.1.4.tgz",
+ "integrity": "sha512-nupWR3fOC2CaakVDvnEuiNpcg+XZD8ez7yJf7HCcpR1JKqPKxnUqeFH8er9txouyCbsdwXjhKKpMPtnpQZYCsQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/opentype.js": "*"
+ }
+ },
"node_modules/@types/validator": {
"version": "13.15.3",
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.15.3.tgz",
@@ -24540,6 +24157,16 @@
"node": ">=6.0.0"
}
},
+ "node_modules/noop3": {
+ "version": "1000.0.0",
+ "resolved": "https://registry.npmjs.org/noop3/-/noop3-1000.0.0.tgz",
+ "integrity": "sha512-OkcS5jjmDBhdLt5rwoHtItQfUHP3+NpWA9voB0SHth+KLIoupZEe+3D76bNvS37qG8vg2FFSqQ61blrEtZj1Yw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/nopt": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-8.1.0.tgz",
@@ -24929,6 +24556,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/opentype.js": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/opentype.js/-/opentype.js-0.11.0.tgz",
+ "integrity": "sha512-Z9NkAyQi/iEKQYzCSa7/VJSqVIs33wknw8Z8po+DzuRUAqivJ+hJZ94mveg3xIeKwLreJdWTMyEO7x1K13l41Q==",
+ "license": "MIT",
+ "dependencies": {
+ "string.prototype.codepointat": "^0.2.1",
+ "tiny-inflate": "^1.0.2"
+ },
+ "bin": {
+ "ot": "bin/ot"
+ }
+ },
"node_modules/optionator": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
@@ -25646,6 +25286,7 @@
"version": "5.4.296",
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-5.4.296.tgz",
"integrity": "sha512-DlOzet0HO7OEnmUmB6wWGJrrdvbyJKftI1bhMitK7O2N8W2gc757yyYBbINy9IDafXAV9wmKr9t7xsTaNKRG5Q==",
+ "dev": true,
"license": "Apache-2.0",
"engines": {
"node": ">=20.16.0 || >=22.3.0"
@@ -28034,6 +27675,12 @@
"node": ">=8"
}
},
+ "node_modules/string.prototype.codepointat": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/string.prototype.codepointat/-/string.prototype.codepointat-0.2.1.tgz",
+ "integrity": "sha512-2cBVCj6I4IOvEnjgO/hWqXjqBGsY+zwPmHl12Srk9IXSZ56Jwwmy+66XO5Iut/oQVR7t5ihYdLB0GMa4alEUcg==",
+ "license": "MIT"
+ },
"node_modules/stringify-object": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz",
@@ -28572,6 +28219,25 @@
"node": ">=0.10"
}
},
+ "node_modules/text-to-svg": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/text-to-svg/-/text-to-svg-3.1.5.tgz",
+ "integrity": "sha512-mbeGhMz9MAFaGaZGE8n4Mh/iQV/UkVnYJXhXFrv0eWkcNTgflhpHR2a8nr2ci3NU4FekIHJYKh0N0qdc6yUpfA==",
+ "license": "MIT",
+ "dependencies": {
+ "commander": "^2.11.0",
+ "opentype.js": "0.11.0"
+ },
+ "bin": {
+ "text-to-svg": "bin/text-to-svg"
+ }
+ },
+ "node_modules/text-to-svg/node_modules/commander": {
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+ "license": "MIT"
+ },
"node_modules/thread-stream": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.1.0.tgz",
@@ -28638,6 +28304,12 @@
"integrity": "sha512-badZQkQpCi8eZWN02HTjoBBg+leBmwiLWFQtweklEhY8+JEGXSgd2Xy6nGBtPi+7HigSczclYTljAEJA4Z9D4g==",
"license": "MIT"
},
+ "node_modules/tiny-inflate": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",
+ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==",
+ "license": "MIT"
+ },
"node_modules/tinyglobby": {
"version": "0.2.15",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
@@ -29396,6 +29068,20 @@
"node": ">= 10.0.0"
}
},
+ "node_modules/unpdf": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/unpdf/-/unpdf-1.3.2.tgz",
+ "integrity": "sha512-TWh+7yNL4K9Rn3sjTTMjHhBNxXsrtvIw/nEdYWzLyJU9SZ33s2BhoCSNRG+aUhm/KkdMO6/WK8U6NqRw7fSF4A==",
+ "license": "MIT",
+ "peerDependencies": {
+ "@napi-rs/canvas": "^0.1.69"
+ },
+ "peerDependenciesMeta": {
+ "@napi-rs/canvas": {
+ "optional": true
+ }
+ }
+ },
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
diff --git a/package.json b/package.json
index be378b38..eb113349 100755
--- a/package.json
+++ b/package.json
@@ -88,10 +88,11 @@
"devDependencies": {
"commit-and-tag-version": "^12.5.1",
"husky": "^9.1.7",
+ "noop3": "^1000.0.0",
"prettier": "^3.4.1"
},
"overrides": {
- "@napi-rs/canvas": "0.1.77"
+ "@napi-rs/canvas": "npm:noop3"
},
"commit-and-tag-version": {
"header": ""