Commit Graph

1087 Commits

Author SHA1 Message Date
Oliver Falk
fd10f66dab Merge branch 'devel' into 'master'
Get OTEL fixed

See merge request oliver/ivatar!269
2025-10-18 12:30:38 +02:00
Oliver Falk
b9fbf37308 Get OTEL fixed 2025-10-18 12:30:37 +02:00
Oliver Falk
45387a1a43 Merge branch 'devel' into 'master'
Merge latest devel fixes

See merge request oliver/ivatar!268
2025-10-17 16:56:14 +02:00
Oliver Falk
8b2675591e Merge latest devel fixes 2025-10-17 16:56:13 +02:00
Oliver Falk
684cdca4e4 Merge branch 'devel' into 'master'
Enhance the version endpoint and fix OTEL deployment

See merge request oliver/ivatar!267
2025-10-17 14:49:10 +02:00
Oliver Falk
6db3450b20 Enhance the version endpoint and fix OTEL deployment 2025-10-17 14:49:10 +02:00
Oliver Falk
25e9e489c3 Merge branch 'devel' into 'master'
Pull latest fixed from devel

See merge request oliver/ivatar!266
2025-10-17 12:56:16 +02:00
Oliver Falk
d3ffef3407 Pull latest fixed from devel 2025-10-17 12:56:15 +02:00
Oliver Falk
2966a85083 Merge branch 'devel' into 'master'
File upload security (iteration 1), security enhancements and OpenTelemetry (OTEL) implementation (sending data disabled by default)

See merge request oliver/ivatar!265
2025-10-17 11:16:49 +02:00
Oliver Falk
780dc18fa4 File upload security (iteration 1), security enhancements and OpenTelemetry (OTEL) implementation (sending data disabled by default) 2025-10-17 11:16:48 +02:00
Oliver Falk
2cde85e137 Merge branch 'security/enhanced-password-hashing-and-logging' into 'master'
feat: enhance security with improved password hashing and logging

See merge request oliver/ivatar!258
2025-10-15 16:36:27 +02:00
Oliver Falk
368aa5bf27 feat: enhance security with improved password hashing and logging
- Add Argon2PasswordHasher with high security settings as primary hasher
- Implement fallback to PBKDF2PasswordHasher for CentOS 7/Python 3.6 compatibility
- Add argon2-cffi dependency to requirements.txt
- Replace all print statements with proper logging calls across codebase
- Implement comprehensive logging configuration with multiple handlers:
  * ivatar.log - General application logs (INFO level)
  * ivatar_debug.log - Detailed debug logs (DEBUG level)
  * security.log - Security events (WARNING level)
- Add configurable LOGS_DIR setting with local config override support
- Create config_local.py.example with logging configuration examples
- Fix code quality issues (flake8, black formatting, import conflicts)
- Maintain backward compatibility with existing password hashes

Security improvements:
- New passwords use Argon2 (memory-hard, ASIC-resistant)
- Enhanced PBKDF2 iterations for fallback scenarios
- Structured logging for security monitoring and debugging
- Production-ready configuration with flexible log locations

Tests: 85/113 passing (failures due to external DNS/API dependencies)
Code quality: All pre-commit hooks passing
2025-10-15 15:13:09 +02:00
Oliver Falk
27ea0ecb6b Merge branch 'devel' into 'master'
Fix some FA / JS issues

See merge request oliver/ivatar!256
2025-09-26 16:26:53 +02:00
Oliver Falk
a43719e760 Fix some FA / JS issues 2025-09-26 16:11:46 +02:00
Oliver Falk
e900751a9e Merge branch 'devel' into 'master'
Sync latest dev fixes

See merge request oliver/ivatar!255
2025-09-26 12:11:25 +02:00
Oliver Falk
fbcda13c5a Merge with master 2025-09-26 11:30:57 +02:00
Oliver Falk
f15d9af595 Continued update on FA and update jquery now as well 2025-09-26 10:18:59 +02:00
Oliver Falk
254eb93049 Update FontAwesome 2025-09-26 10:18:58 +02:00
Oliver Falk
1ebb804147 Merge branch 'new-stats' into 'devel'
Add comprehensive statistics to StatsView

