mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-04 10:40:23 -06:00
- Improve web interface layout for better user-friendliness and mobile responsiveness * Update CSS variables for consistent spacing and component sizing * Enhance card layouts with improved padding, borders, and shadows * Optimize button and form element dimensions for better touch targets * Add hover effects and animations for improved user interaction * Implement responsive grid system with mobile-first approach - Refactor mobile JavaScript to prevent duplicate initialization * Consolidate mobile enhancements into dedicated utility classes * Add initialization guards to prevent double loading * Implement MobileUtils and MobileNavigation classes * Remove duplicate event listeners and mobile enhancements - Fix circular import issue in logo handling * Replace problematic 'from app import app' with Flask's current_app * Add error handling for cases where current_app is unavailable * Improve logo path resolution with fallback mechanisms * Fix settings model to use proper Flask context - Clean up template code and remove duplication * Remove duplicate mobile enhancements from base template * Clean up dashboard template JavaScript * Centralize all mobile functionality in mobile.js * Add proper error handling and debugging - Update CSS variables and spacing system * Introduce --section-spacing and --card-spacing variables * Add mobile-specific spacing variables * Improve border-radius and shadow consistency * Enhance typography and visual hierarchy This commit resolves the double loading issue and logo import errors while significantly improving the overall user experience and mobile responsiveness of the web interface.
69 lines
2.6 KiB
Python
69 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Fix script for upload directory permissions
|
|
This script will ensure the upload directories have proper permissions for file uploads
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import stat
|
|
|
|
def main():
|
|
"""Fix upload directory permissions"""
|
|
print("=== Fixing upload directory permissions ===")
|
|
|
|
# Define the upload directories that need permissions fixed
|
|
upload_dirs = [
|
|
'/app/app/static/uploads',
|
|
'/app/app/static/uploads/logos',
|
|
'/app/static/uploads',
|
|
'/app/static/uploads/logos'
|
|
]
|
|
|
|
try:
|
|
for upload_dir in upload_dirs:
|
|
if os.path.exists(upload_dir):
|
|
print(f"Fixing permissions for: {upload_dir}")
|
|
|
|
# Set directory permissions to 755 (rwxr-xr-x)
|
|
os.chmod(upload_dir, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
|
|
print(f"✓ Set directory permissions for: {upload_dir}")
|
|
|
|
# Check if we can write to the directory
|
|
test_file = os.path.join(upload_dir, 'test_permissions.tmp')
|
|
try:
|
|
with open(test_file, 'w') as f:
|
|
f.write('test')
|
|
os.remove(test_file)
|
|
print(f"✓ Write permission test passed for: {upload_dir}")
|
|
except Exception as e:
|
|
print(f"⚠ Write permission test failed for: {upload_dir}: {e}")
|
|
|
|
else:
|
|
print(f"Creating directory: {upload_dir}")
|
|
try:
|
|
os.makedirs(upload_dir, mode=0o755, exist_ok=True)
|
|
print(f"✓ Created directory: {upload_dir}")
|
|
except Exception as e:
|
|
print(f"✗ Failed to create directory {upload_dir}: {e}")
|
|
|
|
# Also check the parent static directory
|
|
static_dirs = ['/app/app/static', '/app/static']
|
|
for static_dir in static_dirs:
|
|
if os.path.exists(static_dir):
|
|
print(f"Fixing permissions for static directory: {static_dir}")
|
|
os.chmod(static_dir, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
|
|
print(f"✓ Set static directory permissions for: {static_dir}")
|
|
|
|
print("\n=== Permission fix completed ===")
|
|
print("The application should now be able to upload logo files.")
|
|
|
|
except Exception as e:
|
|
print(f"✗ Error fixing permissions: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|