Commit Graph

584 Commits

Author SHA1 Message Date
João Vitória Silva
dc3b3017d2 Add Cardio training activity type support
Introduces 'Cardio training' as a new activity type (ID 41) across backend and frontend. Updates activity mappings, enums, goal logic, UI components, and i18n files to support the new type. Also fixes goal list initialization in SettingsUserGoals.vue.
2025-11-14 22:16:36 +00:00
João Vitória Silva
ec44a4473f Add Slovenian language support and bump version to 0.15.7
Introduces Slovenian (SL) as a supported language across backend and frontend, including language enum, language switchers, and i18n resources. Updates documentation to credit the contributor, and increments version numbers in backend and frontend to 0.15.7.
2025-11-14 21:45:20 +00:00
João Vitória Silva
d193011793 Bump version to v0.15.6 2025-11-03 11:27:27 +00:00
João Vitória Silva
24b509f398 Add BinaryFileCategory enum and update zip inspector
Introduces the BinaryFileCategory enum to categorize binary file extensions, starting with fitness files (e.g., '.fit'). Updates the ZipContentInspector to skip script content checks for files with extensions in BinaryFileCategory, improving handling of binary files in zip archives.
2025-10-31 15:56:27 +00:00
João Vitória Silva
d1b35b754c Make max files of same type in ZIP configurable
Added max_number_files_same_type to SecurityLimits in config.py and updated zip_inspector.py to use this configurable limit instead of a hardcoded value when checking for excessive files of the same type in ZIP archives.
2025-10-31 15:44:22 +00:00
João Vitória Silva
35c1210c89 Configure custom file security limits for validator
Sets a custom SecurityLimits instance with a 2GB max uncompressed size and applies it to the FileValidator configuration.
2025-10-31 15:35:27 +00:00
João Vitória Silva
1ea947e7b3 Use batch_size for max items per export file
Replaces the hardcoded value of 500 for max_items_per_file with the batch_size parameter, allowing dynamic control over the number of items per export file.
2025-10-31 14:58:02 +00:00
João Vitória Silva
d3e412604b Add treadmill sport type & bump version 2025-10-31 11:56:11 +00:00
João Vitória Silva
a8b64e0a9c Bump version to v0.15.4 2025-10-31 11:27:33 +00:00
João Vitória Silva
19d4b2ea5a Pass user_is_owner flag to activity fetch
Added the user_is_owner=True argument when fetching activities to ensure correct filtering or permissions are applied during export.
2025-10-30 17:10:24 +00:00
João Vitória Silva
6b93384428 Refactor config and update MariaDB to Postgres migration docs
Refactored backend/app/core/config.py to simplify and clarify docstrings and comments, improving readability and maintainability. Updated the MariaDB to Postgres migration guide to use Endurain's built-in export/import functionality instead of pgloader, providing a more user-friendly migration process. Removed obsolete pgloader migration files and transformation scripts.
2025-10-28 15:56:16 +00:00
João Vitória Silva
9fbd86a8a2 Add and update docstrings for profile services and schema
Added or revised concise, PEP 257-compliant docstrings for all public classes and methods in profile export/import services, router endpoints, exceptions, and MFA schema. Updated docstring formats to match new repository guidelines, clarified argument and return value descriptions, and removed extended explanations and examples. Also updated .github/copilot-instructions.md with new Python code style and docstring requirements.
2025-10-28 15:33:22 +00:00
João Vitória Silva
05dfdab788 Refactor export/import services for batch size and streaming
Reduced default batch sizes in both ExportPerformanceConfig and ImportPerformanceConfig for improved memory efficiency. Refactored ExportService to stream data directly to the ZIP archive in batches, writing each data type progressively instead of collecting all data in memory first. Updated activity component collection to support chunked writing for large datasets, and removed excessive inline documentation for clarity and maintainability. ImportPerformanceConfig tier batch sizes were also adjusted to match the new export logic.
2025-10-28 14:59:28 +00:00
João Vitória Silva
ab1a30234b Reverted ijson and in-memory streaming for activity import
Reverted the use of ijson and streaming batch parsing for large activity component files with standard in-memory JSON loading. Updates the import logic to filter activity components per activity after loading all data, and removes ijson from dependencies.
2025-10-28 12:36:37 +00:00
João Vitória Silva
cbd05255cb Optimize import service for large JSON files with streaming
Refactored the import_service to use streaming JSON parsing (via ijson) for large files, reducing memory usage during import operations. Updated method signatures and logic to process data in batches and load one data type at a time. Adjusted batch sizes in both import and export configs for all memory tiers. Added ijson as a dependency.
2025-10-28 11:32:47 +00:00
João Vitória Silva
e26da00608 Refactor file security config and enums for clarity
Refactored file_security/config.py and enums.py to improve documentation, type annotations, and code clarity. Expanded exception imports and public API in __init__.py, removed deprecated utils.py, and updated configuration validation to use standard logging. Enhanced enum docstrings and structure for better maintainability.
2025-10-27 18:50:53 +00:00
João Vitória Silva
cf5ee1edd2 Remove legacy file_security.py and update related modules
Deleted backend/app/core/file_security.py and refactored related modules to remove dependencies on the legacy file security implementation. This streamlines the file security logic and ensures all validation is handled by the updated modular components.
2025-10-24 10:44:31 +01:00
João Vitória Silva
fce144be7d Refactor file security into modular package
Split file_security.py into a modular package with separate config, enums, exceptions, validators, inspectors, and utility modules. Added deep ZIP content inspection and threat categorization, improved configuration validation, and enhanced extensibility for file security checks.
2025-10-23 14:01:12 +01:00
João Vitória Silva
90d10b3078 Add comprehensive file security validation module
Introduces backend/app/core/file_security.py, providing advanced file validation for uploads including extension, MIME type, Unicode, and ZIP compression checks. Integrates security validation into profile image and data upload endpoints in router.py, refactors import/export service and exception imports, and updates profile/schema.py to support secure MFA secret storage. Dependency configuration updated in pyproject.toml.
2025-10-23 11:51:05 +01:00
João Vitória Silva
3c4642d918 Remove unused imports and add docstrings to MFA schema
Eliminated unused 'psutil' imports from export_service.py and import_service.py. Added detailed docstrings to all classes and methods in schema.py for improved code documentation and clarity.
2025-10-22 15:50:24 +01:00
João Vitória Silva
b28ecfe969 Refactor import/export config to use shared base class
Introduced BasePerformanceConfig in utils.py to centralize common configuration logic for import and export services. Both ExportPerformanceConfig and ImportPerformanceConfig now inherit from this base class and use a unified memory tier detection and auto-configuration pattern, reducing code duplication and improving maintainability.
2025-10-22 15:31:28 +01:00
João Vitória Silva
b7a7855413 Refactor import/export services to use shared utils
Moved memory usage, timeout, and operation count logic from import_service.py and export_service.py into profile/utils.py for reuse and maintainability. Updated both services to use the new utility functions, removed duplicated code, and split file/media import logic in ImportService for clarity. Also adjusted default memory and timeout settings for consistency.
2025-10-22 15:13:02 +01:00
João Vitória Silva
5930851541 Enhance profile import/export error handling
Refactored custom exceptions to support both import and export operations, added granular import error types, and unified error-to-HTTP mapping in handle_import_export_exception. Updated import service to use new exceptions for file size, format, structure, activity limits, and memory allocation. Router now handles new import exceptions and provides more specific HTTP responses and logging for import errors. Import performance config defaults and auto-detection logic were also updated for better resource management.
2025-10-22 11:35:32 +01:00
João Vitória Silva
9f88249266 Add ImportService for profile data import
Introduces backend/app/profile/import_service.py, implementing ImportService for importing user profile data from ZIP archives. Refactors router.py to use ImportService, removing legacy import logic and unused imports, and streamlining the import endpoint for maintainability and performance.
2025-10-22 10:39:53 +01:00
João Vitória Silva
5e2a03065d Fix user data import to handle list structure
Updated import_profile_data to correctly access user data as a list, ensuring the user ID and photo path are set for the first element. This resolves issues when importing user JSONs structured as lists.
2025-10-21 22:25:17 +01:00
João Vitória Silva
a3ed972d0b Merge branch 'feature-docker-secrets' into pre-release 2025-10-21 22:06:06 +01:00
João Vitória Silva
283ec59293 Optimize export service with performance config and batching
Introduces ExportPerformanceConfig for adaptive performance tuning based on system memory, including batch size, memory limits, and compression level. Refactors ExportService to use batched data collection for activities and components, adds memory usage monitoring, and optimizes user image export with efficient directory traversal and file size checks. Improves error handling and logging throughout the export process.
2025-10-21 17:22:06 +01:00
João Vitória Silva
752708e9d5 Improve error handling in profile export service
Introduces custom exceptions for profile export operations and refactors export_service.py to use granular error handling for data collection and file operations. Updates router.py to catch and handle these exceptions, providing more informative HTTP responses for different failure scenarios during profile data export.
2025-10-21 16:28:21 +01:00
João Vitória Silva
744389df25 Refactor profile export logic into ExportService
Moved profile data export functionality from router.py into a new ExportService class for better modularity and maintainability. Added utility functions for SQLAlchemy object serialization and ZIP writing to utils.py. Improved error handling for MFA secret encryption/decryption. The export endpoint now uses ExportService to generate the ZIP archive, simplifying the router and centralizing export logic.
2025-10-21 16:06:49 +01:00
João Vitória Silva
f1a988d231 Remove unnecessary log 2025-10-21 14:44:22 +01:00
João Vitória Silva
d265be67bc Add Docker secrets support for sensitive env vars
Introduces secure reading of sensitive environment variables (DB_PASSWORD, SECRET_KEY, FERNET_KEY) via _FILE variants for Docker secrets. Updates backend to use new read_secret utility, adds validation for Fernet keys, and documents usage in advanced setup guide. Bumps version to 0.15.3 and provides a docker-compose secrets example.
2025-10-21 14:39:36 +01:00
João Vitória Silva
8fc36444bf Refactor Strava gear import and update integration docs
Improved formatting and readability in Strava gear import utilities and router, including better line breaks and removal of redundant blank lines. Updated documentation for Strava and Garmin Connect integrations, clarifying import instructions and reorganizing integration details for clarity.
2025-10-20 10:29:51 +01:00
João Vitória Silva
5366983743 Bump version to v0.15.2 and improve CSV import
Updated backend and frontend version numbers to v0.15.2. Improved Strava shoes CSV import by specifying UTF-8 encoding, fixing error message formatting, and simplifying error handling logic.
2025-10-20 10:18:55 +01:00
Marc @PDev1 server
b6f19b55ff Merge branch 'master' into shoe import code to update shoe import code to v0.15.1 2025-10-18 19:49:54 +00:00
João Vitória Silva
eca0e2df8f Merge branch 'copilot/fix-gpx-import-error' into pre-release 2025-10-15 13:02:10 +01:00
João Vitória Silva
fa46d0494d Refactor GPX parsing for clarity and robustness
Improved readability of activity name and description assignment with clearer multi-line expressions. Enhanced extension parsing by ensuring 'power' and 'heart_rate' values are always integers, defaulting to 0 if missing, to prevent type errors.
2025-10-15 13:01:43 +01:00
João Vitória Silva
d1c7016741 Merge branch 'pr/375' into pre-release 2025-10-15 12:48:47 +01:00
João Vitória Silva
73d7a1a2e4 Add Galician language support
Introduces Galician (gl) as a supported language across backend and frontend. Updates language enums, language switchers, user profile, signup, and user modal components. Also updates documentation and version numbers to 0.15.1.
2025-10-15 12:48:42 +01:00
Boris Stäheli
901b80fc48 Refactor heart rate extraction for Tissot smartwatch to handle missing values 2025-10-15 12:19:23 +02:00
Boris Stäheli
9ddf53f904 Add support for heart rate extraction from GPX files from Tissot Smart Watches 2025-10-15 12:05:47 +02:00
copilot-swe-agent[bot]
fb81e75fa0 Add validation for GPX files with no valid time data
Co-authored-by: joaovitoriasilva <8648976+joaovitoriasilva@users.noreply.github.com>
2025-10-11 14:42:43 +00:00
copilot-swe-agent[bot]
aa231850f8 Fix GPX import: skip trackpoints without time data
Co-authored-by: joaovitoriasilva <8648976+joaovitoriasilva@users.noreply.github.com>
2025-10-11 14:40:35 +00:00
Marc @PDev1 server
e05cf0af00 Cleaning up comments and log entries of shoe importing code. 2025-10-07 20:25:57 +00:00
Marc @PDev1 server
4d05feba0c Updating with v0.15 code, updating docs to reflect new shoe import procedure. 2025-10-07 20:15:18 +00:00
João Vitória Silva
2c193203d6 Normalize username and email to lowercase on user forms
User creation and editing now convert usernames and emails to lowercase in frontend forms and backend logic to ensure consistency and prevent duplicate accounts with case variations. Birthdate is also converted to ISO format during migration for data uniformity.
2025-10-05 21:24:58 +01:00
Marc @PDev1 server
7f389b6fcb Updating gear import and duplicate checking routines for error found in issue 361 and discussion in #285. 2025-10-05 18:07:35 +00:00
Marc @PDev1 server
1eb54a6a91 Fixing issue 361 - crash on import due to mis-named variable in strava/gear_utils and fixing duplicate or blank import error due to errors in duplicate checking routine in gear/crud.py 2025-10-05 17:57:59 +00:00
João Vitória Silva
1a9d15b3cf Validate user data with schema in migration 6
Introduces validation of user data using the UserRead schema before editing users in migration_6.py. This ensures data consistency and leverages Pydantic validation during the migration process.
2025-10-04 22:15:53 +01:00
João Vitória Silva
b04f0c0c4b Update migration to lowercase usernames instead of nicknames
Changed migration logic and description to lowercase the 'username' field for users instead of 'nickname'. This ensures consistency with the intended schema update.
2025-10-04 22:12:22 +01:00
João Vitória Silva
50900205da Add migration to lowercase user nicknames
Introduces migration 6 to convert all user nicknames to lowercase. Updates Alembic migration to register and unregister migration 6 in the migrations table. Integrates migration 6 execution into the migration utility.
2025-10-04 22:08:16 +01:00