This commit introduces several enhancements across multiple files to improve maintainability, functionality, and overall code quality. Key updates are as follows:
1. .gitignore
• Added exclusion for kindle/data/* to prevent Kindle-specific data from being tracked.
2. Dockerfile
• Added installation of OpenMoji font:
• Downloads and unzips OpenMoji font to /usr/share/fonts/openmoji.
• Updates font cache with fc-cache.
• Verifies installation with fc-list | grep "OpenMoji".
• Improves container setup for rendering Kindle dashboards with proper font support.
3. compose.yml
• Port mapping now uses an environment variable ${HOST_PORT} instead of hardcoding 56733:80.
• Enhances flexibility for port management.
4. kindle/ascwebdash.py
• Significant refactoring and cleanup:
• Removed unused signal handling and daemonization logic.
• Simplified logging configuration and added optional arguments using argparse for flexibility.
• Abstracted repetitive paths using constants for maintainability.
• Consolidated functionality for fetching images and refreshing the screen.
• Removed unused Wi-Fi and GUI toggling code.
• Focused the script’s functionality on image fetching and display for Kindle extensions.
5. CSS (style.css)
• Removed visual debugging borders (red, green, yellow).
• Improved layout styles:
• Set fixed widths for better rendering of event columns.
• Adjusted margins and paddings for cleaner alignment.
• Added a new .day .events class for consistent padding.
6. views.py
• Added error handling when fetching calendar data:
• Ensures the application doesn’t crash if calendar URLs are inaccessible.
• Logs errors to console for debugging.
Impact:
• Maintainability: Refactored scripts, improved code structure, and enhanced readability.
• Flexibility: Environment variable support for ports and dynamic script arguments.
• Functionality: Added OpenMoji font support in the Docker container.
• UI/UX: Cleaned up CSS for better layout and appearance.
• Resilience: Improved error handling in views.py to handle calendar fetch failures gracefully.
Files Modified:
• .gitignore
• Dockerfile
• compose.yml
• kindle/ascwebdash/bin/asc-webdash.py
• server/app/templates/style.css
• server/app/views.py
This ensures better extensibility and robustness across the codebase.
Commit Message:
feat: Implement web calendar application with Flask, Docker, and calendar integration
Description:
1. Server Refactor:
• Moved application logic from main.py to a structured directory server/app/.
• Added server/app/__init__.py for Flask app initialization.
• Introduced server/app/views.py to handle routes (dashboard and dashboard_image).
• Created server/app/models.py for event modeling, supporting CalDAV and iCalendar events.
• Added server/app/weather.py to fetch weather data using OpenWeatherMap API.
2. New Features:
• Added an image generation route (/image) to render calendar views as BMP images.
• Integrated OpenWeatherMap API for weather data on the dashboard.
3. Environment and Configurations:
• Added a Dockerfile to build and deploy the app using uwsgi-nginx-flask.
• Introduced compose.yml for running the app with Docker Compose.
• Moved uwsgi.ini configuration to server/uwsgi.ini for modular organization.
4. Dependencies:
• Updated requirements.txt to include new dependencies: imgkit, pillow, and Werkzeug==2.2.2.
5. Static Assets:
• Added placeholder images out.png and test.png.
6. Code Cleanup:
• Removed old files (main.py and root-level uwsgi.ini).
• Updated .gitignore to include .idea/ folder.
Additional Notes:
• Enhanced event parsing to handle all-day and time-specific events using server/app/models.py.
• Utilized Flask’s render_template for dynamic HTML rendering and imgkit for HTML-to-image conversion.
• Integrated multiple calendar sources (CalDAV and public iCal feeds).
Let me know if you need further adjustments!