Files
qr-code_manager/app/templates/link_page.html
ske087 264a81652a Production deployment fixes and enhancements
- Added environment variable loading with python-dotenv
- Fixed Docker session permissions by using /tmp directory
- Updated .dockerignore to include .env file properly
- Enhanced docker-compose.yml with env_file directive
- Fixed Gunicorn configuration for Docker compatibility
- Updated README.md with comprehensive deployment docs
- Cleaned up debug logging from API routes
- Added DOMAIN_SETUP.md for reverse proxy guidance
- All production issues resolved and tested working
- Application now accessible at qr.moto-adv.com
2025-07-16 17:49:10 -04:00

335 lines
12 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ page.title }}</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 800px;
margin: 0 auto;
background: white;
border-radius: 15px;
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
overflow: hidden;
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 40px 30px;
text-align: center;
}
.header h1 {
font-size: 2.5em;
margin-bottom: 10px;
font-weight: 300;
}
.header p {
font-size: 1.1em;
opacity: 0.9;
}
.stats {
background: rgba(255,255,255,0.1);
margin-top: 20px;
padding: 15px;
border-radius: 10px;
display: flex;
justify-content: center;
gap: 30px;
}
.stat-item {
text-align: center;
}
.stat-number {
font-size: 1.5em;
font-weight: bold;
}
.stat-label {
font-size: 0.9em;
opacity: 0.8;
margin-top: 5px;
}
.content {
padding: 30px;
}
.links-section h2 {
color: #333;
margin-bottom: 25px;
font-size: 1.8em;
text-align: center;
}
.link-item {
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 12px;
padding: 20px;
margin-bottom: 15px;
transition: all 0.3s ease;
cursor: pointer;
text-decoration: none;
display: flex;
justify-content: space-between;
align-items: center;
gap: 15px;
color: inherit;
}
.link-item:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
border-color: #667eea;
}
.link-content {
flex: 1;
}
.link-title {
font-size: 1.3em;
font-weight: 600;
color: #333;
margin-bottom: 8px;
}
.link-logo {
width: 36px;
height: 36px;
border-radius: 8px;
flex-shrink: 0;
}
.link-icon {
width: 20px;
height: 20px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 12px;
}
.link-description {
color: #666;
font-size: 0.95em;
line-height: 1.4;
margin-bottom: 10px;
}
.link-url {
color: #667eea;
font-size: 0.9em;
font-weight: 500;
}
.empty-state {
text-align: center;
padding: 60px 20px;
color: #666;
}
.empty-state .icon {
font-size: 4em;
margin-bottom: 20px;
opacity: 0.5;
}
.empty-state h3 {
font-size: 1.5em;
margin-bottom: 10px;
color: #333;
}
@media (max-width: 768px) {
.header {
padding: 30px 20px;
}
.header h1 {
font-size: 2em;
}
.content {
padding: 20px;
}
.stats {
flex-direction: column;
gap: 15px;
}
}
/* Link animation */
@keyframes linkPulse {
0% { transform: scale(1); }
50% { transform: scale(1.02); }
100% { transform: scale(1); }
}
.link-item:active {
animation: linkPulse 0.2s ease;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>{{ page.title }}</h1>
<p>{{ page.description }}</p>
<div class="stats">
<div class="stat-item">
<div class="stat-number">{{ page.links|length }}</div>
<div class="stat-label">Links</div>
</div>
<div class="stat-item">
<div class="stat-number">{{ page.view_count }}</div>
<div class="stat-label">Views</div>
</div>
</div>
</div>
<div class="content">
<div class="links-section">
{% if page.links %}
<h2>📚 Available Links</h2>
{% for link in page.links %}
<a href="{{ link.short_url if link.short_url else link.url }}" target="_blank" class="link-item" data-url="{{ link.url }}">
<div class="link-content">
<div class="link-title">
{{ link.title }}
{% if link.short_url %}<span style="background: #2196f3; color: white; font-size: 0.7em; padding: 2px 6px; border-radius: 10px; margin-left: 8px;">SHORT</span>{% endif %}
</div>
{% if link.description %}
<div class="link-description">{{ link.description }}</div>
{% endif %}
<div class="link-url">{{ link.short_url if link.short_url else link.url }}</div>
</div>
<img class="link-logo" src="" alt="" style="display: none;" onerror="this.style.display='none'">
<div class="link-icon" style="display: block;">🔗</div>
</a>
{% endfor %}
{% else %}
<div class="empty-state">
<div class="icon">📝</div>
<h3>No links yet</h3>
<p>This collection is empty. Check back later for new links!</p>
</div>
{% endif %}
</div>
</div>
</div>
<script>
// Social media and website logo detection
function getWebsiteLogo(url) {
try {
const urlObj = new URL(url.startsWith('http') ? url : 'https://' + url);
const domain = urlObj.hostname.toLowerCase().replace('www.', '');
// Logo mapping for popular sites
const logoMap = {
'facebook.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/facebook.svg',
'instagram.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/instagram.svg',
'twitter.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/twitter.svg',
'x.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/x.svg',
'tiktok.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/tiktok.svg',
'youtube.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/youtube.svg',
'linkedin.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/linkedin.svg',
'pinterest.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/pinterest.svg',
'snapchat.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/snapchat.svg',
'whatsapp.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/whatsapp.svg',
'telegram.org': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/telegram.svg',
'discord.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/discord.svg',
'reddit.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/reddit.svg',
'github.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/github.svg',
'gmail.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/gmail.svg',
'google.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/google.svg',
'amazon.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/amazon.svg',
'apple.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/apple.svg',
'microsoft.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/microsoft.svg',
'spotify.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/spotify.svg',
'netflix.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/netflix.svg',
'twitch.tv': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/twitch.svg',
'dropbox.com': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/dropbox.svg',
'zoom.us': 'https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/zoom.svg'
};
if (logoMap[domain]) {
return logoMap[domain];
}
// Fallback to favicon
return `https://www.google.com/s2/favicons?domain=${domain}&sz=64`;
} catch (e) {
return null;
}
}
// Set logos for links
function setLogosForLinks() {
document.querySelectorAll('.link-item[data-url]').forEach(linkElement => {
const url = linkElement.getAttribute('data-url');
const logoImg = linkElement.querySelector('.link-logo');
const fallbackIcon = linkElement.querySelector('.link-icon');
const logoSrc = getWebsiteLogo(url);
if (logoSrc && logoImg) {
logoImg.src = logoSrc;
logoImg.style.display = 'block';
logoImg.alt = new URL(url.startsWith('http') ? url : 'https://' + url).hostname;
// Hide the fallback icon when logo is shown
logoImg.onload = function() {
if (fallbackIcon) fallbackIcon.style.display = 'none';
};
logoImg.onerror = function() {
this.style.display = 'none';
if (fallbackIcon) fallbackIcon.style.display = 'flex';
};
}
});
}
// Initialize logos when page loads
document.addEventListener('DOMContentLoaded', setLogosForLinks);
// Add click tracking (optional)
document.querySelectorAll('.link-item').forEach(link => {
link.addEventListener('click', function() {
// You could add analytics here
console.log('Link clicked:', this.querySelector('.link-title').textContent.trim());
});
});
// Auto-refresh every 30 seconds to get latest links
setInterval(() => {
window.location.reload();
}, 30000);
</script>
</body>
</html>