final stage of the app
This commit is contained in:
454
app/templates/edit_links.html
Normal file
454
app/templates/edit_links.html
Normal file
@@ -0,0 +1,454 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Edit {{ 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: 1000px;
|
||||
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: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
font-size: 2.2em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.header p {
|
||||
font-size: 1em;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 30px;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.form-section {
|
||||
background: #f8f9fa;
|
||||
padding: 25px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.form-section h2 {
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 600;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.form-group input,
|
||||
.form-group textarea {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 2px solid #e9ecef;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
|
||||
.form-group input:focus,
|
||||
.form-group textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
|
||||
.form-group textarea {
|
||||
height: 80px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
padding: 12px 25px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: linear-gradient(135deg, #6c757d 0%, #adb5bd 100%);
|
||||
}
|
||||
|
||||
.links-section h2 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.link-item {
|
||||
background: white;
|
||||
border: 1px solid #e9ecef;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.link-item.editing {
|
||||
border-color: #667eea;
|
||||
}
|
||||
|
||||
.link-display {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.link-edit {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.link-item.editing .link-display {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.link-item.editing .link-edit {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.link-title {
|
||||
font-size: 1.2em;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.link-description {
|
||||
color: #666;
|
||||
font-size: 0.9em;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.link-url {
|
||||
color: #667eea;
|
||||
font-size: 0.9em;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.link-actions {
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.btn-small {
|
||||
padding: 8px 15px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
color: #666;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.empty-state .icon {
|
||||
font-size: 3em;
|
||||
margin-bottom: 15px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.page-actions {
|
||||
background: #f8f9fa;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
border-top: 1px solid #e9ecef;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.alert {
|
||||
padding: 12px 20px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.alert-success {
|
||||
background: #d4edda;
|
||||
border: 1px solid #c3e6cb;
|
||||
color: #155724;
|
||||
}
|
||||
|
||||
.alert-error {
|
||||
background: #f8d7da;
|
||||
border: 1px solid #f5c6cb;
|
||||
color: #721c24;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.main-content {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.page-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>✏️ Edit Links</h1>
|
||||
<p>Manage your link collection: {{ page.title }}</p>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-success" id="success-alert">
|
||||
Operation completed successfully!
|
||||
</div>
|
||||
|
||||
<div class="alert alert-error" id="error-alert">
|
||||
An error occurred. Please try again.
|
||||
</div>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="form-section">
|
||||
<h2>Add New Link</h2>
|
||||
<form id="add-link-form">
|
||||
<div class="form-group">
|
||||
<label for="link-title">Title *</label>
|
||||
<input type="text" id="link-title" placeholder="Link title" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="link-url">URL *</label>
|
||||
<input type="url" id="link-url" placeholder="https://example.com" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="link-description">Description</label>
|
||||
<textarea id="link-description" placeholder="Optional description"></textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success">Add Link</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="links-section">
|
||||
<h2>Current Links ({{ page.links|length }})</h2>
|
||||
<div id="links-container">
|
||||
{% if page.links %}
|
||||
{% for link in page.links %}
|
||||
<div class="link-item" data-link-id="{{ link.id }}">
|
||||
<div class="link-display">
|
||||
<div class="link-title">{{ link.title }}</div>
|
||||
{% if link.description %}
|
||||
<div class="link-description">{{ link.description }}</div>
|
||||
{% endif %}
|
||||
<div class="link-url">{{ link.url }}</div>
|
||||
<div class="link-actions">
|
||||
<button class="btn btn-small btn-secondary" onclick="editLink('{{ link.id }}')">Edit</button>
|
||||
<button class="btn btn-small btn-danger" onclick="deleteLink('{{ link.id }}')">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="link-edit">
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<input type="text" class="edit-title" value="{{ link.title }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>URL</label>
|
||||
<input type="url" class="edit-url" value="{{ link.url }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="edit-description">{{ link.description or '' }}</textarea>
|
||||
</div>
|
||||
<div class="link-actions">
|
||||
<button class="btn btn-small btn-success" onclick="saveLink('{{ link.id }}')">Save</button>
|
||||
<button class="btn btn-small btn-secondary" onclick="cancelEdit('{{ link.id }}')">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="empty-state">
|
||||
<div class="icon">📝</div>
|
||||
<h3>No links yet</h3>
|
||||
<p>Add your first link using the form on the left.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-actions">
|
||||
<a href="/links/{{ page.id }}" target="_blank" class="btn">👁️ View Public Page</a>
|
||||
<a href="/" class="btn btn-secondary">🏠 Back to Dashboard</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const pageId = '{{ page.id }}';
|
||||
|
||||
// Add new link
|
||||
document.getElementById('add-link-form').addEventListener('submit', async function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const title = document.getElementById('link-title').value;
|
||||
const url = document.getElementById('link-url').value;
|
||||
const description = document.getElementById('link-description').value;
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/link_pages/${pageId}/links`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ title, url, description })
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
showAlert('Link added successfully!', 'success');
|
||||
setTimeout(() => location.reload(), 1000);
|
||||
} else {
|
||||
showAlert(result.error || 'Failed to add link', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
showAlert('Network error occurred', 'error');
|
||||
}
|
||||
});
|
||||
|
||||
// Edit link
|
||||
function editLink(linkId) {
|
||||
const linkItem = document.querySelector(`[data-link-id="${linkId}"]`);
|
||||
linkItem.classList.add('editing');
|
||||
}
|
||||
|
||||
// Cancel edit
|
||||
function cancelEdit(linkId) {
|
||||
const linkItem = document.querySelector(`[data-link-id="${linkId}"]`);
|
||||
linkItem.classList.remove('editing');
|
||||
}
|
||||
|
||||
// Save link
|
||||
async function saveLink(linkId) {
|
||||
const linkItem = document.querySelector(`[data-link-id="${linkId}"]`);
|
||||
const title = linkItem.querySelector('.edit-title').value;
|
||||
const url = linkItem.querySelector('.edit-url').value;
|
||||
const description = linkItem.querySelector('.edit-description').value;
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/link_pages/${pageId}/links/${linkId}`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ title, url, description })
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
showAlert('Link updated successfully!', 'success');
|
||||
setTimeout(() => location.reload(), 1000);
|
||||
} else {
|
||||
showAlert(result.error || 'Failed to update link', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
showAlert('Network error occurred', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// Delete link
|
||||
async function deleteLink(linkId) {
|
||||
if (!confirm('Are you sure you want to delete this link?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/link_pages/${pageId}/links/${linkId}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
showAlert('Link deleted successfully!', 'success');
|
||||
setTimeout(() => location.reload(), 1000);
|
||||
} else {
|
||||
showAlert(result.error || 'Failed to delete link', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
showAlert('Network error occurred', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// Show alert
|
||||
function showAlert(message, type) {
|
||||
const alert = document.getElementById(`${type}-alert`);
|
||||
alert.textContent = message;
|
||||
alert.style.display = 'block';
|
||||
|
||||
setTimeout(() => {
|
||||
alert.style.display = 'none';
|
||||
}, 3000);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
727
app/templates/index.html
Normal file
727
app/templates/index.html
Normal file
@@ -0,0 +1,727 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>QR Code Manager</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: 1200px;
|
||||
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: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
font-size: 2.5em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.header p {
|
||||
font-size: 1.1em;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 30px;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.form-section {
|
||||
background: #f8f9fa;
|
||||
padding: 25px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.form-section h2 {
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 600;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.form-group input,
|
||||
.form-group select,
|
||||
.form-group textarea {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 2px solid #e9ecef;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
|
||||
.form-group input:focus,
|
||||
.form-group select:focus,
|
||||
.form-group textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
|
||||
.form-group textarea {
|
||||
height: 100px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.color-inputs {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.color-input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.color-input-group input[type="color"] {
|
||||
width: 50px;
|
||||
height: 40px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.style-selector {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.style-option {
|
||||
padding: 10px;
|
||||
border: 2px solid #e9ecef;
|
||||
border-radius: 8px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.style-option:hover {
|
||||
border-color: #667eea;
|
||||
}
|
||||
|
||||
.style-option.active {
|
||||
border-color: #667eea;
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.wifi-fields,
|
||||
.link-page-fields,
|
||||
.email-fields,
|
||||
.sms-fields,
|
||||
.vcard-fields {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.wifi-fields.active,
|
||||
.link-page-fields.active,
|
||||
.email-fields.active,
|
||||
.sms-fields.active,
|
||||
.vcard-fields.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
padding: 12px 30px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s;
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.result-section {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.qr-preview {
|
||||
background: white;
|
||||
border: 2px dashed #ddd;
|
||||
border-radius: 10px;
|
||||
padding: 30px;
|
||||
margin-bottom: 20px;
|
||||
min-height: 300px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.qr-preview img {
|
||||
max-width: 100%;
|
||||
max-height: 250px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.qr-preview .placeholder {
|
||||
color: #999;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.download-section {
|
||||
display: none;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.download-section.active {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: #6c757d;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: #28a745;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.qr-history {
|
||||
margin-top: 30px;
|
||||
padding: 25px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.qr-history h3 {
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.qr-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
padding: 15px;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.qr-item img {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.qr-item-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.qr-item-info h4 {
|
||||
color: #333;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.qr-item-info p {
|
||||
color: #666;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.qr-item-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.btn-small {
|
||||
padding: 5px 15px;
|
||||
font-size: 12px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.main-content {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.color-inputs {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.style-selector {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>🎯 QR Code Manager</h1>
|
||||
<p>Create, customize, and manage your QR codes with ease</p>
|
||||
<div style="position: absolute; top: 20px; right: 20px;">
|
||||
<a href="/logout" style="color: white; text-decoration: none; background: rgba(255,255,255,0.2); padding: 8px 15px; border-radius: 20px; font-size: 0.9em;">
|
||||
👤 Logout
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="form-section">
|
||||
<h2>Generate QR Code</h2>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="qr-type">QR Code Type</label>
|
||||
<select id="qr-type" onchange="toggleFields()">
|
||||
<option value="text">Text</option>
|
||||
<option value="url">URL/Website</option>
|
||||
<option value="link_page">Dynamic Link Page</option>
|
||||
<option value="wifi">WiFi</option>
|
||||
<option value="email">Email</option>
|
||||
<option value="phone">Phone</option>
|
||||
<option value="sms">SMS</option>
|
||||
<option value="vcard">Contact Card</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Text/URL content -->
|
||||
<div class="form-group" id="text-field">
|
||||
<label for="content">Content</label>
|
||||
<textarea id="content" placeholder="Enter your text or URL..."></textarea>
|
||||
</div>
|
||||
|
||||
<!-- WiFi fields -->
|
||||
<div class="wifi-fields" id="wifi-fields">
|
||||
<div class="form-group">
|
||||
<label for="wifi-ssid">Network Name (SSID)</label>
|
||||
<input type="text" id="wifi-ssid" placeholder="My WiFi Network">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="wifi-password">Password</label>
|
||||
<input type="password" id="wifi-password" placeholder="WiFi Password">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="wifi-security">Security Type</label>
|
||||
<select id="wifi-security">
|
||||
<option value="WPA">WPA/WPA2</option>
|
||||
<option value="WEP">WEP</option>
|
||||
<option value="nopass">No Password</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Link Page fields -->
|
||||
<div class="link-page-fields" id="link-page-fields">
|
||||
<div class="form-group">
|
||||
<label for="page-title">Page Title</label>
|
||||
<input type="text" id="page-title" placeholder="My Link Collection" value="My Links">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="page-description">Description</label>
|
||||
<textarea id="page-description" placeholder="A collection of useful links">Collection of useful links</textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<p style="background: #e3f2fd; padding: 15px; border-radius: 8px; color: #1565c0; font-size: 0.9em;">
|
||||
<strong>💡 Dynamic Link Page:</strong> This creates a QR code that points to a web page where you can add, edit, and manage links. The QR code stays the same, but you can update the links anytime!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Email fields -->
|
||||
<div class="email-fields" id="email-fields">
|
||||
<div class="form-group">
|
||||
<label for="email-address">Email Address</label>
|
||||
<input type="email" id="email-address" placeholder="contact@example.com">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email-subject">Subject</label>
|
||||
<input type="text" id="email-subject" placeholder="Email subject">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email-body">Message</label>
|
||||
<textarea id="email-body" placeholder="Email message..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SMS fields -->
|
||||
<div class="sms-fields" id="sms-fields">
|
||||
<div class="form-group">
|
||||
<label for="sms-phone">Phone Number</label>
|
||||
<input type="tel" id="sms-phone" placeholder="+1234567890">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sms-message">Message</label>
|
||||
<textarea id="sms-message" placeholder="SMS message..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- vCard fields -->
|
||||
<div class="vcard-fields" id="vcard-fields">
|
||||
<div class="form-group">
|
||||
<label for="vcard-name">Full Name</label>
|
||||
<input type="text" id="vcard-name" placeholder="John Doe">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="vcard-organization">Organization</label>
|
||||
<input type="text" id="vcard-organization" placeholder="Company Name">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="vcard-phone">Phone</label>
|
||||
<input type="tel" id="vcard-phone" placeholder="+1234567890">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="vcard-email">Email</label>
|
||||
<input type="email" id="vcard-email" placeholder="john@example.com">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="vcard-website">Website</label>
|
||||
<input type="url" id="vcard-website" placeholder="https://example.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 style="margin: 25px 0 15px 0; color: #333;">Customization</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Colors</label>
|
||||
<div class="color-inputs">
|
||||
<div class="color-input-group">
|
||||
<input type="color" id="foreground-color" value="#000000">
|
||||
<span>Foreground</span>
|
||||
</div>
|
||||
<div class="color-input-group">
|
||||
<input type="color" id="background-color" value="#FFFFFF">
|
||||
<span>Background</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Style</label>
|
||||
<div class="style-selector">
|
||||
<div class="style-option active" data-style="square">
|
||||
<div>⬛</div>
|
||||
<div>Square</div>
|
||||
</div>
|
||||
<div class="style-option" data-style="rounded">
|
||||
<div>⬜</div>
|
||||
<div>Rounded</div>
|
||||
</div>
|
||||
<div class="style-option" data-style="circle">
|
||||
<div>⚫</div>
|
||||
<div>Circle</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="size">Size</label>
|
||||
<input type="range" id="size" min="5" max="15" value="10" oninput="updateSizeLabel()">
|
||||
<small id="size-label">10px per module</small>
|
||||
</div>
|
||||
|
||||
<button class="btn" onclick="generateQR()">Generate QR Code</button>
|
||||
</div>
|
||||
|
||||
<div class="result-section">
|
||||
<h2>Preview</h2>
|
||||
<div class="qr-preview" id="qr-preview">
|
||||
<div class="placeholder">
|
||||
<div style="font-size: 3em; margin-bottom: 10px;">📱</div>
|
||||
<div>Your QR code will appear here</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="download-section" id="download-section">
|
||||
<button class="btn btn-primary" onclick="downloadQR()">Download PNG</button>
|
||||
<button class="btn btn-secondary" onclick="copyToClipboard()">Copy Image</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="qr-history">
|
||||
<h3>Recent QR Codes</h3>
|
||||
<div id="qr-history-list">
|
||||
<p style="color: #666; text-align: center;">No QR codes generated yet</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let currentQRId = null;
|
||||
let currentQRData = null;
|
||||
|
||||
function toggleFields() {
|
||||
const type = document.getElementById('qr-type').value;
|
||||
|
||||
// Hide all specific fields
|
||||
document.getElementById('text-field').style.display = 'none';
|
||||
document.querySelectorAll('.wifi-fields, .link-page-fields, .email-fields, .sms-fields, .vcard-fields').forEach(el => {
|
||||
el.classList.remove('active');
|
||||
});
|
||||
|
||||
// Show relevant fields
|
||||
if (type === 'text' || type === 'url' || type === 'phone') {
|
||||
document.getElementById('text-field').style.display = 'block';
|
||||
const contentField = document.getElementById('content');
|
||||
if (type === 'url') {
|
||||
contentField.placeholder = 'https://example.com';
|
||||
} else if (type === 'phone') {
|
||||
contentField.placeholder = '+1234567890';
|
||||
} else {
|
||||
contentField.placeholder = 'Enter your text...';
|
||||
}
|
||||
} else {
|
||||
document.getElementById(`${type.replace('_', '-')}-fields`).classList.add('active');
|
||||
}
|
||||
}
|
||||
|
||||
function updateSizeLabel() {
|
||||
const size = document.getElementById('size').value;
|
||||
document.getElementById('size-label').textContent = `${size}px per module`;
|
||||
}
|
||||
|
||||
// Style selector
|
||||
document.querySelectorAll('.style-option').forEach(option => {
|
||||
option.addEventListener('click', function() {
|
||||
document.querySelectorAll('.style-option').forEach(opt => opt.classList.remove('active'));
|
||||
this.classList.add('active');
|
||||
});
|
||||
});
|
||||
|
||||
async function generateQR() {
|
||||
const type = document.getElementById('qr-type').value;
|
||||
let content = '';
|
||||
let additionalData = {};
|
||||
|
||||
// Get content based on type
|
||||
if (type === 'text' || type === 'url' || type === 'phone') {
|
||||
content = document.getElementById('content').value;
|
||||
} else if (type === 'link_page') {
|
||||
additionalData.title = document.getElementById('page-title').value;
|
||||
additionalData.description = document.getElementById('page-description').value;
|
||||
} else if (type === 'wifi') {
|
||||
additionalData.wifi = {
|
||||
ssid: document.getElementById('wifi-ssid').value,
|
||||
password: document.getElementById('wifi-password').value,
|
||||
security: document.getElementById('wifi-security').value
|
||||
};
|
||||
} else if (type === 'email') {
|
||||
additionalData.email = {
|
||||
email: document.getElementById('email-address').value,
|
||||
subject: document.getElementById('email-subject').value,
|
||||
body: document.getElementById('email-body').value
|
||||
};
|
||||
} else if (type === 'sms') {
|
||||
additionalData.sms = {
|
||||
phone: document.getElementById('sms-phone').value,
|
||||
message: document.getElementById('sms-message').value
|
||||
};
|
||||
} else if (type === 'vcard') {
|
||||
additionalData.vcard = {
|
||||
name: document.getElementById('vcard-name').value,
|
||||
organization: document.getElementById('vcard-organization').value,
|
||||
phone: document.getElementById('vcard-phone').value,
|
||||
email: document.getElementById('vcard-email').value,
|
||||
website: document.getElementById('vcard-website').value
|
||||
};
|
||||
}
|
||||
|
||||
const requestData = {
|
||||
type: type,
|
||||
content: content,
|
||||
...additionalData,
|
||||
size: parseInt(document.getElementById('size').value),
|
||||
foreground_color: document.getElementById('foreground-color').value,
|
||||
background_color: document.getElementById('background-color').value,
|
||||
style: document.querySelector('.style-option.active').dataset.style
|
||||
};
|
||||
|
||||
try {
|
||||
const endpoint = type === 'link_page' ? '/api/create_link_page' : '/api/generate';
|
||||
const response = await fetch(endpoint, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(requestData)
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
currentQRId = result.qr_id;
|
||||
currentQRData = result.image_data;
|
||||
|
||||
// Show QR code
|
||||
const preview = document.getElementById('qr-preview');
|
||||
let previewHTML = `<img src="${result.image_data}" alt="Generated QR Code">`;
|
||||
|
||||
// Add special info for link pages
|
||||
if (type === 'link_page') {
|
||||
previewHTML += `
|
||||
<div style="margin-top: 15px; padding: 15px; background: #e3f2fd; border-radius: 8px; text-align: left;">
|
||||
<h4 style="margin-bottom: 10px; color: #1565c0;">🎉 Dynamic Link Page Created!</h4>
|
||||
<p style="margin-bottom: 10px; font-size: 0.9em;"><strong>Public URL:</strong> <a href="${result.page_url}" target="_blank">${result.page_url}</a></p>
|
||||
<p style="margin-bottom: 10px; font-size: 0.9em;"><strong>Edit URL:</strong> <a href="${result.edit_url}" target="_blank">${result.edit_url}</a></p>
|
||||
<p style="font-size: 0.9em; color: #666;">Share the QR code - visitors will see your link collection. Use the edit URL to manage your links!</p>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
preview.innerHTML = previewHTML;
|
||||
|
||||
// Show download buttons
|
||||
document.getElementById('download-section').classList.add('active');
|
||||
|
||||
// Refresh history
|
||||
loadQRHistory();
|
||||
} else {
|
||||
alert('Error generating QR code: ' + result.error);
|
||||
}
|
||||
} catch (error) {
|
||||
alert('Error: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadQR() {
|
||||
if (currentQRId) {
|
||||
window.open(`/api/download/${currentQRId}`, '_blank');
|
||||
}
|
||||
}
|
||||
|
||||
async function copyToClipboard() {
|
||||
if (currentQRData) {
|
||||
try {
|
||||
const response = await fetch(currentQRData);
|
||||
const blob = await response.blob();
|
||||
await navigator.clipboard.write([
|
||||
new ClipboardItem({ [blob.type]: blob })
|
||||
]);
|
||||
alert('QR code copied to clipboard!');
|
||||
} catch (error) {
|
||||
alert('Failed to copy to clipboard');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadQRHistory() {
|
||||
try {
|
||||
const response = await fetch('/api/qr_codes');
|
||||
const qrCodes = await response.json();
|
||||
|
||||
const historyList = document.getElementById('qr-history-list');
|
||||
|
||||
if (qrCodes.length === 0) {
|
||||
historyList.innerHTML = '<p style="color: #666; text-align: center;">No QR codes generated yet</p>';
|
||||
return;
|
||||
}
|
||||
|
||||
historyList.innerHTML = qrCodes.map(qr => `
|
||||
<div class="qr-item">
|
||||
<img src="${qr.preview}" alt="QR Code">
|
||||
<div class="qr-item-info">
|
||||
<h4>${qr.type.toUpperCase()}${qr.type === 'link_page' ? ' 🔗' : ''}</h4>
|
||||
<p>Created: ${new Date(qr.created_at).toLocaleDateString()}</p>
|
||||
</div>
|
||||
<div class="qr-item-actions">
|
||||
<button class="btn btn-small btn-primary" onclick="downloadQRById('${qr.id}')">Download</button>
|
||||
${qr.type === 'link_page' ? `<button class="btn btn-small" onclick="openLinkPage('${qr.id}')" style="background: #28a745;">Manage</button>` : ''}
|
||||
<button class="btn btn-small btn-secondary" onclick="deleteQR('${qr.id}')">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
} catch (error) {
|
||||
console.error('Failed to load QR history:', error);
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadQRById(qrId) {
|
||||
window.open(`/api/download/${qrId}`, '_blank');
|
||||
}
|
||||
|
||||
async function deleteQR(qrId) {
|
||||
if (confirm('Are you sure you want to delete this QR code?')) {
|
||||
try {
|
||||
const response = await fetch(`/api/qr_codes/${qrId}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
loadQRHistory();
|
||||
} else {
|
||||
alert('Failed to delete QR code');
|
||||
}
|
||||
} catch (error) {
|
||||
alert('Error deleting QR code: ' + error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function openLinkPage(qrId) {
|
||||
try {
|
||||
const response = await fetch(`/api/qr_codes/${qrId}`);
|
||||
const qrData = await response.json();
|
||||
|
||||
if (qrData.page_id) {
|
||||
window.open(`/edit/${qrData.page_id}`, '_blank');
|
||||
} else {
|
||||
alert('Link page not found');
|
||||
}
|
||||
} catch (error) {
|
||||
alert('Error opening link page: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Load history on page load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
loadQRHistory();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
281
app/templates/link_page.html
Normal file
281
app/templates/link_page.html
Normal file
@@ -0,0 +1,281 @@
|
||||
<!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: block;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.link-item:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
|
||||
border-color: #667eea;
|
||||
}
|
||||
|
||||
.link-title {
|
||||
font-size: 1.3em;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background: #f8f9fa;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
border-top: 1px solid #e9ecef;
|
||||
color: #666;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: #667eea;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.footer a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.last-updated {
|
||||
margin-top: 10px;
|
||||
font-size: 0.8em;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
@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.url }}" target="_blank" class="link-item">
|
||||
<div class="link-title">
|
||||
<div class="link-icon">🔗</div>
|
||||
{{ link.title }}
|
||||
</div>
|
||||
{% if link.description %}
|
||||
<div class="link-description">{{ link.description }}</div>
|
||||
{% endif %}
|
||||
<div class="link-url">{{ link.url }}</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 class="footer">
|
||||
<p>Powered by <a href="/">QR Code Manager</a></p>
|
||||
{% if page.updated_at %}
|
||||
<div class="last-updated">
|
||||
Last updated: {{ page.updated_at[:10] }} at {{ page.updated_at[11:19] }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 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>
|
||||
253
app/templates/login.html
Normal file
253
app/templates/login.html
Normal file
@@ -0,0 +1,253 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>QR Code Manager - Login</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;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
background: white;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.login-header {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
padding: 40px 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login-header h1 {
|
||||
font-size: 2.5em;
|
||||
margin-bottom: 10px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.login-header p {
|
||||
font-size: 1.1em;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
padding: 40px 30px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 600;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
border: 2px solid #e9ecef;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
transition: border-color 0.3s;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
.form-group input:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
padding: 15px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.login-btn:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.login-btn:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.alert {
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.alert-error {
|
||||
background: #f8d7da;
|
||||
border: 1px solid #f5c6cb;
|
||||
color: #721c24;
|
||||
}
|
||||
|
||||
.alert-success {
|
||||
background: #d4edda;
|
||||
border: 1px solid #c3e6cb;
|
||||
color: #155724;
|
||||
}
|
||||
|
||||
.alert-info {
|
||||
background: #d1ecf1;
|
||||
border: 1px solid #bee5eb;
|
||||
color: #0c5460;
|
||||
}
|
||||
|
||||
.login-footer {
|
||||
padding: 20px 30px;
|
||||
background: #f8f9fa;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.default-credentials {
|
||||
background: #fff3cd;
|
||||
border: 1px solid #ffeaa7;
|
||||
color: #856404;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.default-credentials strong {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.login-container {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.login-header {
|
||||
padding: 30px 20px;
|
||||
}
|
||||
|
||||
.login-header h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
padding: 30px 20px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Security icon animation */
|
||||
.security-icon {
|
||||
font-size: 3em;
|
||||
margin-bottom: 15px;
|
||||
animation: pulse 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% { transform: scale(1); }
|
||||
50% { transform: scale(1.05); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-container">
|
||||
<div class="login-header">
|
||||
<div class="security-icon">🔐</div>
|
||||
<h1>QR Manager</h1>
|
||||
<p>Secure Admin Access</p>
|
||||
</div>
|
||||
|
||||
<div class="login-form">
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<div class="default-credentials">
|
||||
<strong>Default Login Credentials:</strong>
|
||||
Username: admin<br>
|
||||
Password: admin123
|
||||
</div>
|
||||
|
||||
<form method="POST">
|
||||
<div class="form-group">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username" required autocomplete="username">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="password" required autocomplete="current-password">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="login-btn">🚀 Login</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="login-footer">
|
||||
<p>🔒 Secure QR Code Management System</p>
|
||||
<p style="margin-top: 5px; font-size: 0.8em; opacity: 0.7;">
|
||||
Change default credentials in production
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Auto-focus on username field
|
||||
document.getElementById('username').focus();
|
||||
|
||||
// Handle form submission
|
||||
document.querySelector('form').addEventListener('submit', function(e) {
|
||||
const username = document.getElementById('username').value;
|
||||
const password = document.getElementById('password').value;
|
||||
|
||||
if (!username || !password) {
|
||||
e.preventDefault();
|
||||
alert('Please enter both username and password');
|
||||
return;
|
||||
}
|
||||
|
||||
// Show loading state
|
||||
const btn = document.querySelector('.login-btn');
|
||||
btn.innerHTML = '🔄 Logging in...';
|
||||
btn.disabled = true;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user