add new feature flag FLAG_DISABLE_IMAGE_PROCESSING

This commit is contained in:
Amruth Pillai
2026-02-10 18:33:07 +01:00
parent f237c42093
commit 87e2f2f391
9 changed files with 25 additions and 7 deletions
+4
View File
@@ -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.
+1
View File
@@ -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
+5 -5
View File
@@ -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
+1
View File
@@ -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.
+1
View File
@@ -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>
+1 -1
View File
@@ -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
+10 -1
View File
@@ -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" })
+1
View File
@@ -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),
},
});
+1
View File
@@ -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;
}
}