Commit Graph

27 Commits

Author SHA1 Message Date
f3b92e8b1a refactor: clean up recipe routes and reduce bundle size
- Eliminate duplicate API fetch in recipe page by passing item from
  server load to universal load instead of fetching twice
- Replace cheerio with simple regex in stripHtmlTags, removing ~200KB
  dependency
- Refactor multiplier buttons in IngredientsPage to use loop instead
  of 5 repeated form elements
- Move /rezepte/untranslated to /[recipeLang]/admin/untranslated and
  delete legacy /rezepte/ layout files
2026-01-23 15:04:58 +01:00
5598b19ec9 perf: optimize bundle size and add build optimizations
All checks were successful
CI / update (push) Successful in 1m23s
- Move HTML stripping to server-side to remove cheerio from client bundle (247KB reduction)
- Add terser minification with console/debugger removal
- Enable manual code chunking for chart.js and auth libraries
- Convert TTF fonts to WOFF2 format (~900KB savings)
- Enable brotli/gzip precompression in adapter
- Update CSS to prefer WOFF2 with TTF fallback
2026-01-19 21:46:10 +01:00
0a49e20c02 refactor: migrate recipe forms to SvelteKit actions with secure image upload
Refactor recipe add/edit routes from client-side fetch to proper SvelteKit
form actions with progressive enhancement and comprehensive security improvements.

**Security Enhancements:**
- Implement 5-layer image validation (file size, MIME type, extension, magic bytes, Sharp structure)
- Replace insecure base64 JSON encoding with FormData for file uploads
- Add file-type@19 dependency for magic bytes validation
- Validate actual file type via magic bytes to prevent file type spoofing

**Progressive Enhancement:**
- Forms now work without JavaScript using native browser submission
- Add use:enhance for improved client-side UX when JS is available
- Serialize complex nested data (ingredients/instructions) via JSON in hidden fields
- Translation workflow integrated via programmatic form submission

**Bug Fixes:**
- Add type="button" to all interactive buttons in CreateIngredientList and CreateStepList
  to prevent premature form submission when clicking on ingredients/steps
- Fix SSR errors by using season_local state instead of get_season() DOM query
- Fix redirect handling in form actions (redirects were being caught as errors)
- Fix TranslationApproval to handle recipes without images using null-safe checks
- Add reactive effect to sync editableEnglish.images with germanData.images length
- Detect and hide 150x150 placeholder images in CardAdd component

**Features:**
- Make image uploads optional for recipe creation (use placeholder based on short_name)
- Handle three image scenarios in edit: keep existing, upload new, rename on short_name change
- Automatic image file renaming across full/thumb/placeholder directories when short_name changes
- Change detection for partial translation updates in edit mode

**Technical Changes:**
- Create imageValidation.ts utility with comprehensive file validation
- Create recipeFormHelpers.ts for data extraction, validation, and serialization
- Refactor /api/rezepte/img/add endpoint to use FormData instead of base64
- Update CardAdd component to upload via FormData immediately with proper error handling
- Use Image API for placeholder detection (avoids CORS issues with fetch)
2026-01-13 15:12:07 +01:00
a822ea738c chore: update @auth/sveltekit to v1.11.1 and remove direct @auth/core dependency
Updated authentication packages to latest versions for security fixes:
- @auth/sveltekit: 1.10.0 → 1.11.1 (includes nodemailer security fix)
- @auth/core: removed from devDependencies (transitively pulled as 0.41.1)

Changed imports to use @auth/sveltekit/providers instead of @auth/core/providers
and removed unused imports from hooks.server.ts.
2026-01-10 17:49:51 +01:00
1628f8ba23 feat: add Redis caching for recipe queries with automatic invalidation
All checks were successful
CI / update (push) Successful in 13s
Implements Redis caching layer for recipe endpoints to reduce MongoDB load and improve response times:

- Install ioredis for Redis client with TypeScript support
- Create cache.ts with namespaced keys (homepage: prefix) to avoid conflicts with other Redis applications
- Add caching to recipe query endpoints (all_brief, by tag, in_season) with 1-hour TTL
- Implement automatic cache invalidation on recipe create/edit/delete operations
- Cache recipes before randomization to maximize cache reuse while maintaining random order per request
- Add graceful fallback to MongoDB if Redis is unavailable
- Update .env.example with Redis configuration (REDIS_HOST, REDIS_PORT)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 20:25:11 +01:00
10cb650548 feat: enhance rosary with final prayer and mystery titles
- Add RosaryFinalPrayer component with Latin and German text
- Display short mystery titles in decade headings (e.g., "5. Gesätz: Kreuzigung")
- Add descriptive titles to initial three Ave Marias (Glaube, Hoffnung, Liebe)
- Add closing cross symbol to signal final sign of the cross
- Mystery titles update dynamically when switching between rosary types
2025-12-16 13:42:38 +01:00
10ee2e81ae refactor: consolidate formatting utilities and add testing infrastructure
- Replace 8 duplicate formatCurrency functions with shared utility
- Add comprehensive formatter utilities (currency, date, number, etc.)
- Set up Vitest for unit testing with 38 passing tests
- Set up Playwright for E2E testing
- Consolidate database connection to single source (src/utils/db.ts)
- Add auth middleware helpers to reduce code duplication
- Fix display bug: remove spurious minus sign in recent activity amounts
- Add path aliases for cleaner imports ($utils, $models)
- Add project documentation (CODEMAP.md, REFACTORING_PLAN.md)

