Commit Graph

351 Commits

Author SHA1 Message Date
Dries Peeters e2f924a54d tests: make user fixtures idempotent to avoid unique violations under PostgreSQL 2025-10-21 08:46:09 +02:00
Dries Peeters 8884730bce Merge pull request #101 from DRYTRIX/develop
ci: ensure DB schema exists before tests (flask db upgrade)
dev-dev-54-e2f924a5
2025-10-21 08:38:07 +02:00
Dries Peeters 60e10d2c48 ci: ensure DB schema exists before tests (flask db upgrade) 2025-10-21 08:14:12 +02:00
Dries Peeters 96e3948ce6 Merge pull request #100 from DRYTRIX/develop
ci: restore v3.0.0 workflows; keep PostHog/Sentry injection in releas…
dev-dev-53-60e10d2c
2025-10-21 08:04:40 +02:00
Dries Peeters 3b73cb5534 ci: restore v3.0.0 workflows; keep PostHog/Sentry injection in release build 2025-10-21 07:47:44 +02:00
Dries Peeters d4b37e8db7 Merge pull request #99 from DRYTRIX/develop dev-dev-51-7a4354d1 dev-dev-52-3b73cb55 2025-10-20 22:13:26 +02:00
Dries Peeters 7a4354d1fb update cert 2025-10-20 22:07:14 +02:00
Dries Peeters 3567be8c36 Merge pull request #98 from DRYTRIX/develop
Update test_analytics.py
dev-dev-50-c823bb13
2025-10-20 21:54:10 +02:00
Dries Peeters c823bb1331 Update test_analytics.py 2025-10-20 21:49:08 +02:00
Dries Peeters b22c3c9ea0 Merge pull request #97 from DRYTRIX/develop
Develop
2025-10-20 21:42:02 +02:00
Dries Peeters 8b5d7af40f Update build-and-publish.yml 2025-10-20 21:31:59 +02:00
Dries Peeters 81b759a409 Update build-dev.yml 2025-10-20 21:28:20 +02:00
Dries Peeters 7d1ad9023a Update tests 2025-10-20 21:25:13 +02:00
Dries Peeters 8b6d92780e Merge pull request #96 from DRYTRIX/develop
Develop
dev-dev-46-4c67b25f dev-dev-47-7d1ad902 dev-dev-48-81b759a4 dev-dev-49-8b5d7af4
2025-10-20 21:07:45 +02:00
Dries Peeters 4c67b25f9d feat: enhance invoice management UI and add generate-from-time feature
- Enhanced invoice creation form with auto-fill client data from project selection
- Redesigned invoice edit page with improved layout and quick actions sidebar
- Added new generate-from-time template for adding unbilled time entries and costs
- Improved form styling and added responsive design enhancements
- Added internationalization (i18n) support throughout invoice templates
- Added notes and terms fields to invoice forms
- Implemented item removal functionality in invoice editor
- Added comprehensive tests for new invoice features
- Updated .gitignore to exclude logs directory
- Bumped version from 3.0.0 to 3.2.0

The invoice UI now provides:
- Quick actions panel with export, duplicate, and payment recording links
- Invoice summary sidebar showing totals and status
- Tips and guidance sidebars for better UX
- Client data auto-population when selecting projects
- Improved visual hierarchy and mobile responsiveness
2025-10-20 21:01:09 +02:00
Dries Peeters f390a13474 chore(devops): streamline Docker Compose and refresh docs/config
- Simplify docker-compose setup and align environment defaults
- Update README and Quick Start to reflect the new compose flow
- Refine app initialization and configuration for clearer env handling
- Minor consistency and cleanup in config modules

No breaking changes expected.
2025-10-20 20:44:11 +02:00
Dries Peeters e99036fb78 Merge pull request #93 from DRYTRIX/Feat-Metrics
Feat metrics
2025-10-20 20:02:39 +02:00
Dries Peeters 10e9bb7c8a Update workflow files 2025-10-20 19:58:09 +02:00
Dries Peeters 264a43083e Update 2025-10-20 19:55:03 +02:00
Dries Peeters a876980d18 Update .gitignore 2025-10-20 14:59:40 +02:00
Dries Peeters e4789cc26e feat: Add telemetry and analytics infrastructure with observability stack
Implement comprehensive analytics and monitoring system with PostHog integration,
complete observability stack (Prometheus, Grafana, Loki, Promtail), and CI/CD
workflows for automated builds.

