{"id":25015747,"url":"https://github.com/conjfrnk/charter-meals","last_synced_at":"2026-04-09T23:03:11.204Z","repository":{"id":274892723,"uuid":"923969742","full_name":"conjfrnk/charter-meals","owner":"conjfrnk","description":"Meal Signup for Princeton Charter Club","archived":false,"fork":false,"pushed_at":"2025-03-14T03:30:39.000Z","size":135,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T04:27:34.325Z","etag":null,"topics":["css","flask","html","httpd","javascript","openbsd","python","relayd","shell","sql","website"],"latest_commit_sha":null,"homepage":"https://chartermeals.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/conjfrnk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-29T06:57:47.000Z","updated_at":"2025-03-14T03:30:43.000Z","dependencies_parsed_at":"2025-01-30T01:19:50.434Z","dependency_job_id":"96609485-7367-4186-8a58-6e6355dffbd6","html_url":"https://github.com/conjfrnk/charter-meals","commit_stats":null,"previous_names":["conjfrnk/charter-meals"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conjfrnk%2Fcharter-meals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conjfrnk%2Fcharter-meals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conjfrnk%2Fcharter-meals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conjfrnk%2Fcharter-meals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conjfrnk","download_url":"https://codeload.github.com/conjfrnk/charter-meals/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285651,"owners_count":20752947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","flask","html","httpd","javascript","openbsd","python","relayd","shell","sql","website"],"created_at":"2025-02-05T08:31:43.890Z","updated_at":"2026-04-09T23:03:11.200Z","avatar_url":"https://github.com/conjfrnk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Charter Meals\n\n**Version:** 2.1.1\n\n[Charter Meals](https://chartermeals.com) is a web application for managing meal sign-ups for the [Princeton Charter Club](https://charterclub.org). This project is built with Flask and includes many features, as detailed below:\n\n## New in v2\n\n### Security \u0026 Performance Improvements\n- **Enhanced Input Validation**: All user inputs are now properly validated and sanitized\n- **Session Security**: 8-hour session timeout with automatic logout\n- **Database Security**: Improved error handling and connection management\n- **Rate Limiting**: Enhanced protection against brute force attacks\n- **Error Handling**: Comprehensive error handling with user-friendly messages\n- **Performance**: Optimized database queries and caching strategies\n\n### Future-Proofing Features\n- **Version Pinning**: All dependencies are now version-pinned for stability\n- **Database Migrations**: Improved migration system for schema updates\n- **Logging**: Enhanced logging for better debugging and monitoring\n- **Edge Case Handling**: Better handling of edge cases and error conditions\n\n## Features\n\n- **User Login:** Users sign in with their NetID and can reserve meals.\n- **Guest Login:** Limited-access guest login is available.\n- **Meal Sign-ups:** Users may sign up for meals (with limits to ensure fairness).\n- **Admin Dashboard:** Comprehensive admin interface for managing users, reservations, settings, and website content.\n- **Content Management:** Dynamic website content management through the admin interface.\n- **Semester Purge:** One-click semester cleanup functionality.\n- **CSV Downloads:** Reservation data is downloadable in CSV format.\n- **Responsive Design:** The interface works well on both desktop and mobile devices.\n- **Security \u0026 Performance:** Built-in CSRF protection, rate limiting, and a strict Content Security Policy.\n\n## Security Features\n\n### Authentication \u0026 Authorization\n- **Session Management**: 8-hour session timeout with automatic logout\n- **Input Validation**: All inputs are validated and sanitized\n- **CSRF Protection**: Built-in CSRF protection on all forms\n- **Rate Limiting**: Protection against brute force attacks\n- **Secure Headers**: Content Security Policy and other security headers\n\n### Data Protection\n- **Password Hashing**: All passwords are hashed using pbkdf2:sha256\n- **SQL Injection Protection**: Parameterized queries throughout\n- **XSS Protection**: Input sanitization and output encoding\n- **Session Security**: Secure, HTTP-only cookies with SameSite protection\n\n## Admin Instructions\n\n### Getting Started\n\n1. **Default Admin Account:**\n   - Username: `admin`\n   - Password: `admin`\n   - **Important:** Change this password immediately after first login\n\n2. **Accessing the Admin Dashboard:**\n   - Navigate to `/admin/login`\n   - Use your admin credentials to log in\n\n### Admin Dashboard Tabs\n\n#### 1. Reservations Tab\n- **Download CSV:** Download reservation data for specific weeks or all reservations\n- **Daily Management:** View and manage reservations for each day of the week\n- **Manual Reservations:** Add users to meal slots manually (bypasses capacity limits)\n\n#### 2. Users Tab\n- **Upload Users:** Upload CSV files with NetID and name pairs\n- **Bulk Operations:** Add or remove multiple users at once\n- **Individual Management:** Add or remove individual users\n- **User Overview:** View all users and their current reservations\n\n#### 3. Admins Tab\n- **Admin Management:** Add or remove admin accounts\n- **Super Admin:** Only the default \"admin\" account can add/remove other admins\n\n#### 4. Settings Tab\n- **Reservation Mode:** Choose between automatic, manually open, or manually closed\n- **Automatic Settings:** Configure when reservations open and close\n- **Time Zones:** All times are in US Eastern Time\n\n#### 5. Content Tab (NEW)\n- **Website Content Management:** Edit all text content on the main meal signup page\n- **Dynamic Content:** Change welcome messages, meal rules, contact info, and more\n- **No Code Editing:** All content changes can be made through the admin interface\n\n**Available Content Keys:**\n- `welcome_header`: Main page header\n- `welcome_message`: Welcome message below header\n- `contact_info`: Contact information text\n- `feedback_link`: Feedback form URL\n- `feedback_text`: Feedback text with link\n- `meal_rules_title`: Title for meal rules section\n- `meal_rules`: Meal signup rules (one rule per line, separated by \\n)\n\n#### 6. Purge Tab (UPDATED)\n- **Archive \u0026 Purge:** Archive all data before deletion for sentimental purposes\n- **Download Archive:** Download a CSV file containing all archived data\n- **Clear Archive:** Remove archived data to free up storage space\n- **Fresh Start:** Use at the beginning of each semester\n- **Safety Warnings:** Multiple confirmation dialogs prevent accidental purges\n\n### Semester Management Workflow\n\n1. **Start of Semester:**\n   - Use the **Purge** tab to archive and clear all old data\n   - Download the archive file for sentimental purposes (optional)\n   - Upload new user list via the **Users** tab\n   - Configure reservation settings in the **Settings** tab\n   - Update website content in the **Content** tab\n\n2. **During Semester:**\n   - Monitor reservations in the **Reservations** tab\n   - Download CSV reports as needed\n   - Manage users as they join/leave\n\n3. **End of Semester:**\n   - Download final CSV reports\n   - Use **Purge** to archive and prepare for next semester\n   - Consider downloading the archive file for sentimental purposes\n\n### Content Management Best Practices\n\n1. **Meal Rules:** Update rules in the Content tab when policies change\n2. **Contact Info:** Keep kitchen manager contact information current\n3. **Welcome Messages:** Customize messages for special events or announcements\n4. **Feedback Links:** Update feedback form URLs as needed\n\n### Security Notes\n\n- **Password Security:** Use strong passwords for admin accounts\n- **Access Control:** Limit admin access to trusted individuals\n- **Data Backup:** Regularly download CSV reports for backup\n- **Archive Safety:** Data is archived before deletion, but the purge function cannot be undone - use with caution\n- **Session Timeout:** Sessions automatically expire after 8 hours for security\n\n### Technical Support\n\n- **Database Issues:** Use the `migrate-db` command to update schema\n- **Cache Issues:** The system automatically clears cache during purge\n- **Performance:** The system uses caching for optimal performance\n- **Error Logs:** Check application logs for detailed error information\n\n## Installation \u0026 Deployment\n\n### Prerequisites\n- Python 3.9 or higher (required for `zoneinfo` module)\n- Redis server (for rate limiting and caching)\n- SQLite (included with Python)\n\n### Installation\n\n1. **Clone the repository:**\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd charter-meals\n   ```\n\n2. **Create virtual environment:**\n   ```bash\n   python -m venv .venv\n   source .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n   ```\n\n3. **Install dependencies:**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. **Create secret key:**\n   ```bash\n   # Generate a secure secret key (at least 32 characters)\n   python -c \"import secrets; print(secrets.token_urlsafe(32))\"\n   ```\n   Create a `secrets.txt` file with the generated key.\n\n5. **Initialize the database:**\n   ```bash\n   flask init-db\n   ```\n\n6. **Run the application:**\n   ```bash\n   flask run\n   ```\n\n### Production Deployment\n\n1. **Set up Redis:**\n   ```bash\n   # Install Redis (Ubuntu/Debian)\n   sudo apt-get install redis-server\n   \n   # Start Redis\n   sudo systemctl start redis-server\n   ```\n\n2. **Configure environment:**\n   ```bash\n   export FLASK_ENV=production\n   export FLASK_APP=app.py\n   ```\n\n3. **Run with Gunicorn:**\n   ```bash\n   gunicorn -w 4 -b 0.0.0.0:8000 app:app\n   ```\n\n### OpenBSD Deployment (chartermeals.com)\n\nThe production server runs on OpenBSD. An init script is provided:\n\n1. **Copy the init script:**\n   ```bash\n   doas cp rc.d/gunicorn_charter /etc/rc.d/\n   doas chmod 755 /etc/rc.d/gunicorn_charter\n   ```\n\n2. **Enable and start the service:**\n   ```bash\n   doas rcctl enable gunicorn_charter\n   doas rcctl start gunicorn_charter\n   ```\n\n3. **Service management:**\n   ```bash\n   doas rcctl restart gunicorn_charter  # Restart after updates\n   doas rcctl stop gunicorn_charter     # Stop service\n   ```\n\n**Production paths:**\n- Application: `/var/www/htdocs/www.chartermeals.com`\n- Database: `/var/www/data/meals.db`\n- Virtual environment: `charter_env` (within application directory)\n\n**Note:** If you rebuild the virtualenv on OpenBSD, reinstall `zstandard` from source:\n```bash\npip install --no-binary :all: zstandard\n```\n\n### System Requirements\n\n- **Memory:** Minimum 512MB RAM\n- **Storage:** 1GB free space for database and logs\n- **Network:** Internet access for external fonts and CDN resources\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Database Connection Errors:**\n   - Ensure the database directory has proper permissions\n   - Check if SQLite is properly installed\n   - Verify database file path in configuration\n\n2. **Redis Connection Issues:**\n   - Ensure Redis server is running: `redis-cli ping`\n   - Check Redis configuration in app.py\n   - Verify Redis port (default: 6379)\n\n3. **Session Issues:**\n   - Clear browser cookies and cache\n   - Check if secret key is properly set\n   - Verify session cookie settings\n\n4. **Performance Issues:**\n   - Check Redis cache status\n   - Monitor database query performance\n   - Review application logs for errors\n\n### Logging\n\nThe application logs important events and errors. Check logs for:\n- Database connection issues\n- Authentication failures\n- Cache errors\n- General application errors\n\n### Maintenance\n\n- **Regular Backups:** Download CSV reports weekly\n- **Database Maintenance:** Run `flask migrate-db` after updates\n- **Cache Clearing:** System automatically clears cache during purge\n- **Log Rotation:** Implement log rotation for production deployments\n\n## Dependencies\n\n### Core Dependencies\n- **Flask 2.3+**: Web framework\n- **Flask-WTF 1.1+**: CSRF protection and form handling\n- **Flask-Limiter 3.4+**: Rate limiting\n- **Flask-Talisman 1.0+**: Security headers\n- **Redis 4.5+**: Caching and rate limiting storage\n- **Flask-Compress 1.13+**: Response compression\n- **Flask-Caching 2.0+**: Application caching\n- **Gunicorn 21.0+**: WSGI server for production\n- **Werkzeug 2.3+**: WSGI utilities\n\n### Security Features\n- CSRF protection on all forms\n- Rate limiting for login attempts\n- Secure session management\n- Input validation and sanitization\n- Content Security Policy headers\n\n## License\n\nThis project is proprietary software for the Princeton Charter Club.\n\n## Contributing\n\nFor internal development and maintenance:\n1. Follow the existing code style\n2. Add comprehensive error handling\n3. Update documentation for any new features\n4. Test thoroughly before deployment\n5. Consider security implications of changes\n\n## Support\n\nFor technical support or questions:\n- Check the troubleshooting section above\n- Review application logs for error details\n- Contact the development team for critical issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconjfrnk%2Fcharter-meals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconjfrnk%2Fcharter-meals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconjfrnk%2Fcharter-meals/lists"}