See merge request oliver/ivatar!254
2025-09-26 09:42:34 +02:00
Oliver Falk
15062b3cda Return full avatar URLs instead of digests in stats
- Replace digest_sha256 with avatar_url in top_viewed_avatars
- Replace digest_sha256 with avatar_url in top_queried_emails
- Replace digest_sha256 with avatar_url in top_queried_openids
- All avatar URLs now use https://libravatar.org/avatar/{digest} format
- Update tests to verify avatar_url presence and correct format
- All 5 stats tests pass successfully

This makes the stats API more user-friendly by providing complete
avatar URLs that can be directly used in applications instead of
requiring clients to construct the URLs themselves.
2025-09-26 09:21:00 +02:00
Oliver Falk
99697adba0 Merge branch 'new-stats' into 'master'
Enhance the StatsView

See merge request oliver/ivatar!253
2025-09-24 17:44:42 +02:00
Oliver Falk
9caee65b8e Enhance the StatsView 2025-09-24 17:44:41 +02:00
Oliver Falk
928ffaea76 Switch to my version until upstream is fixed 2025-09-24 17:27:43 +02:00
Oliver Falk
2fbdd74619 Use newer image, now with the new server also having newer Python 2025-09-24 17:12:36 +02:00
Oliver Falk
44a738d724 Fix code comment 2025-09-24 09:40:33 +02:00
Oliver Falk
10255296d5 Fix SQLite AVG() type conversion in photo size stats
- Convert avg_size_bytes to float to handle SQLite returning string values
- Fixes TypeError: '>' not supported between instances of 'str' and 'int'
- Ensures photo size statistics work correctly across different database backends
- All 5 stats tests pass successfully

The issue occurred because SQLite's AVG() function can return string representations
of numbers in some cases, causing type comparison errors in tests.
2025-09-24 09:40:33 +02:00
Oliver Falk
213e0cb213 Remove privacy-sensitive data from stats JSON response
- Remove email addresses from top_viewed_avatars and top_queried_emails
- Remove OpenID URLs from top_viewed_avatars and top_queried_openids
- Remove Bluesky handles from bluesky_handles section
- Keep only access_count and digest_sha256 for privacy protection
- Update tests to reflect privacy changes
- All 5 stats tests pass successfully

This ensures that the stats endpoint no longer exposes:
- User email addresses
- OpenID URLs
- Bluesky handles
- Any other personally identifiable information

The stats now only show aggregated counts and hashed identifiers.
2025-09-24 09:40:33 +02:00
Oliver Falk
4a684f9947 Refactor stats tests into separate file with random data
- Add random_ip_address() function to ivatar.utils for generating random IP addresses
- Create separate test_views_stats.py file with StatsTester class
- Move all stats tests from test_views.py to test_views_stats.py
- Update tests to use random_string() for emails and OpenIDs instead of static @example.com
- Update tests to use random_ip_address() for IP addresses instead of static 192.168.1.x
- Remove stats tests from original test_views.py file
2025-09-24 09:40:33 +02:00
Oliver Falk
9d647fe075 Add comprehensive tests for StatsView
- Add test_stats_basic: Test basic count statistics
- Add test_stats_comprehensive: Test all new statistics with real data
- Add test_stats_edge_cases: Test edge cases with empty data
- Add test_stats_with_bluesky_handles: Test Bluesky handles functionality
- Add test_stats_photo_duplicates: Test potential duplicate photos detection

All tests cover:
- Top 10 viewed avatars with associated email/OpenID details
- Top 10 queried email addresses and OpenIDs
- Photo format distribution statistics
- User activity metrics (multiple photos, email+OpenID users, avg photos per user)
- Bluesky handles statistics with top handles by access count
- Average photo size calculation using SQL queries
- Potential duplicate photos detection by format and size
- Edge cases and error handling

Tests use valid PNG image data and proper model relationships.
All 5 new test methods pass successfully.
2025-09-24 09:40:33 +02:00
Oliver Falk
a58e812fb6 Add comprehensive statistics to StatsView
- Implement top 10 viewed avatars with associated email/OpenID details
- Add top 10 queried email addresses and OpenIDs by access count
- Include photo format distribution statistics
- Add user activity metrics (multiple photos, email+OpenID users, avg photos per user)
- Implement Bluesky handles statistics with top handles by access count
- Add average photo size calculation using fast SQL queries
- Include potential duplicate photos detection by format and size
- Use raw SQL for performance optimization on large datasets
- Remove orphaned photos check as requested