Features:
- Add PostHog telemetry integration with privacy-focused event tracking
- Implement installation flow for opt-in telemetry configuration
- Add telemetry management UI in admin panel with detailed transparency
- Track key user events across all major features (projects, tasks, timer, etc.)

Infrastructure:
- Set up Prometheus for metrics collection
- Configure Grafana for visualization dashboards
- Integrate Loki and Promtail for log aggregation
- Add separate analytics docker-compose configuration

CI/CD:
- Add GitHub Actions workflows for building and publishing Docker images
- Implement separate dev and production build pipelines
- Configure automated image publishing to registry

Documentation:
- Restructure documentation into organized docs/ directory
- Add comprehensive guides for telemetry, analytics, and local development
- Create transparency documentation for tracked events
- Add CI/CD and build configuration guides

Code improvements:
- Integrate telemetry hooks across all route handlers
- Add feature flags and configuration management
- Refactor test suite for analytics functionality
- Clean up root directory by moving docs and removing test artifacts

Breaking changes:
- Requires new environment variables for PostHog configuration
- Docker compose setup now supports analytics stack

Changes: 73 files changed, 955 insertions(+), 14126 deletions(-)
2025-10-20 14:38:57 +02:00
Dries Peeters f5c3c3f59f fix: resolve keyboard shortcut conflicts and notification errors
Fixed multiple issues with keyboard shortcuts and browser notifications:

Keyboard Shortcuts:
- Fixed Ctrl+/ not working to focus search input
- Resolved conflict between three event handlers (base.html, commands.js, keyboard-shortcuts-advanced.js)
- Changed inline handler from Ctrl+K to Ctrl+/ to avoid command palette conflict
- Updated search bar UI badge to display Ctrl+/ instead of Ctrl+K
- Removed conflicting ? key handler from commands.js (now uses Shift+? for shortcuts panel)
- Improved key detection to properly handle special characters like / and ?
- Added debug logging for troubleshooting keyboard events

Final keyboard mapping:
- Ctrl+K: Open Command Palette
- Ctrl+/: Focus Search Input
- Shift+?: Show All Keyboard Shortcuts
- Esc: Close Modals/Panels

Notification System:
- Fixed "right-hand side of 'in' should be an object" error in smart-notifications.js
- Changed notification permission request to follow browser security policies
- Permission now checked silently on load, only requested on user interaction
- Added "Enable Notifications" banner in notification center panel
- Fixed service worker sync check to properly verify registration object

Browser Compatibility:
- All fixes respect browser security policies for notification permissions
- Graceful degradation when service worker features unavailable
- Works correctly on Chrome, Firefox, Safari, and Edge

Files modified:
- app/static/enhanced-search.js
- app/static/keyboard-shortcuts-advanced.js
- app/static/smart-notifications.js
- app/templates/base.html
- app/static/commands.js

Closes issues with keyboard shortcuts not responding and browser console errors.
2025-10-20 13:00:39 +02:00
Dries Peeters fb61a661f2 Merge pull request #91 from DRYTRIX/develop
Develop
v3.0.0 dev-dev-43-f5c3c3f5 dev-dev-44-e99036fb dev-dev-45-f390a134
2025-10-20 06:09:16 +02:00
Dries Peeters 04ed5ef8ae fix(oidc): only perform RP-Initiated Logout when OIDC_POST_LOGOUT_REDIRECT_URI is set
ixes #88

When OIDC_POST_LOGOUT_REDIRECT_URI was unset, the application was still
attempting RP-Initiated Logout by falling back to a generated redirect URL.
This caused issues with OIDC providers like Authelia that don't support
RP-Initiated Logout, resulting in failed redirects to unsupported endpoints.

Changes:
- Modified logout logic in app/routes/auth.py to only attempt provider
  logout when OIDC_POST_LOGOUT_REDIRECT_URI is explicitly configured
