WebDAV sync rejected valid files like 1784074260.pdf when the PDF magic
bytes were not at offset 0 (whitespace/BOM) or when a mobile scanner stored
JPEG bytes under a .pdf name. Scan the first 1KB for %PDF-, allow image
fallback for .pdf, and include validation detail in API errors.
Co-authored-by: Cursor <[email protected]>
Add default vs custom IMAP folder selection with live folder fetch in admin UI,
Alembic migration, sync filtering, and API endpoints for mailbox discovery.
Co-authored-by: Cursor <[email protected]>
- Amazon and Temu Playwright-based invoice scrapers
- BizDocs mobile API client (login + document upload)
- ShopAccount DB model, migration 006, scheduler integration
- REST API routes: GET/POST/PATCH/DELETE /api/shop-accounts
- POST /api/shop-accounts/{id}/trigger for on-demand scrape
- POST /api/shop-accounts/{id}/test for BizDocs credential check
- GET /api/shop-accounts/{id}/runs for scrape history
Co-Authored-By: Paperclip <[email protected]>
Account sync jobs were replaced on each schedule refresh, so the 15-minute
interval never elapsed and WebDAV/IMAP sync never ran after worker restarts.
Files under Faturas/2025/ or /2026/ are eligible even when Nextcloud
reports creationdate 1970. Add --requeue-folder-years to reset wrongly skipped records.
Add webdav_include_years account setting, skip files outside allowed year folders during sync, and a setup tool to mark older paths as already forwarded.
Add optional API upload alongside SMTP, Nextcloud/WebDAV as a document source with the same dedup/retry flow as IMAP, stricter invoice file checks for images, and admin UI for source and delivery modes.
Re-sending the original MIME kept Cc/Bcc (e.g. faturas@) so copies
returned to the monitored inbox. Drop extra recipient headers and
send SMTP RCPT only to the BizDocs destination.
Re-send the received RFC822 message with normal Fwd headers (To, From,
Subject). The previous code wrapped the message in message/rfc822 with
filename original-email.eml, which the relay rejected.
The outbound SMTP relay rejects message/rfc822 attachments named .eml.
Send the matched invoice files directly to BizDocs, which aligns with
the allowed relay extensions and the product filter rules.
Add manual sync buttons with batch limit, nginx timeouts for long syncs,
message retry endpoint, and fix worker to skip disabled accounts and
refresh schedules from the database every 2 minutes.
After --force-recreate web, the API container can take >10s to become
healthy. Retry up to 5 times with 5s backoff so transient startup
latency doesn't mark a successful deploy as failed.
Co-Authored-By: Paperclip <[email protected]>
The admin UI calls POST /accounts/{id}/test when the user clicks "Testar
ligação", but only granular /test/imap, /test/smtp, /test/send endpoints
existed — causing a 404. Adds the missing combined endpoint that runs
IMAP + SMTP tests in parallel and returns the ConnectionTestResult schema
the frontend expects (imap_ok, smtp_ok, bizdocs_ok).
Paperclip-Issue: BIT-26141
The deploy-hook container was killing itself before write_status ran,
leaving last_deploy=null on every successful deploy. Move health check
and write_status before the detached nohup restart of the deploy-hook
container so status is persisted even when the container recreates itself.
Co-Authored-By: Paperclip <[email protected]>
Accept account creates without destination_email (defaults to BizDocs
inbox) and force admin-ui rebuild on deploy so web container picks up UI changes.
- Add forwarder/error_reporter.py: Python client for v1/ingest/events
with cooldown-based dedup, best-effort delivery, and env-driven config
- Add FastAPI global exception handler to report unhandled 500s
- Report sync failures and forward failures from sync_service.py
- Report scheduler job failures from worker/scheduler.py with cooldown
- Report startup failures (ensure_admin_user) from app.py
- Report worker crashes from cli.py entry point
- Add error hub env vars to config.py (pydantic-settings)
- Update .env.example with ERROR_REPORTING_TOKEN and related vars
- Exclude IMAP/SMTP connection test errors per BIT-26136 scope note
- Uses project_slug=bizdocs-forwarder, gitea_repo=BitReport.pt/forwarder
Co-Authored-By: Paperclip <[email protected]>
Connection tests use 5s timeouts and run IMAP/SMTP in parallel so the UI
gets a clear error instead of nginx 504. Add deploy-hook service (:9090) and
deploy-pull.sh for push-to-main deploys on CT 243.