Test coverage: 38 unit tests passing
Build: successful with no breaking changes
2025-11-18 15:24:22 +01:00
6e84fe1ce5 add MVP monthly expenses graph 2025-09-12 20:07:37 +02:00
ae4184c98d Add comprehensive recurring payments system with scheduling
- Add RecurringPayment model with flexible scheduling options
- Implement node-cron based scheduler for payment processing
- Create API endpoints for CRUD operations on recurring payments
- Add recurring payments management UI with create/edit forms
- Integrate scheduler initialization in hooks.server.ts
- Enhance payments/add form with progressive enhancement
- Add recurring payments button to main dashboard
- Improve server-side rendering for better performance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 12:41:18 +02:00
77d335ad8d trust host for reverse proxy in prod, general cleanup 2025-08-31 22:42:52 +02:00
74dd2b1f4b Update @auth/sveltekit to latest stable version 1.10.0
- Upgraded @auth/sveltekit from 0.14.0 to 1.10.0
- Updated session API from event.locals.getSession() to event.locals.auth()
- Fixed TypeScript definitions for new auth API in app.d.ts
- Updated layout server load functions to use LayoutServerLoad type
- Fixed session callbacks with proper token type casting
- Switched to generic OIDC provider config to resolve issuer validation issues
- All auth functionality now working with latest Auth.js version

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 21:45:14 +02:00
c8d879d4f9 Upgrade SvelteKit 4 to SvelteKit 5 with latest dependencies
Major changes:
- Upgraded Svelte from v4 to v5.38.6 (latest stable)
- Upgraded SvelteKit from v2.0.0 to v2.37.0 (latest)
- Upgraded Vite from v5 to v7.1.3 for better performance
- Updated all related packages to latest compatible versions
- Added pnpm as package manager with packageManager field
- Fixed Card.svelte nested anchor tags issue by converting inner links to buttons
- Updated component styling to maintain visual consistency
- Removed incompatible svelte-preprocess-import-assets package

Dependencies updated:
- @sveltejs/kit: ^2.0.0 → ^2.37.0
- @sveltejs/vite-plugin-svelte: ^3.0.0 → ^6.1.3
- svelte: ^4.0.0 → ^5.38.6
- vite: ^5.0.0 → ^7.1.3
- @sveltejs/adapter-auto: ^3.0.0 → ^6.1.0
- @sveltejs/adapter-node: ^2.0.0 → ^5.0.0
- svelte-check: ^3.4.6 → ^4.0.0
- mongoose: ^7.4.0 → ^8.0.0
- sharp: ^0.32.3 → ^0.33.0

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 21:01:19 +02:00
5ef504f943 bump @auth/sveltekit to 0.14.0 2024-03-09 13:52:11 +01:00
968c170cba remove unnecesarry deps since moving to authjs 2024-02-19 23:17:16 +01:00
e99351c670 migration to Sveltekit 2 2024-02-19 21:09:39 +01:00
b73a0f08a8 migration to Svelte 4 2024-02-19 21:02:51 +01:00
ca62e48f7b initial OIDC setup 2024-02-14 16:07:55 +01:00
aa88122c20 install OIDC, update packages 2024-01-28 12:37:30 +01:00
dea9a14e9f move to cheerio as server side rendering does not support DOMParser 2023-10-10 10:31:56 +02:00
fb13f202dd fix and update 2023-07-20 15:00:52 +02:00
2a945b292a update depends 2023-07-20 14:58:01 +02:00
fa23378952 Card hover effect smooth, mobile navbar hides on click 2023-07-13 13:54:42 +02:00
8f15d9650b fix to working state 2023-07-11 18:51:34 +02:00
2487bbe8e1 Update 2023-06-27 19:01:06 +02:00
6be720d5e6 Update build process 2023-06-25 10:17:12 +02:00
b4223f8eb0 Lots of changes, started on working /add 2023-06-24 15:35:37 +02:00
89612f02b6 Initial commit 2023-06-24 15:35:36 +02:00