Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

add new feature flag FLAG_DISABLE_IMAGE_PROCESSING

Amruth Pillai87e2f2f39166
diff --git a/.env.example b/.env.example
index 3d534f4f0..cdf7496fa 100644
--- a/.env.example
+++ b/.env.example
@@ -66,6 +66,10 @@ FLAG_DISABLE_SIGNUPS="false"
# This flag disables email/password login. Disables email verification, forgot password, and reset password flows. Users can still sign up via social auth (Google/GitHub/Custom OAuth), unless FLAG_DISABLE_SIGNUPS is also set to true.
FLAG_DISABLE_EMAIL_AUTH="false"
+# This flag disables the image processing.
+# This is useful if you are using a machine with limited resources, like a Raspberry Pi.
+FLAG_DISABLE_IMAGE_PROCESSING="false"
+
# --- Others ---
# Google Cloud API Key (optional)
# This is not used within Reactive Resume, but in src/scripts/fonts/generate.ts to generate a list of fonts served by Google Fonts.
diff --git a/CLAUDE.md b/CLAUDE.md
index 0f557d06c..703be8988 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -178,6 +178,7 @@ Key variables (see `.env.example` for full list):
- `FLAG_DEBUG_PRINTER` - Debug PDF printing endpoint
- `FLAG_DISABLE_SIGNUPS` - Block new account registration
- `FLAG_DISABLE_EMAIL_AUTH` - Disable email/password login
+- `FLAG_DISABLE_IMAGE_PROCESSING` - Disable image processing
## Build & Deployment
diff --git a/compose.dev.yml b/compose.dev.yml
index c99b3900e..56d1bb91a 100644
--- a/compose.dev.yml
+++ b/compose.dev.yml
@@ -53,11 +53,11 @@ services:
# As an alternative to browserless, you can also use a lightweight image like chromedp/headless-shell:latest
# See https://docs.rxresu.me/self-hosting/docker#alternative-printer-options for more information.
- # chrome:
- # image: chromedp/headless-shell:latest
- # restart: unless-stopped
- # ports:
- # - "9222:9222"
+ chrome:
+ image: chromedp/headless-shell:latest
+ restart: unless-stopped
+ ports:
+ - "9222:9222"
seaweedfs:
image: chrislusf/seaweedfs:latest
diff --git a/docs/getting-started/quickstart.mdx b/docs/getting-started/quickstart.mdx
index e667c1f5c..8d1707a6c 100644
--- a/docs/getting-started/quickstart.mdx
+++ b/docs/getting-started/quickstart.mdx
@@ -193,6 +193,7 @@ Here's a complete list of environment variables you can configure:
| `FLAG_DEBUG_PRINTER` | Used for debugging the printer route | `false` |
| `FLAG_DISABLE_SIGNUPS` | Disables new user signups | `false` |
| `FLAG_DISABLE_EMAIL_AUTH` | Disables email/password login (SSO only) | `false` |
+| `FLAG_DISABLE_IMAGE_PROCESSING` | Disables image processing | `false` |
> **Note:** Some variables are only required for using related features (OAuth, SMTP, S3, etc.) and can be left unset if unused.
diff --git a/docs/self-hosting/docker.mdx b/docs/self-hosting/docker.mdx
index effa858ea..acdb513ee 100644
--- a/docs/self-hosting/docker.mdx
+++ b/docs/self-hosting/docker.mdx
@@ -363,6 +363,7 @@ openssl rand -hex 32
- **`FLAG_DEBUG_PRINTER`**: Bypasses the printer-only access restriction (useful when debugging `/printer/{resumeId}`). Recommended: keep `"false"` in production.
- **`FLAG_DISABLE_SIGNUPS`**: Disables new signups (web app and server). Useful for private instances.
- **`FLAG_DISABLE_EMAIL_AUTH`**: Disables email/password login entirely. Also disables email verification, forgot password, and reset password flows. Users can still sign up via social auth (Google/GitHub/Custom OAuth), unless FLAG_DISABLE_SIGNUPS is also set to true. Useful when only SSO is required.
+ - **`FLAG_DISABLE_IMAGE_PROCESSING`**: Disables image processing. This is useful if you are using a machine with limited resources, like a Raspberry Pi.
</Accordion>
</AccordionGroup>
diff --git a/src/integrations/orpc/router/storage.ts b/src/integrations/orpc/router/storage.ts
index 532cd50ab..55454d5cc 100644
--- a/src/integrations/orpc/router/storage.ts
+++ b/src/integrations/orpc/router/storage.ts
@@ -78,7 +78,7 @@ export const storageRouter = {
},
})
.handler(async ({ context, input }): Promise<void> => {
- // The filename is now the full path from the URL (e.g., "uploads/userId/pictures/timestamp.webp")
+ // The filename is now the full path from the URL (e.g., "uploads/userId/pictures/timestamp.ext")
// We need to extract just the path portion that matches the storage key
const key = input.filename.startsWith("uploads/")
? input.filename
diff --git a/src/integrations/orpc/services/storage.ts b/src/integrations/orpc/services/storage.ts
index a942b444c..82d57b2b7 100644
--- a/src/integrations/orpc/services/storage.ts
+++ b/src/integrations/orpc/services/storage.ts
@@ -7,7 +7,6 @@ import {
PutObjectCommand,
S3Client,
} from "@aws-sdk/client-s3";
-import sharp from "sharp";
import { env } from "@/utils/env";
interface StorageWriteInput {
@@ -90,6 +89,16 @@ interface ProcessedImage {
export async function processImageForUpload(file: File): Promise<ProcessedImage> {
const fileBuffer = await file.arrayBuffer();
+ console.log("FLAG_DISABLE_IMAGE_PROCESSING", env.FLAG_DISABLE_IMAGE_PROCESSING);
+ if (env.FLAG_DISABLE_IMAGE_PROCESSING) {
+ return {
+ data: new Uint8Array(fileBuffer),
+ contentType: file.type,
+ };
+ }
+
+ const sharp = (await import("sharp")).default;
+
const processedBuffer = await sharp(fileBuffer)
.resize(800, 800, { fit: "inside", withoutEnlargement: true })
.webp({ preset: "picture" })
diff --git a/src/utils/env.ts b/src/utils/env.ts
index de8c7a44d..680ca03e3 100644
--- a/src/utils/env.ts
+++ b/src/utils/env.ts
@@ -67,5 +67,6 @@ export const env = createEnv({
FLAG_DEBUG_PRINTER: z.stringbool().default(false),
FLAG_DISABLE_SIGNUPS: z.stringbool().default(false),
FLAG_DISABLE_EMAIL_AUTH: z.stringbool().default(false),
+ FLAG_DISABLE_IMAGE_PROCESSING: z.stringbool().default(false),
},
});
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index eb429abc2..3e1f294dc 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -52,5 +52,6 @@ declare namespace NodeJS {
FLAG_DEBUG_PRINTER: string | boolean;
FLAG_DISABLE_SIGNUPS: string | boolean;
FLAG_DISABLE_EMAIL_AUTH: string | boolean;
+ FLAG_DISABLE_IMAGE_PROCESSING: string | boolean;
}
}