🚀 Major improvements: Fix short URLs, separate public/admin views, and enhance UX
✅ Fixed Critical Issues: - Fixed dynamic QR code short URL redirect functionality - Resolved data consistency issues with multiple LinkPageManager instances - Fixed worker concurrency problems in Gunicorn configuration 🎨 UI/UX Enhancements: - Separated public page from admin statistics view - Created clean public_page.html for QR code users (no admin info) - Added comprehensive statistics_page.html for admin analytics - Enhanced dashboard with separate 'Manage' and 'Stats' buttons - Improved navigation flow throughout the application 🔧 Technical Improvements: - Added URLShortener instance reloading for data consistency - Reduced Gunicorn workers to 1 to prevent file conflicts - Increased timeout to 60s for better performance - Enhanced debug logging for troubleshooting - Added proper error handling and 404 responses 📁 New Files: - app/templates/public_page.html - Clean public interface - app/templates/statistics_page.html - Admin analytics dashboard �� Modified Files: - app/routes/main.py - Added /stats route, improved short URL handling - app/templates/edit_links.html - Added Statistics button - app/templates/index.html - Added Stats button for QR codes - app/utils/link_manager.py - Enhanced data reloading - app/utils/url_shortener.py - Added debug logging - gunicorn.conf.py - Optimized worker configuration This update provides a professional separation between public content and admin functionality while ensuring reliable short URL operation.
This commit is contained in:
@@ -57,11 +57,15 @@ class URLShortener:
|
||||
|
||||
def create_short_url(self, original_url, custom_code=None, title=""):
|
||||
"""Create a shortened URL"""
|
||||
print(f"DEBUG: URLShortener.create_short_url called with url='{original_url}', custom_code='{custom_code}', title='{title}'")
|
||||
|
||||
# Generate or use custom short code
|
||||
if custom_code and custom_code not in self.short_urls_db:
|
||||
short_code = custom_code
|
||||
print(f"DEBUG: Using custom short code: {short_code}")
|
||||
else:
|
||||
short_code = self.generate_short_code()
|
||||
print(f"DEBUG: Generated short code: {short_code}")
|
||||
|
||||
# Ensure original URL has protocol
|
||||
if not original_url.startswith(('http://', 'https://')):
|
||||
@@ -78,11 +82,16 @@ class URLShortener:
|
||||
'last_accessed': None
|
||||
}
|
||||
|
||||
print(f"DEBUG: Adding to short_urls_db: {short_code} -> {url_data}")
|
||||
self.short_urls_db[short_code] = url_data
|
||||
|
||||
print(f"DEBUG: Saving short URLs to file")
|
||||
self._save_short_urls() # Persist to file
|
||||
print(f"DEBUG: Short URLs saved successfully")
|
||||
|
||||
# Return the complete short URL
|
||||
short_url = f"{self.base_domain}/s/{short_code}"
|
||||
print(f"DEBUG: Returning short URL: {short_url}")
|
||||
return {
|
||||
'short_url': short_url,
|
||||
'short_code': short_code,
|
||||
|
||||
Reference in New Issue
Block a user