Commit Graph

962 Commits

Author SHA1 Message Date
Knee Cola
04c6f1868b Merge branch 'release/2.17.0' 2025-12-21 21:07:14 +01:00
Knee Cola
3f6c440f97 Merge branch 'release/2.17.0' into develop 2025-12-21 21:07:14 +01:00
Knee Cola
1420cfe2d9 2.17.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-21 21:03:25 +01:00
Knee Cola
6e5304aa40 docs: add CHANGELOG.md with version 2.17.0 entry
Document the reversion from zxing-wasm to pure JavaScript PDF417 implementation due to barcode scanner compatibility issues at Tisak kiosks.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-21 21:01:37 +01:00
Knee Cola
c55392bf38 Merge branch 'feature/reverting-pdf417-generator' into develop 2025-12-21 20:56:26 +01:00
Knee Cola
1e8a817fcc revert: restore legacy PDF417 barcode generation implementation
Restore custom PDF417 generator, renderer, and component that were previously removed. Update all components to use the legacy Pdf417Barcode instead of Pdf417BarcodeWasm.

Restored files:
- app/lib/pdf/pdf417.ts - Custom PDF417 generator library
- app/lib/pdf/renderBarcode.ts - Canvas-based barcode renderer
- app/ui/Pdf417Barcode.tsx - React component using custom generator

Updated imports in:
- app/ui/BillEditForm.tsx
- app/ui/PrintPreview.tsx
- app/ui/ViewBillCard.tsx
- app/ui/ViewLocationCard.tsx

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-21 20:52:04 +01:00
Knee Cola
cbe7b4eb78 Merge branch 'release/2.16.1' 2025-12-20 09:56:31 +01:00
Knee Cola
c22c1fb7fb Merge branch 'release/2.16.1' into develop 2025-12-20 09:56:31 +01:00
Knee Cola
a91c635fa4 2.16.1 2025-12-20 09:54:49 +01:00
Knee Cola
c068ffb7c3 Merge branch 'feature/improving-detection' into develop 2025-12-20 09:53:57 +01:00
Knee Cola
248b9cf3d0 perf: implement canvas pooling to reduce memory allocations
Replace per-iteration canvas creation with a reusable canvas pool:

- Pre-allocate 6 canvas objects (max needed for split=5 strategy)
- Reuse canvases across all split strategies by resizing
- Set unused canvases to 0×0 to free bitmap memory
- Reduces allocations from ~36 to 6 objects (83% reduction)

Benefits:
- Lower memory footprint
- Reduced GC pressure
- Better performance (resize vs allocate)
- More deterministic memory usage

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-20 09:52:24 +01:00
Knee Cola
09c4cca67b feat: implement horizontal slicing strategy for improved PDF417 detection
Improve barcode detection in documents with graphics and text by implementing
a multi-strategy horizontal slicing approach:

- Split documents into overlapping horizontal sections (5,4,3,2,1, or full)
- Decode each section separately to isolate individual barcodes
- Use 2% overlap between sections to avoid missing boundary codes
- Return the strategy that detects the most barcodes
- Early exit optimization when fewer codes are found

