Commit Graph
808 Commits
Author SHA1 Message Date
Jeppe B 48b625a8a0 Add Qodana code quality workflow 2026-02-24 10:24:21 +01:00
Jeppe Bundgaard 2e88ed7bbd Add binding for acme-io.json in Traefik config 2026-02-24 00:28:17 +01:00
Jeppe Bundgaard 629c13499d Add CORS rule for api.truckwash.io and new preflight route
- Introduce preflight handling for `OPTIONS` method on `api.truckwash.io` with high priority routing and secure headers middleware.
- Extend CORS configuration to include `https://api.truckwash.io`.
2026-02-23 23:45:22 +01:00
Jeppe Bundgaard 356e59bd10 Improve dynamic URL generation and add localhost support for passkey challenges
- Refactor direct download URL generation to dynamically use `HTTP_HOST` and protocol.
- Add support for localhost `rpId` during WebAuthn passkey challenges.
- Extend test cases to validate `localhost` and `truckwash.io` scenarios.
- Update OpenAPI specifications to reflect new `rpId` logic and additional server configurations.
2026-02-23 23:37:15 +01:00
Jeppe Bundgaard 61db62212c Add WebAuthn passkey challenge and verification endpoints
- Introduced endpoints for WebAuthn-based authentication flow (`/auth/passkey/challenge` and `/auth/passkey/verify`).
- Added support for generating and verifying WebAuthn PublicKeyCredentialRequestOptions and challenge tokens.
- Extended routing logic to expose matched route templates for improved parameter handling.
- Updated OpenAPI specifications to document passkey challenge and verification workflows.
- Included unit tests for validating both existing and non-existing user scenarios during passkey challenges.
2026-02-23 23:03:28 +01:00
Jeppe Bundgaard 63c88a463d Refactor passkey and token processing for improved consistency and validation
- Update passkey data mapping to use associative arrays and handle JSON decoding for `transports`.
- Refactor token caching logic to validate database existence and clear stale entries.
- Improve 2FA handling by centralizing `token->type` and `user_id` processing for reuse.
2026-02-23 22:44:06 +01:00
Jeppe Bundgaard 8ae0e28162 Add sign_count and backup_state properties to passkey object initialization 2026-02-23 22:01:09 +01:00
Jeppe Bundgaard eb0f4ca38b Enhance 2FA handling and subuser session management
- Add `two_factor_enabled` property for subuser responses in routes and OpenAPI specs.
- Improve subuser session resolution by checking token `id` for validity.
- Adjust authentication flow to prevent operations on nonexistent users in 2FA logic.
- Update OpenAPI request/response schema to better represent token/session objects.
2026-02-23 21:44:11 +01:00
Jeppe Bundgaard ce889053a6 Improve subuser session handling and 2FA logic
- Add fallback logic to resolve subuser sessions via the tokens table when cache is missing or expired, with re-caching for future use.
- Refactor 2FA flow to prioritize subuser over user objects for better clarity and ensure compatibility with TOTP logic.
- Add safeguards to avoid operations on nonexistent users or subusers in 2FA and authentication flows.
2026-02-23 18:57:20 +01:00
Jeppe Bundgaard f6b526f4ef Add two-factor authentication support for users and subusers
- Extend `users_o` and `subusers_o` with `two_factor_enabled` and `two_factor_secret` properties.
- Implement methods for managing 2FA (`isTwoFactorEnabled`, `setTwoFactorSecret`, `verify_2fa_code`) in authentication logic.
- Add 2FA handling in login flows for both users and subusers, including token generation and validation.
- Introduce `totp` class for TOTP-based authentication, including QR code generation and code verification.
- Add test cases for 2FA functionality (`TwoFactorAuthTest.php`) and coverage for login scenarios with 2FA.
- Update OpenAPI specifications to include 2FA flows (`auth/2fa/setup`, `auth/2fa/enable`, `auth/2fa/verify`, `auth/2fa/disable`).
2026-02-23 17:00:18 +01:00
Jeppe Bundgaard 827fafd46b Add validation to prevent duplicate company phone numbers during customer registration 2026-02-23 16:30:51 +01:00
Jeppe Bundgaard 5a59562e35 Add Bird API integration with voice call and flash call support
- Implement Bird API client (`bird.php`) for handling HTTP requests to Bird services.
- Add routes for voice and flash call management (`birdVoiceFlashCallsRoute.php`, `birdNumbersRoute.php`).
- Introduce test cases for voice calls, flash calls, and numbers (`VoiceCallsApiTest.php`, `NumbersAndFlashCallsApiTest.php`).
- Include configuration management classes and APIs for enabling the Bird module and managing API keys (`bird_c.php`).
- Provide OpenAPI specifications for flash call endpoints (`bird-flash-calls.md`).
2026-02-19 12:19:36 +01:00
Jeppe Bundgaard 6d09e5449e Enhance MACHINE relay control logic and add emergency override functionality
- Add `forceTurnOffMachineRelay` method for superuser/emergency operations to bypass gating restrictions.
- Enforce `toggle_after = 0` to prevent auto-toggle behavior.
- Update routes to explicitly reflect relay state when modifying MACHINE relay.
- Extend Shelly device switch handling with optional `skip_toggle_after` parameter.
2026-02-19 11:37:16 +01:00
Jeppe Bundgaard aaaaedc70c Add tests for forced MACHINE relay control endpoints
- Introduce HTTP tests for `/modules/self-serve/lane/force/machine/enable` and `/disable`.
- Add `ForceMachineRelayBypassTest` to validate bypass behavior of manual gating restrictions.
2026-02-19 11:07:44 +01:00
Jeppe Bundgaard 4bdbe40329 Add superuser endpoints for forced MACHINE relay control
- Implement emergency operations to forcibly enable or disable MACHINE relays (`forceTurnOnMachineRelay`).
- Add OpenAPI specifications for `/modules/self-serve/lane/force/machine/enable` and `/modules/self-serve/lane/force/machine/disable`.
- Update route definitions and introduce validation for input parameters.
2026-02-19 10:39:43 +01:00
Jeppe Bundgaard 54160659fc Add dynamic image generation for department lanes
- Implement `/department/lanes/dynamic-image` endpoint for machine UI dynamic image rendering.
- Add OpenAPI specification for the new endpoint with query parameters for buttons, current step, and vehicle type.
- Include `DepartmentLanesImageTest` for lightweight testing of image behavior and input normalization.
- Update `departmentLanesRoute.php` with logic for parameter handling and image composition based on lane configuration.
2026-02-18 16:44:18 +01:00
Jeppe Bundgaard 73ac77a2f5 Add support for dynamic image buttons and vehicle type selection in self-serve tasks
- Extend `department_selfserve_tasks_o` with `buttons` and `dynamic_images_vehicle_type` properties.
- Add normalization/validation methods for `buttons` and `dynamic_images_vehicle_type` parameters.
- Update `departmentSelfserveTasksRoute` to handle new fields in task creation and update.
- Add OpenAPI specifications for `buttons` and `dynamic_images_vehicle_type`.
- Include comprehensive tests for button normalization and vehicle type selection.
2026-02-18 16:34:58 +01:00
Jeppe Bundgaard 28a4a9d8e6 Add StopTurnsOffRelayTest to verify machine relay behavior during STOP with self-serve enabled
- Introduce a minimal, self-contained test to ensure the relay turns off when STOP is executed.
- Enhance `selfserve_lane_command_t` to handle relay shutdown based on department configuration.
- Include `isDepartmentSelfServeEnabled` method for testing override and I/O avoidance.
2026-02-18 16:14:33 +01:00
Jeppe Bundgaard 9881e57698 Ensure proper initialization of lane status via getter methods, refactor email template structure for better MSO compatibility, and add machine_available field to guest API response. 2026-02-18 16:06:14 +01:00
Jeppe Bundgaard f292152135 Improve email templates with MSO compatibility and enhanced styling
- Refactor header and footer to support Outlook Classic (MSO) rendering.
- Adjust logo sizing, alignment, and styles for improved consistency.
- Update inline styles for better cross-platform email rendering.
2026-02-18 15:43:19 +01:00
Jeppe Bundgaard 3f512a4fa6 Refine new customer welcome email template with inline styles, improved accessibility, and MSO-specific adjustments 2026-02-18 15:42:14 +01:00
Jeppe Bundgaard c5840c0f3e Add self-serve module loading, enum test, and update email styles/text
- Add `SelfserveLaneServicesEnumTest` to validate `selfserve_lane_services` cases.
- Update `index.php` to load self-serve module interfaces, traits, classes, helpers, and configs.
- Center Truck Wash logo in email header and adjust styling.
- Localize password reset error message in `authRoute.php` with Danish text.
2026-02-18 15:35:41 +01:00
Jeppe Bundgaard 51014bf774 Add development guidelines, testing rules, and secure routes documentation
- Add `.junie/guidelines.md` with comprehensive development instructions.
- Include `.aiassistant/rules/Creating and maintaining tests.md` and `.aiassistant/rules/Creating and securing routes.md`.
- Introduce `CACHE_SELFSERVE_LANE_KEY_ALLOWED_SERVICES` for lane service validation.
- Update `selfserve_lane_relay_controller_t` to enforce service-specific permissions for machine relay.
2026-02-18 14:13:05 +01:00
Jeppe Bundgaard 008e2af09a Add support for self-serve task services and validation logic
- Introduce `services` property to `department_selfserve_tasks_o` for task-specific functionalities.
- Add service validation and normalization via `selfserve_lane_services` enum.
- Extend `departmentSelfserveTasksRoute` to handle `services` input for add/edit operations.
- Create `selfserve_lane_services` enum to define and validate service types.
2026-02-18 12:47:00 +01:00
Jeppe Bundgaard efaed8c6cc Refactor new customer email template and attachments handling
- Update welcome email template to conditionally include corporate ID.
- Remove unused base64 signature utility and clean up the email class.
- Comment out attachments array for potential future updates.
2026-02-17 12:07:03 +01:00
Jeppe Bundgaard b7648ccc2c Update new customer email template with dynamic company data and revised signature assets
- Dynamically insert company name and corporate ID in welcome message.
- Replace signature image URLs with updated assets and ensure proper loading.
- Add utility for retrieving base64-encoded signatures to enhance flexibility.
2026-02-17 12:01:10 +01:00
Jeppe Bundgaard a31187879b Refine new customer welcome email template with enhanced styles and improved HTML structure 2026-02-17 11:46:33 +01:00
Jeppe Bundgaard 3e76bdccc2 Add HTML email template for new customer welcome email and integrate into email class 2026-02-17 11:43:14 +01:00
Jeppe Bundgaard 0a582951a0 Add new HTML email template and assets for welcoming new Truckwash customers 2026-02-17 11:37:49 +01:00
Jeppe Bundgaard fc054d6226 Expand CORS allowlist in Traefik to include http://localhost:5173 for development purposes 2026-02-17 11:37:35 +01:00
Jeppe Bundgaard 4d2264e51e Expand CORS allowlist in Traefik to include additional Truckwash domains and localhost 2026-02-17 09:23:33 +01:00
Jeppe Bundgaard 241a05e498 Send additional welcome emails to info@truckwash.dk and jm@truckwash.dk when creating new customers 2026-02-16 15:44:53 +01:00
Jeppe Bundgaard e6358d09fc Ensure isWashCertificate check is case-insensitive in attachment.php 2026-02-16 15:32:37 +01:00
Jeppe Bundgaard 1791a62992 Remove port from file download URLs in attachment_store.php and upload_store.php 2026-02-16 15:10:38 +01:00
Jeppe Bundgaard 0c411fa3b8 Add deprecated /tmp-send-email route with welcome email functionality
- Introduce a temporary route to send deprecated responses for email testing.
- Use `sendWelcomeEmailToCustomer` from the `email` class to implement email-sending logic.
2026-02-16 14:57:47 +01:00
Jeppe Bundgaard 4248de1d7d Add password reset link generation and welcome email functionality
- Introduce `generatePasswordResetLink` method in `users_o` for creating secure password reset links.
- Add `sendWelcomeEmailToCustomer` method to `email` class with support for attachments.
- Update `authRoute.php` to send welcome emails when creating new customers.
- Extend `sendEmail` to handle optional attachments and references.
- Disable PHP entrypoint in Dockerfile for improved flexibility.
2026-02-16 14:55:01 +01:00
Jeppe B 82e41f45a9 Merge pull request #127 from copenhagentruckwash/scalability-enhancement
scalability-enhancement
2026-02-16 13:26:55 +01:00
Jeppe Bundgaard 29a07e652c Enhance CORS handling in Traefik and Caddy
- Add preflight routers and attach `secure-headers` middleware in Traefik for `api.truckwash.dk` and `cloud.truckwash.dk`.
- Update `secure-headers` middleware with refined CORS headers and stricter origin/method/header configurations.
- Remove redundant CORS logic in Caddy, delegating CORS management entirely to Traefik.
2026-02-16 13:25:54 +01:00
Jeppe Bundgaard dd33fa2b19 Update CORS handling in Traefik and Caddy configurations
- Add origin-specific CORS settings to Traefik for `truckwash.io` with credentials support.
- Simplify and standardize CORS headers in Caddy, removing upstream duplication and adjusting preflight logic.
2026-02-16 13:08:38 +01:00
Jeppe Bundgaard 22790705b4 Disable auto HTTPS and improve CORS handling in Caddyfile for internal HTTP and simplified preflight responses. 2026-02-16 12:35:03 +01:00
Jeppe Bundgaard 0ec8339d3e Simplify CORS handling in Caddyfile by allowing all origins and updating preflight response logic. 2026-02-16 12:31:06 +01:00
Jeppe Bundgaard 739beced0d Expand CORS support in Caddyfile to include truckwash.io subdomains alongside truckwash.dk and localhost. 2026-02-16 12:21:46 +01:00
Jeppe Bundgaard ac542a705e Update Caddyfile with refined CORS handling and stricter origin matching for truckwash.dk subdomains and localhost 2026-02-16 12:21:02 +01:00
Jeppe Bundgaard fe0e02b8fe Add Redis healthchecks and startup wait in PHP entrypoint
- Introduce Redis healthchecks in `docker-compose.prod.yml` for better container monitoring.
- Extend PHP Dockerfile with `redis-tools` and enable Composer dependency auto-install.
- Update `docker-entrypoint.sh` to wait for Redis readiness before starting PHP-FPM.
- Remove local Nginx override and simplify development setup.
2026-02-16 12:18:42 +01:00
Jeppe Bundgaard a709656ba3 Add production-ready Traefik configuration with secure headers, TLS settings, and rate limiting 2026-02-16 11:39:28 +01:00
Jeppe Bundgaard 21f64bbb5f Add Prometheus metrics and Jaeger tracing to Traefik configuration 2026-02-16 11:32:24 +01:00
Jeppe Bundgaard 7c2b6f1357 Update Traefik dynamic config with bcrypt-hashed credentials for truckwash. 2026-02-16 11:26:40 +01:00
Jeppe Bundgaard c7ea1e1aaa Add Traefik and Caddy configurations for reverse proxy setup and internal HTTP handling. 2026-02-16 11:15:20 +01:00
Jeppe Bundgaard 8c8de541be - Update Nginx logging with structured JSON and standard combined format for Elastic integration.
- Add new upstream PHP-FPM servers to Nginx configuration for enhanced load balancing.
- Introduce Elastic APM PHP agent in `php.ini` and update Dockerfile for better dependency management.
- Secure Kibana and Elasticsearch connections in Metricbeat/Filebeat configurations with credentials.
- Remove unused PHP dependencies from `composer.json` and `composer.lock`.
2026-02-16 10:58:50 +01:00
Jeppe Bundgaard 8d8137852f Adjust Monday message time check and add deprecated route with CSV export functionality
- Update the Monday message check to start at 07:00 instead of 06:00.
- Add `/tmp-washes-in-time` route to generate and download a CSV file of washes within a specific time range.
- Mark `/tmp-washes-in-time` route as deprecated.
2026-02-16 09:25:11 +01:00