- If unset, users are now logged out locally and redirected to the
  TimeTracker login page (expected behavior)
- If set, RP-Initiated Logout proceeds as before (backward compatible)

Documentation:
- Updated docs/OIDC_SETUP.md with guidance on when to set the config
- Added clear comments in env.example explaining optional behavior
- Documented troubleshooting steps for providers without RP-Initiated
  Logout support (e.g., Authelia)

Tests:
- Added comprehensive test suite (tests/test_oidc_logout.py) with 9 tests
  covering different logout scenarios and edge cases
- All existing tests continue to pass (no regressions)

This change is fully backward compatible. Users with providers supporting
RP-Initiated Logout can continue using OIDC_POST_LOGOUT_REDIRECT_URI as
before. Users with providers like Authelia should leave it unset for
local-only logout.
2025-10-17 12:51:43 +02:00
Dries Peeters 5bb0959596 Merge pull request #89 from DRYTRIX/Feat-UIRedesign
feat: Implement Tailwind CSS UI redesign across application
2025-10-17 12:41:14 +02:00
Dries Peeters c616725938 Update analytics.py 2025-10-17 12:34:34 +02:00
Dries Peeters f873259950 Update test_analytics.py 2025-10-17 12:29:42 +02:00
Dries Peeters ee3776a72e Update test_tasks_templates.py 2025-10-17 11:57:05 +02:00
Dries Peeters 3c3faf13d4 feat: Implement Tailwind CSS UI redesign across application
Migrate frontend from custom CSS to Tailwind CSS framework with comprehensive
template updates and improved component structure.

Breaking Changes:
- Remove legacy CSS files (base.css, calendar.css, ui.css, etc.)
- Replace with Tailwind-based styling system

New Features:
- Add Tailwind CSS configuration with PostCSS pipeline
- Create new template components for admin, clients, invoices, projects, reports
- Add form-bridge.css for smooth transition between legacy and Tailwind styles
- Add default avatar SVG asset
- Implement Tailwind-based kanban board template
- Add comprehensive UI quick wins documentation

Infrastructure:
- Add package.json with Tailwind dependencies
- Configure PostCSS and Tailwind build pipeline
- Update .gitignore for Node modules and build artifacts

Testing:
- Add template rendering tests (test_tasks_templates.py)
- Add UI component tests (test_ui_quick_wins.py)

Templates Added:
- Admin: dashboard, settings, system info, user management
- Clients: list and detail views
- Invoices: full CRUD templates with payment recording
- Projects: list, detail, and Tailwind kanban views
- Reports: comprehensive reporting templates
- Timer: manual entry interface