Also fix error handling to use Error objects instead of string literals.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-20 09:39:58 +01:00
Knee Cola
7ad2497757 Merge branch 'release/2.16.0' into develop 2025-12-20 08:53:25 +01:00
Knee Cola
84b94403c9 Merge branch 'release/2.16.0' 2025-12-20 08:53:23 +01:00
Knee Cola
bacc067c52 2.16.0 2025-12-20 08:53:12 +01:00
Knee Cola
589869551f Merge branch 'feature/zxing-wasm' into develop 2025-12-20 08:49:50 +01:00
Knee Cola
fc544a144b chore: remove legacy PDF417 generation implementation
Delete custom PDF417 generator and renderer now that all components use zxing-wasm/writer. Removes Pdf417Barcode component, generateBarcode, and renderBarcode utilities.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-20 08:49:11 +01:00
Knee Cola
b8afb2ef0d feat: migrate PDF417 barcode generation to zxing-wasm/writer
Replace custom PDF417 generation (generateBarcode/renderBarcode) with zxing-wasm's writeBarcode for improved reliability and smaller codebase. Updated all 4 components (BillEditForm, PrintPreview, ViewBillCard, ViewLocationCard) to use new Pdf417BarcodeWasm component with ecLevel 5 for error correction.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-20 08:46:38 +01:00
Knee Cola
9679246f62 chore: remove legacy @zxing packages and old decoder implementation
Remove @zxing/browser and @zxing/library dependencies as they have been fully replaced by zxing-wasm. Delete old barcodeDecoder.ts file which is no longer used after migration to barcodeDecoderWasm.ts.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-20 01:15:09 +01:00
Knee Cola
fcc1ede4d0 refactor: simplify barcode detection by removing canvas splitting
Remove canvas splitting logic since zxing-wasm natively supports multiple barcode detection with maxNumberOfSymbols parameter. Reduces code by 69 lines and improves performance by requiring only a single decode call per canvas. Set maxNumberOfSymbols to 10 for realistic utility bill use case.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-20 01:00:46 +01:00
Knee Cola
5b0497891a feat: migrate PDF417 barcode decoder from @zxing/browser to zxing-wasm
Replace @zxing/browser with zxing-wasm for better performance and smaller WebAssembly bundle size (919KB). Added middleware exclusion for .wasm files to prevent i18n routing interference.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-19 18:01:44 +01:00
7467f9d595 @zxing udpated to latest version 2025-12-19 12:55:49 +01:00
0bd9a7b34f Merge branch 'release/2.15.0' 2025-12-19 10:02:41 +01:00
7a09e3c98a Merge branch 'release/2.15.0' into develop 2025-12-19 10:02:41 +01:00
0241645872 2.15.0 2025-12-19 10:01:40 +01:00
c49705433f Merge branch 'feature/fixing-month-location-list-button-layout' into develop 2025-12-19 10:00:40 +01:00
23c3695a89 feat: improve mobile responsiveness across UI components
- Add responsive layout for action buttons (stack vertically on mobile, horizontal on sm+)
- Adjust card max-widths for better mobile display (LocationCard, MultiBillEdit)
- Improve button text sizing with responsive classes (text-sm on mobile, text-xs on sm+)
- Remove width constraints on file inputs and info boxes for full-width mobile layout
- Fine-tune icon positioning for better visual alignment

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-19 09:59:37 +01:00
79c42aa349 Merge branch 'release/2.14.0' 2025-12-18 18:01:08 +01:00
c4eea408fa Merge branch 'release/2.14.0' into develop 2025-12-18 18:01:08 +01:00
82c7c938ba 2.14.0 2025-12-18 18:00:24 +01:00
08ab4646c3 Merge branch 'feature/multi-bill-edit' into develop 2025-12-18 17:58:29 +01:00
b50603a8fe refactor: optimize state initialization with lazy initializers
- Move billStates calculation into useState lazy initializer to prevent recalculation on re-renders
- Initialize allPaidMode based on billStates to reflect actual data state
- Use lazy initialization pattern for better performance
- Remove intermediate variables to simplify code

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-18 17:57:51 +01:00
0145a2030d feat: add multi-bill-edit page for batch bill status updates
- Add getLocationsByMonth server action with aggregation pipeline to calculate hasAttachment
- Add updateMonth server action for bulk bill status updates with path revalidation
- Create multi-bill-edit page at /home/multi-bill-edit/[year]/[month]
- Implement MultiBillEdit component with toggle functionality for all bills
- Add BillToggleBadge component integration for consistent bill display
- Add "set all as paid/unpaid" toggle button for batch operations
- Implement server-side redirect with success message after save
- Add Suspense boundary with loading skeleton
- Update translations for multi-bill-edit feature (Croatian and English)
- Ensure data freshness with unstable_noStore and revalidatePath

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-18 17:45:27 +01:00
e9ade045d8 feat: add separate unpaid and paid bill totals to location cards
- Display both unpaid and paid bill amounts in LocationCard and MonthCard
- Rename variables for clarity: totalUnpaid, totalPayed, unpaidTotal, payedTotal
- ViewLocationCard uses totalAmount for tenant bills (regardless of payment status)
- Update Croatian translations: "Ukupno neplaćeno" (unpaid), "Ukupno plaćeno" (paid)
- Add ShoppingCartIcon for unpaid amounts, BanknotesIcon for paid amounts
- Update HomePage to calculate and pass both totals to month cards

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-18 14:59:11 +01:00
Knee Cola
4e1bef30f5 Merge branch 'hotfix/2.13.1' 2025-12-08 01:37:57 +01:00
Knee Cola
c817c9be05 Merge branch 'hotfix/2.13.1' into develop 2025-12-08 01:37:57 +01:00
Knee Cola
7212425961 fix: use forEach instead of for-of to iterate Map entries 2025-12-08 01:36:41 +01:00
Knee Cola
f4793fa6d3 Merge branch 'release/2.13.0' 2025-12-08 01:25:43 +01:00
Knee Cola
a61ece9993 Merge branch 'release/2.13.0' into develop 2025-12-08 01:25:43 +01:00
Knee Cola
1c80caee9c 2.13.0 2025-12-08 01:24:22 +01:00
Knee Cola
b86713b71b Merge branch 'feature/improving-security' into develop 2025-12-08 01:23:56 +01:00
Knee Cola
927349e1d2 feat: add share link security environment variables to Docker configs
Changes:
- Add SHARE_LINK_SECRET (production secret, 64-char hex)
- Add SHARE_TTL_INITIAL_DAYS=10 (days before first tenant visit)
- Add SHARE_TTL_AFTER_VISIT_HOURS=1 (hours after tenant visits)
- Add UPLOAD_RATE_LIMIT_PER_IP=5 (max uploads per IP)
- Add UPLOAD_RATE_LIMIT_WINDOW_MS=3600000 (1 hour rate limit window)

