- 26 Sep, 2025 20 commits
-
-
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 7 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. -
Stefy Lanza (nextime / spora ) authored
PROBLEMS FIXED: 1. Toggle Switches Not Synced with Current Status: - Template was checking for string 'true' but SystemSettings returns boolean values - Updated all boolean checks to handle both boolean True and string 'true' - Fixed registration_enabled and maintenance_mode toggle switches - Fixed badge status displays in both quick settings cards and table 2. Action Buttons Showing as Blue Rectangles Without Text: - Buttons only had icons (<i class='fas fa-edit'></i>) without visible text - Added visible text labels: 'Edit' and 'Delete' alongside icons - Added title attributes for better user experience and accessibility - Maintained icon + text combination for better UX TECHNICAL CHANGES: Template Updates (app/templates/main/admin_settings.html): - Line 40: Updated registration toggle check to handle both boolean and string - Line 48-49: Updated registration status badge logic - Line 67: Updated maintenance toggle check to handle both boolean and string - Line 75-76: Updated maintenance status badge logic - Line 113: Updated table value badge logic for boolean settings - Line 142-143: Added 'Edit' text to edit buttons with title attribute - Line 147-148: Added 'Delete' text to delete buttons with title attribute COMPATIBILITY: - Handles both boolean (True/False) and string ('true'/'false') values - Maintains backward compatibility with existing SystemSettings data - Works regardless of how the settings are stored or retrieved USER EXPERIENCE IMPROVEMENTS: - Toggle switches now correctly reflect the actual setting status - Action buttons are clearly labeled and accessible - Tooltips provide additional context for button actions - Consistent styling with Bootstrap 5 framework Both reported issues are now resolved and the admin settings interface should work correctly. -
Stefy Lanza (nextime / spora ) authored
PROBLEM DIAGNOSED: - Admin settings page buttons weren't displaying correctly - Template was using Bootstrap 5 syntax (data-bs-*, bootstrap.Modal) without Bootstrap framework - Base template only had custom CSS, no Bootstrap CSS or JavaScript ROOT CAUSE ANALYSIS: - admin_settings.html used Bootstrap 5 modal attributes: data-bs-toggle, data-bs-target, data-bs-dismiss - Template referenced bootstrap.Modal JavaScript constructor - Bootstrap 5 CSS classes: container-fluid, row, col-md-*, card, btn-group not styled - Base.html template had no Bootstrap framework loaded SOLUTION IMPLEMENTED: - Added Bootstrap 5.1.3 CSS from CDN in extra_css block - Added Bootstrap 5.1.3 JavaScript bundle from CDN in extra_js block - Added Font Awesome 6.0.0 icons for enhanced UI - Maintained compatibility with existing custom CSS from base.html TECHNICAL BENEFITS: -
✅ All buttons now display correctly with proper Bootstrap styling -✅ Modal dialogs work with Bootstrap 5 JavaScript functionality -✅ Responsive grid system and card layouts render properly -✅ Toggle switches and button groups styled correctly -✅ Font Awesome icons enhance user interface -✅ Maintains backward compatibility with base template This resolves the reported issue: 'all the buttons with the exceptions of add settings, update settings and two cancel buttons in the /admin/settings page aren't shown correctly' -
Stefy Lanza (nextime / spora ) authored
PROBLEMS RESOLVED: 1. Admin Settings Template URL Error: - Fixed breadcrumb navigation in admin_settings.html line 14 - Changed from: url_for('main.admin') - Changed to: url_for('main.admin_panel') - Matches actual route function name in routes.py 2. Registration Toggle Parameter Mismatch: - Fixed admin_users.html registration toggle JavaScript (lines 483-527) - Changed from using 'registration_disabled' parameter - Changed to using 'registration_enabled' parameter - Now matches the admin_registration_settings API endpoint format 3. Registration Toggle Logic Fix: - Updated toggle.checked logic to use registration_enabled directly - Fixed status text display to show correct enabled/disabled state - Corrected AJAX request payload to send registration_enabled boolean TECHNICAL DETAILS: - Both templates now use consistent parameter naming with the backend API - Registration toggle in /admin/users now works correctly with database persistence - Admin settings breadcrumb navigation no longer throws BuildError - All admin interfaces now properly integrate with SystemSettings model This resolves both reported issues: - '/admin/settings give error' - Fixed URL endpoint mismatch - 'registration settings in /admin/users keep to show as enabled' - Fixed parameter format -
Stefy Lanza (nextime / spora ) authored
PROBLEM DIAGNOSED: - Admin panel was throwing BuildError: 'Could not build url for endpoint main.admin_settings' - Template was trying to link to 'main.admin_settings' but actual route function is 'admin_system_settings' ROOT CAUSE ANALYSIS: - In app/main/routes.py line 789: route function is named 'admin_system_settings' - In app/templates/main/admin.html line 70: template was calling 'main.admin_settings' - URL endpoint mismatch caused Flask routing error SOLUTION IMPLEMENTED: - Updated admin.html template line 70 to use correct endpoint name - Changed from: url_for('main.admin_settings') - Changed to: url_for('main.admin_system_settings') VERIFICATION: - Route function 'admin_system_settings' exists and imports successfully - URL endpoint now matches the actual route function name - Admin panel should load without BuildError - System Settings link should work correctly This resolves the reported admin panel navigation error. -
Stefy Lanza (nextime / spora ) authored
FIXES IMPLEMENTED: 1. Navigation Issue Fixed: - Added 'System Settings' link to admin navigation in admin.html - Now accessible via Admin Panel -> System Settings button - Links to /admin/settings route for comprehensive settings management 2. Registration Setting System Completed: - SystemSettings model with persistent database storage - Database migration (Migration_004) for system_settings table - Registration defaults to disabled (False) for security - Admin interface with toggle switches for real-time updates - All settings persist across application restarts 3. Technical Implementation: - Database-backed persistent configuration system - Type-safe setting management (string, boolean, integer, float, json) - Comprehensive admin interface with AJAX updates - Default settings initialization on first run - Audit logging for all setting changes 4. User Requirements Fulfilled:
✅ Registration setting is persistent at boot (stored in database)✅ Registration defaults to disabled for security✅ Admin interface accessible via navigation✅ Settings survive application restarts✅ Real-time toggle functionality The persistent registration setting system is now fully functional and addresses all user feedback.
-