This commit represents the first phase of the UI redesign initiative,
maintaining backward compatibility where needed while establishing the
foundation for modern, responsive interfaces.
2025-10-17 11:51:36 +02:00
Dries Peeters b710c0faf1 Merge pull request #87 from DRYTRIX/develop
Develop
v2.3.7 dev-dev-42-04ed5ef8 dev-dev-41-5bb09595
2025-10-16 19:58:09 +02:00
Dries Peeters 6936018ec3 Merge branch 'main' into develop 2025-10-16 19:41:16 +02:00
Dries Peeters 1e83a9cad7 Update setup.py 2025-10-16 19:28:02 +02:00
Dries Peeters b0f42f5fad CSRF: add trusted origins to support reverse-proxied host/proto
Add WTF_CSRF_TRUSTED_ORIGINS to app/config.py (env-driven, comma-separated; default https://track.example.com) to allow CSRF validation when referrer/origin host matches a trusted origin behind a proxy.
Keep existing ProxyFix(x_proto=1, x_host=1, x_for=1, x_port=1) so Flask honors X-Forwarded-* headers.
Ensure forms/AJAX post to the same origin you’ve configured via WTF_CSRF_TRUSTED_ORIGINS.
2025-10-16 19:26:56 +02:00
Dries Peeters c0e0fd2d17 Fix OIDC login failure due to missing nonce parameter in ID token parsing
The OIDC callback was failing because parse_id_token() was called without
the required 'nonce' parameter, causing authentication to fail with a
TypeError. This prevented the issuer (iss) claim from being extracted,
which is required for successful OIDC login.

Changes:
- Check if ID token claims are already available in the token response
  under 'userinfo' key (parsed by Authlib during authorize_access_token)
- If not available, retrieve nonce from session and pass it to
  parse_id_token() method
- This ensures the issuer and subject claims are properly extracted from
  the ID token instead of only relying on the userinfo endpoint

The issuer claim is only present in the ID token, not the userinfo
endpoint, so proper ID token parsing is essential for authentication.

Fixes #<issue_number>
2025-10-16 12:52:51 +02:00
Dries Peeters 1e1e3ad43a Update setup.py v2.3.6 dev-dev-37-c0e0fd2d dev-dev-40-6936018e dev-dev-39-1e83a9ca dev-dev-38-b0f42f5f 2025-10-13 20:41:21 +02:00
Dries Peeters 50f36614e5 Merge pull request #84 from DRYTRIX/develop
feat: Add HTTPS support with mkcert and automatic SSL configuration
2025-10-13 20:00:47 +02:00
Dries Peeters 94e8e49439 feat: Add HTTPS support with mkcert and automatic SSL configuration
Add comprehensive HTTPS support with two deployment options:
- mkcert for local development with trusted certificates
- Automatic SSL with Let's Encrypt for production

HTTPS Implementation:
- Add docker-compose.https-mkcert.yml for local HTTPS development
- Add docker-compose.https-auto.yml for automatic SSL certificates
- Create Dockerfile.mkcert for certificate generation
- Add setup scripts (setup-https-mkcert.sh/bat)
- Add startup scripts (start-https.sh/bat)
- Add certificate generation script (generate-mkcert-certs.sh)

CSRF and IP Access Fixes:
- Fix CSRF token validation for IP-based access
- Add CSRF troubleshooting documentation
- Update configuration to handle various access patterns

Documentation:
- Add HTTPS_MKCERT_GUIDE.md with setup instructions
- Add README_HTTPS.md with general HTTPS documentation
- Add README_HTTPS_AUTO.md for automatic SSL setup
- Add AUTOMATIC_HTTPS_SUMMARY.md
- Add CSRF_IP_ACCESS_FIX.md and CSRF_IP_FIX_SUMMARY.md
- Add docs/CSRF_IP_ACCESS_GUIDE.md
- Update main README.md with HTTPS information

Configuration:
- Update .gitignore for SSL certificates and nginx configs
- Update env.example with new HTTPS-related variables
- Update docker-compose.yml with SSL configuration options

This enables secure HTTPS access in both development and production
environments while maintaining compatibility with existing deployments.
2025-10-13 18:32:45 +02:00
Dries Peeters 128b3c2449 Merge pull request #83 from DRYTRIX/develop
Develop
v2.3.5 dev-dev-36-94e8e494
2025-10-13 13:19:19 +02:00
Dries Peeters e61c628526 feat: enhance CSRF protection with double-submit cookie pattern
Implement comprehensive CSRF token management with cookie-based
double-submit pattern to improve security and SPA compatibility.

Changes:
- Add CSRF cookie configuration in app/config.py
  * WTF_CSRF_SSL_STRICT for strict SSL validation in production
  * CSRF_COOKIE_NAME (default: XSRF-TOKEN) for framework compatibility
  * CSRF_COOKIE_SECURE inherits from SESSION_COOKIE_SECURE by default
  * CSRF_COOKIE_HTTPONLY, CSRF_COOKIE_SAMESITE, and CSRF_COOKIE_DOMAIN settings

- Implement CSRF cookie handler in app/__init__.py
  * Set CSRF token in cookie after each request
  * Configure cookie with secure flags based on environment settings
  * Support for double-submit pattern and SPA frameworks

- Add client-side CSRF token management in base.html
  * JavaScript utilities for token retrieval and validation
  * Cookie synchronization for frameworks that read XSRF-TOKEN
  * Auto-refresh mechanism for stale tokens (>15 minutes)
  * Pre-submit token validation and refresh
  * User notification for missing cookies/tokens

- Clean up docker-compose.yml environment variables
  * Remove redundant SECRET_KEY, WTF_CSRF_*, and cookie security settings
  * These are now managed through .env files and config.py

This enhancement provides better CSRF protection while maintaining
compatibility with modern JavaScript frameworks and SPA architectures.
2025-10-13 12:51:23 +02:00
Dries Peeters f2160df62e Merge branch 'develop' of https://github.com/drytrix/TimeTracker into develop 2025-10-12 22:12:11 +02:00
Dries Peeters 57c80ff685 fix(calendar): resolve loading state issues and improve user experience
- Fix infinite recursion error in showToast function by removing duplicate local definition
- Implement dynamic calendar legend that updates with actual project names and colors
- Add comprehensive button state management to prevent stuck "Processing..." states
- Implement immediate loading state clearing for all calendar actions (create, update, delete, duplicate)
- Add resetAllButtonStates() function to handle button state cleanup
- Remove delays in loading state transitions for better responsiveness
- Add error handling and logging for calendar events loading
- Ensure loading states are cleared on both success and error scenarios
- Add global reset function for manual button state recovery
- Improve loadTasksForProject error handling and null checks

Fixes:
- Calendar legend showing static placeholders instead of dynamic project data
- Buttons stuck in "Processing..." state after successful actions
- Loading states persisting for 2-3 seconds after completion
- Recursion errors in toast notification system
- Inconsistent button state management across calendar operations
2025-10-12 22:11:51 +02:00
Dries Peeters 568e22f8d4 Merge pull request #82 from DRYTRIX/develop
Develop
v2.3.4 dev-dev-35-e61c6285 dev-dev-34-f2160df6
2025-10-12 22:05:31 +02:00
Dries Peeters d623164895 Update setup.py 2025-10-12 21:52:31 +02:00
Dries Peeters 0910544583 fix(csrf): harden forms; enforce SECRET_KEY; improve client refresh
- CSRF error handler:
  - Treat classic form POSTs as HTML (flash + safe redirect) regardless of
    Accept header quirks; return JSON only for XHR/JSON requests
  - Add contextual logging (path, method, referrer, user, reason) for diagnostics
- Security/config:
  - Enforce strong SECRET_KEY in production (no placeholders, min length);
    refuse startup if invalid
  - Make SESSION_COOKIE_SAMESITE and REMEMBER_COOKIE_SAMESITE env-driven
    while keeping Secure/HttpOnly flags configurable
- Client resilience:
  - Refresh CSRF token on window focus in addition to periodic refresh
  - Pre-submit refresh if token is stale (>15 minutes)
  - Auto-inject/refresh tokens for dynamically added forms via MutationObserver
- UX correctness:
  - Ensure tasks.edit_task re-renders with projects/users on validation errors

Fixes #77 (csrf_token_missing_or_invalid)
See: https://github.com/DRYTRIX/TimeTracker/issues/77

Files:
- app/__init__.py
- app/config.py
- app/templates/base.html
- app/routes/tasks.py

Note: In production, a single, persistent SECRET_KEY is required across all instances.
2025-10-12 21:46:32 +02:00
Dries Peeters c06b96945a Merge pull request #81 from DRYTRIX/develop
Updated the dockerfile.
v2.3.3 dev-dev-33-d6231648 dev-dev-32-09105445
2025-10-11 21:21:53 +02:00
Dries Peeters 73f8c25de9 Update migration-check.yml 2025-10-11 21:08:35 +02:00
Dries Peeters ae710e60f0 Updated the dockerfile. 2025-10-11 20:55:54 +02:00
Dries Peeters 21849fe5d3 Merge pull request #80 from DRYTRIX/develop
Update migration-check.yml
dev-dev-30-ae710e60 v2.3.2 dev-dev-29-b2a33bfd dev-dev-31-73f8c25d
2025-10-11 20:34:34 +02:00
Dries Peeters b2a33bfdb7 Update migration-check.yml 2025-10-11 20:29:04 +02:00
Dries Peeters 76c8862e13 Merge pull request #79 from DRYTRIX/develop
Develop
dev-dev-28-4c4e29e9
2025-10-11 20:21:27 +02:00