Updated both:
- docker-compose-standalone.yaml
- docker-compose-swarm.yml

Production SHARE_LINK_SECRET generated with: openssl rand -hex 32

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 01:20:55 +01:00
Knee Cola
479df6e0a7 feat: add additional Bash commands to settings for enhanced functionality 2025-12-08 01:18:43 +01:00
Knee Cola
e978a5c2bf feat: add debug logging and improve proof-of-payment icon styling
Changes:
- Add console.log statements for shareId validation failures in locationActions
- Replace DocumentIcon with TicketIcon for proof-of-payment downloads (consistency)
- Add teal color to all proof-of-payment icons for visual distinction
- Adjust vertical alignment of icons for better visual alignment with text

Debug logging helps troubleshoot:
- shareId extraction failures
- Checksum validation failures
- Location not found errors

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 01:17:03 +01:00
Knee Cola
bc336a9744 feat: secure attachment download route with shareId validation
Changes:
- Update attachment download link in UI to use shareId
- Add shareId validation to attachment download route
- Validate TTL before allowing attachment downloads
- Extract locationId from shareId using extractShareId helper

Security:
- Attachment downloads now validate checksum and TTL
- Prevents unauthorized access to bill attachment files
- Returns 404 for invalid/expired share links

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 01:02:20 +01:00
Knee Cola
f19e1bc023 feat: secure proof-of-payment download routes with shareId validation
Changes:
- Update download links in UI to use shareId instead of locationID
- Add shareId validation to per-bill proof download route
- Add shareId validation to combined proof download route
- Validate TTL before allowing downloads
- Extract locationId from shareId using extractShareId helper

Security:
- Download routes now validate checksum and TTL
- Prevents unauthorized access to proof-of-payment files
- Returns 404 for invalid/expired share links

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 01:01:38 +01:00
Knee Cola
669fb08582 fix: update bill detail page to support combined shareId
Changes:
- Extract shareId (40 chars) and billID from combined URL parameter
- Validate shareId using validateShareAccess before fetching bill
- Pass shareId to ViewBillCard for secure uploads
- Show error message if share link is invalid or expired

URL format: /share/bill/{shareId}-{billID}
  where shareId = locationId (24) + checksum (16) = 40 chars

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 01:00:06 +01:00
Knee Cola
81dddb526a feat: secure combined uploads and update UI components
Changes:
- Secure uploadUtilBillsProofOfPayment with checksum validation
- Update ViewLocationCard to accept and use shareId prop
- Update ViewBillCard to accept shareId and use it for uploads
- Update ViewBillBadge to pass shareId to bill detail pages
- Add client-side validation check for shareId before upload
- Update back button links to use shareId

Security improvements:
- Both per-bill and combined uploads now validate checksum and TTL
- IP-based rate limiting applied to both upload types
- PDF magic bytes validation for both upload types

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 00:25:26 +01:00
Knee Cola
844e386e18 refactor: use combined shareId (locationId + checksum) in URL
Changes:
- Add generateShareId() and extractShareId() helpers
- Share URLs now use single parameter: /share/location/{shareId}
- shareId = locationId (24 chars) + checksum (16 chars) = 40 chars total
- Update validateShareAccess() to extract locationId from shareId
- Update uploadProofOfPayment() to accept combined shareId
- Update LocationViewPage to validate and extract locationId from shareId

Benefits:
- Simpler URL structure (one parameter instead of two)
- Checksum extraction by length (deterministic, no parsing needed)
- Same security properties (HMAC-SHA256 validation)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 00:22:59 +01:00
Knee Cola
e497ad1da6 feat: implement secure uploadProofOfPayment with multi-layer validation
Security improvements:
- Add checksum validation (prevents unauthorized access)
- Add IP-based rate limiting (prevents abuse)
- Replace MIME type check with PDF magic bytes validation
- Add shareTTL expiry validation
- Add automatic cleanup of expired shares
- Sanitize error messages (generic responses to clients)

Breaking change: Function signature now requires checksum parameter

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 00:17:18 +01:00