feat: add option to exclude images from export (#44)

- Add 'Include medication images' checkbox in export section
- Default: enabled (full backup with images)
- Disabled: much smaller export (~50 KB instead of several MB)
- Helpful for quick backups or when importing to another instance
This commit is contained in:
Daniel Volz
2026-01-18 09:12:12 +01:00
committed by GitHub
parent 48ae48a165
commit fb0b3df794
4 changed files with 31 additions and 13 deletions
+3 -2
View File
@@ -233,11 +233,12 @@ export async function exportRoutes(app: FastifyInstance) {
// ---------------------------------------------------------------------------
// GET /export - Export all user data
// ---------------------------------------------------------------------------
app.get<{ Querystring: { includeSensitive?: string } }>(
app.get<{ Querystring: { includeSensitive?: string; includeImages?: string } }>(
"/export",
async (request, reply) => {
const userId = await getUserId(request, reply);
const includeSensitive = request.query.includeSensitive === "true";
const includeImages = request.query.includeImages !== "false"; // Default to true
// 1. Load all medications
const meds = await db.select().from(medications).where(eq(medications.userId, userId)).orderBy(medications.id);
@@ -264,7 +265,7 @@ export async function exportRoutes(app: FastifyInstance) {
expiryDate: med.expiryDate,
notes: med.notes,
intakeRemindersEnabled: med.intakeRemindersEnabled ?? false,
image: imageToBase64(med.imageUrl),
image: includeImages ? imageToBase64(med.imageUrl) : null,
};
});