All statistics now return consistent data structure with access_count and digest_sha256 fields.
2025-09-24 09:40:33 +02:00
Oliver Falk
a641572e4b Adjustments for Bluesky based avatar 2025-09-16 12:49:34 +02:00
Oliver Falk
30f94610bd Improve form button layout and hero section centering
- Fix login page button spacing with proper gap between buttons
- Add responsive button group styling for all forms (login, registration, preferences, etc.)
- Implement mobile-first button layout: horizontal on desktop, vertical stack on mobile
- Center hero section buttons on front page with explicit flexbox centering
- Add theme-resistant CSS overrides to ensure consistent button appearance
- Update HTML structure to properly contain buttons within btn-group containers
- Enhance mobile UX with full-width buttons and touch-friendly spacing
2025-09-16 12:19:11 +02:00
Oliver Falk
55b7466eb5 Fix button text visibility across all themes
- Add CSS overrides with !important to ensure button text is visible
- Fixes invisible text on primary/secondary/danger buttons when custom themes are active
- Resolves issue where theme CSS files (red.css, green.css, clime.css) override text colors
- Ensures consistent button appearance regardless of selected theme
2025-09-16 11:46:53 +02:00
Oliver Falk
8a70ea1131 Improve mobile layout for photo assignment pages
- Replace float layout with responsive CSS Grid for photo selection
- Add proper spacing between image boxes on mobile devices
- Fix button overflow issues with responsive flexbox layout
- Consolidate duplicate CSS into main stylesheet
- Apply improvements to both email and OpenID assignment templates
2025-09-16 11:22:10 +02:00
Oliver Falk
9d3d5fe5a1 Merge branch 'devel' into 'master'
Hotfixes from Devel

See merge request oliver/ivatar!252
2025-09-15 15:17:24 +02:00
Oliver Falk
b69f08694a We don't need that debug statement any more 2025-09-15 14:40:15 +02:00
Oliver Falk
ed27493abc Simple logic error and some Bluesky (still beta) fixes 2025-09-15 09:49:53 +02:00
Oliver Falk
94b21c15d2 Merge branch 'devel' into 'master'
Middleware and logging adjustments

See merge request oliver/ivatar!250
2025-09-13 18:35:26 +02:00
Oliver Falk
f7d72c18fb This is creating a lot of noise and caching now anyway happens more on Apache side - use debug logging 2025-09-13 18:20:22 +02:00
Oliver Falk
7a1e38ab50 Use the hash value from the URL instead, less compute intense and more reliable 2025-09-12 11:49:34 +02:00
Oliver Falk
9d390a5b19 Add last modified and etag for better caching 2025-09-11 20:07:24 +02:00
Oliver Falk
52576bbf18 Remove the debug print 2025-09-11 20:00:47 +02:00
Oliver Falk
d720fcfa50 Rename the custom middleware to ensure it's know this is a localemiddleware. Also ensure we delete the Vary header, it could be empty - still problematic 2025-09-11 19:54:40 +02:00
Oliver Falk
02b199333a Merge branch 'devel' into 'master'
Final Vary headers fix from devel

See merge request oliver/ivatar!249
2025-09-11 14:50:55 +02:00
Oliver Falk
c6e1583e7e Merge with master 2025-09-11 14:32:28 +02:00
Oliver Falk
5114b4d5d0 We actually need to implement this via Middleware, as the Locale Middleware comes later in the process and hinders us from removing the header. Anyway, it's cleaner, since we're not duplicating code 2025-09-11 14:22:34 +02:00
Oliver Falk
f81d6bb84c Merge branch 'devel' into 'master'
Hotfixes from devel

See merge request oliver/ivatar!248
2025-09-11 14:18:41 +02:00
Oliver Falk
16dd861953 Hotfixes from devel 2025-09-11 14:18:41 +02:00
Oliver Falk
4316c2bcc6 Merge branch 'master' into devel 2025-09-11 13:59:34 +02:00
Oliver Falk
b711594c1f We need to ensure the Vary setting isn't set of image responses 2025-09-11 13:55:08 +02:00