- 27 Sep, 2025 1 commit
-
-
Stefy Lanza (nextime / spora ) authored
-
- 26 Sep, 2025 24 commits
-
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
- Added CSRF exemption to all JWT-authenticated API endpoints - API routes use JWT tokens, not session cookies, so CSRF protection is not needed
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
- Change import to from flask_wtf.csrf import csrf_exempt - Replace @csrf.exempt with @csrf_exempt decorators
-
Stefy Lanza (nextime / spora ) authored
- Initialize CSRFProtect in app/__init__.py - Update import in app/upload/routes.py from flask_wtf.csrf to flask_wtf - Maintain existing @csrf.exempt decorators
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
- Improved FileLike class with proper file handling and close() method - Added better error handling and validation for JSON input - Added try/finally block to ensure file handles are closed - Added detailed error logging with traceback for debugging - Ensures server always returns JSON instead of HTML error pages
-
Stefy Lanza (nextime / spora ) authored
- Error message now shows correct maximum file size from database setting - Consistent with other validation functions using the same setting
-
Stefy Lanza (nextime / spora ) authored
- validate_file_size() now uses database setting instead of MAX_CONTENT_LENGTH - detect_malicious_content() uses database setting for size limits - Both functions now respect the configurable max_upload_size_mb (default 2048MB = 2GB)
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
- Explicitly set MAX_CONTENT_LENGTH in Flask app config during initialization - Add logging to verify MAX_CONTENT_LENGTH is set correctly - Fixes 'File too large' error for files over 500MB (now supports 5GB)
-
Stefy Lanza (nextime / spora ) authored
- Add seek(), tell(), read() methods to FileLike class - Add content_type attribute for validation - Fixes 'FileLike object has no attribute seek' error in chunked uploads
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
- Fix FileLike object to have proper filename attribute for validation - Implement parallel chunk uploading (3 concurrent chunks) to speed up uploads - Update all templates with improved chunking logic - Fixes validation error and slow upload performance
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
- Add chunking JavaScript to fixture_detail.html for individual match uploads - Add chunking JavaScript to fixture_detail.html for fixture-level bulk uploads - Add chunking JavaScript to match_detail.html for match ZIP uploads - All ZIP uploads now use 1MB chunks instead of uploading entire files at once - Fixes issue where large ZIP files would fail due to memory/timeouts
-
Stefy Lanza (nextime / spora ) authored
-
- 26 Aug, 2025 5 commits
-
-
Stefy Lanza (nextime / spora ) authored
- Add Migration_007_AddDoneToStatusEnum class - Safely adds 'done' to existing status ENUM if not present - Handles databases created before 'done' status was added - Includes proper rollback support - Update README and CHANGELOG with migration details
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
- Updated set_active() method to require status='pending' in addition to ZIP upload completion - Added comprehensive documentation for new active status criteria - Updated CHANGELOG.md with version 1.2.3 details - Enhanced README.md with active status requirements documentation Active status now requires: 1. ZIP upload status = 'completed' 2. ZIP checksum present 3. Match status = 'pending' This provides more precise control over match activation workflow.
-
Stefy Lanza (nextime / spora ) authored
- Add status column to matches table with 8 enum values (pending, scheduled, bet, ingame, cancelled, failed, paused, done) - Create Migration_006_AddStatusColumn for database schema updates - Update Match model to include status field with proper enum validation - Enhance match detail template to display status information - Improve configuration auto-migration system for persistent directories - Update README and CHANGELOG with version 1.2.3 documentation - Maintain backward compatibility with existing matches
-
Stefy Lanza (nextime / spora ) authored
- Add status column to matches table with enum values (pending, scheduled, bet, ingame, cancelled, failed, paused, done) - Implement database migration 006 for status tracking - Update Match model with status field and validation - Enhance match detail template to display status information - Update documentation (README and CHANGELOG) for v1.2.3 - Enable comprehensive match lifecycle management
-
- 21 Aug, 2025 8 commits
-
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
Delete prompt.txt See merge request !1
-
Moses authored
-
Stefy Lanza (nextime / spora ) authored
- Fixed critical bug where both fighter1 and fighter2 were incorrectly sourced from fighter1 column during XLSX uploads - Enhanced FixtureParser.detect_required_columns() with fighter-specific matching logic in app/upload/fixture_parser.py - Added proper fighter number detection (1 or 2) to prevent cross-mapping during partial column matching - Fighter1 columns now correctly map to fighter1 database field, Fighter2 to fighter2 field - Prevents false positives where 'fighter2' column incorrectly matched 'fighter1' field - Root cause: Original partial matching used split()[0] causing both 'fighter 1' and 'fighter 2' to become 'fighter' - Solution: Implemented specific logic checking for both 'fighter' keyword AND number in column names - Updated documentation (README.md, CHANGELOG.md) with bug fix details and version bump to v1.2.2 - Maintains backward compatibility with existing column naming conventions
-
Stefy Lanza (nextime / spora ) authored
- Fixed import error for get_persistent_directories (renamed to get_config_directory) - Fixed TypeError with classmethod call during class definition - Added config directory support to directory utilities - Enhanced configuration loading with proper function structure - Ensured all persistent directories are created during setup
-
Stefy Lanza (nextime / spora ) authored
## Cross-Platform PyInstaller Support - Implemented persistent directory system for Windows (%APPDATA%), macOS (~/Library/Application Support), and Linux (/opt/MBetter) - Added PyInstaller environment detection and automatic directory path optimization - Created comprehensive directory utilities (app/utils/directories.py) with fallback mechanisms - Enhanced configuration system to use persistent mbetterd.conf instead of .env for PyInstaller deployments ## Configuration System Enhancement - Added configuration file migration system (migrate_config.py) for .env to mbetterd.conf transition - Enhanced config.py with persistent config file loading and priority system (env vars > config file > defaults) - Automatic config file discovery in persistent directories with fallback to local .env ## Authenticated ZIP Downloads - Added new /api/download/zip/<match_id> endpoint with hybrid JWT/API token authentication - Enhanced /api/updates endpoint to use authenticated download URLs instead of web routes - Implemented access control ensuring users can only download their own match files (or admin access) - Updated API routes to use persistent ZIP_UPLOADS_DIR for file serving ## Upload System Enhancement - Modified file upload handlers to use persistent directories (ZIP_UPLOADS_DIR, FIXTURES_DIR, TEMP_DIR) - Enhanced upload file paths to use appropriate persistent directories based on file type - Updated main routes for ZIP downloads to use persistent directory paths - Fixed PyInstaller temporary directory issues ensuring files persist between application restarts ## Documentation Updates - Updated README.md with PyInstaller features, cross-platform compatibility, and authenticated downloads - Enhanced CHANGELOG.md with comprehensive v1.2.1 release notes - Added migration utility documentation and deployment instructions - Updated version numbers and platform compatibility information ## Technical Improvements - Enhanced error handling and logging throughout persistent directory operations - Added comprehensive fallback mechanisms for various deployment scenarios - Improved path handling with proper cross-platform directory structures - Security enhancements for API file downloads with proper authentication validation
-
Stefy Lanza (nextime / spora ) authored
## New Features - **New /api/updates endpoint**: Incremental fixture synchronization with optional timestamp filtering - Supports both GET (query params) and POST (JSON body) methods - Optional 'from' parameter for unix timestamp-based filtering - Returns fixtures updated after specified timestamp or last N fixtures - Includes ZIP download URLs in API response - Configurable default count via system settings - **Fixture active time tracking**: Automatic timestamp management - Added fixture_active_time column (BigInteger, indexed) to matches table - Automatic timestamp setting when all matches in fixture become active - Preserves original activation time (no overwrites) - **Hybrid authentication system**: Maximum compatibility - Supports JWT tokens (short-lived, from login) AND API tokens (long-lived, from web interface) - Tries JWT first, falls back to API tokens automatically - Multiple token header formats: Authorization Bearer, X-API-Token, query parameter - **SHA1-based ZIP file naming**: Consistent file naming - Uses SHA1 hash of (unix_timestamp + original_filename) - Applied across all upload methods for consistency ## Technical Implementation - **Database Migration_005**: Added fixture_active_time column with proper indexing - **System settings integration**: New api_updates_default_count setting (default: 10) - **Backfill utility**: backfill_fixture_times.py for existing fixture data migration - **Fallback mechanisms**: Graceful degradation for existing data without timestamps - **Query optimization**: Proper limits and ordering for both default and filtered queries ## Bug Fixes - Fixed logging import errors in models.py (get_logger function) - Python 2.7 compatibility fixes in migration scripts - Type conversion issues in SystemSettings.get_setting() ## Documentation - Created comprehensive CHANGELOG.md - Updated README.md with new endpoint documentation and examples - Added API usage examples for both GET and POST methods - Updated version to 1.2.0 with feature highlights ## Files Modified - app/api/routes.py: New /api/updates endpoint with hybrid auth - app/models.py: Added fixture tracking methods and backfill utility - app/database/migrations.py: Migration_005 for schema changes - backfill_fixture_times.py: Data migration utility for existing fixtures - README.md: Updated documentation and examples - CHANGELOG.md: Comprehensive change log following keep-a-changelog format
-
- 18 Aug, 2025 2 commits
-
-
Stefy Lanza (nextime / spora ) authored
-
Stefy Lanza (nextime / spora ) authored
USER REQUEST: 'in the fixture details page of the web interface after the list of matches a file upload button with progress bar to upload a zip file that will be associated with all the matches that doesn't have already one' IMPLEMENTATION COMPLETED: 1. Backend Route (app/upload/routes.py): - Added /upload/fixture/<fixture_id>/zip endpoint for fixture-level ZIP uploads - Filters matches by fixture_id and excludes those with existing ZIP files - Processes single ZIP upload and associates with all qualifying matches - Comprehensive error handling and database transaction management - Integration with existing file upload handler for large file support 2. Frontend Template (app/templates/main/fixture_detail.html): - Added fixture upload component after match list as requested - Progress bar with real-time upload tracking - Status messages and visual feedback for user experience - Conditional display - only shows when matches without ZIP files exist - Informational content explaining the bulk upload functionality 3. JavaScript Functionality: - AJAX upload with XMLHttpRequest for progress tracking - Real-time progress bar updates during file upload - Comprehensive error handling and recovery - Automatic file selection event handling - Status management with success/error states 4. Template Logic: - Filters matches to show only those without ZIP files - Groups matches by fixture_id for bulk operations - Conditional rendering based on upload eligibility - Integration with existing match display structure TECHNICAL FEATURES: -
✅ Bulk upload: One ZIP file associated with multiple matches -✅ Progress tracking: Real-time upload progress bar -✅ File filtering: Only affects matches without existing ZIP files -✅ Large file support: Up to 2GB with streaming capabilities -✅ Error handling: Network and upload error recovery -✅ User feedback: Clear status messages and visual indicators -✅ Database integrity: Transaction-based updates with rollback -✅ Memory optimization: Chunked upload processing TESTING VERIFICATION: - Route registration confirmed: POST /upload/fixture/<fixture_id>/zip - Template components verified: upload form, progress bar, status tracking - JavaScript functions confirmed: startFixtureUpload, updateFixtureProgress - File handler integration tested: large file support ready - Template logic verified: conditional display and match filtering The fixture-level ZIP upload feature is fully implemented and ready for use.
-