Files
firealerts/templates/account.html
Nathan Woodburn 55e6306e35
All checks were successful
Build Docker / BuildImage (push) Successful in 1m44s
feat: Add bulk uploading
2025-07-29 12:27:32 +10:00

155 lines
8.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FireAlerts - Account</title>
<link rel="icon" href="/assets/img/favicon.png" type="image/png">
<link rel="stylesheet" href="/assets/css/index.css">
<link rel="stylesheet" href="/assets/css/account.css">
<!-- Open Graph meta tags -->
<meta property="og:title" content="FireAlerts - Account">
<meta property="og:description" content="Manage your Handshake domain expiry alerts.">
<meta property="og:image" content="/assets/img/og.png">
<meta property="og:type" content="website">
</head>
<body>
<div class="container">
<header class="account-header">
<div class="logo">
<a href="/">🔥 FireAlerts</a>
</div>
<div class="user-info">
<span class="user">Welcome, {{user.username}}</span>
<a href="/logout" class="button secondary">Logout</a>
</div>
</header>
<main>
<section class="alerts-section">
<h2>Your Active Alerts</h2>
{% if notifications %}
<div class="notifications-grid">
{% for notification in notifications %}
<div class="notification-card">
<div class="notification-header">
<h3>{{notification.domain}}</h3>
<span class="notification-type">{{notification.notification.type.replace('_', ' ').title()}}</span>
</div>
<div class="notification-details">
<div class="detail-item">
<span class="label">Alert Threshold:</span>
<span class="value">{{notification.notification.blocks}} blocks</span>
</div>
{% for notificationType in NOTIFICATION_TYPES %}
{% if notificationType.type == notification.notification.type %}
{% for field in notificationType.fields %}
{% if field.name != 'username' %}
<div class="detail-item">
<span class="label">{{field.label}}:</span>
<span class="value">{{notification.notification[field.name]}}</span>
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</div>
<div class="notification-actions">
<a href="/notification/delete/{{notification.notification.id}}" class="button delete-button" onclick="return confirm('Are you sure you want to delete this notification?')">Delete</a>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<div class="empty-icon">📭</div>
<h3>No alerts configured</h3>
<p>You haven't set up any domain expiry alerts yet. Use the forms below to add your first notification.</p>
</div>
{% endif %}
</section>
<section class="add-alerts-section">
<h2>Add New Alert</h2>
<p class="section-description">Set up notifications to be alerted before your Handshake domains expire.</p>
<div class="notification-forms">
{% for notificationType in NOTIFICATION_TYPES %}
<div class="notification-form-card">
<div class="form-header">
<h3>{{notificationType.description}}</h3>
</div>
<form method="POST" action="/notification/{{notificationType.type}}" class="notification-form">
<div class="form-grid">
<div class="form-group">
<label for="domain-{{notificationType.type}}">Domain:</label>
<input type="text" id="domain-{{notificationType.type}}" name="domain" required placeholder="exampledomain">
</div>
{% for field in notificationType.fields %}
{% if field.type == 'username' %}
<input type="hidden" name="{{field.name}}" value="{{user.username}}">
{% else %}
<div class="form-group">
<label for="{{field.name}}-{{notificationType.type}}">{{field.label}}:</label>
<input type="{{field.type}}" id="{{field.name}}-{{notificationType.type}}" name="{{field.name}}" {% if field.required %}required{% endif %} placeholder="Enter {{field.label.lower()}}">
</div>
{% endif %}
{% endfor %}
<div class="form-group">
<label for="blocks-{{notificationType.type}}">Blocks before expiry:</label>
<input type="number" id="blocks-{{notificationType.type}}" name="blocks" required min="1" max="50000" value="1008">
<small class="form-note">💡 Tip: 144 blocks ≈ 1 day, 1008 blocks ≈ 1 week, 4320 blocks ≈ 1 month</small>
</div>
</div>
<div class="form-actions">
<button type="submit" class="button primary">Add {{notificationType.type.replace('_', ' ').title()}} Alert</button>
{% if notificationType.links %}
{% for link in notificationType.links %}
<a href="{{link.url}}" class="button secondary" target="_blank">{{link.label}}</a>
{% endfor %}
{% endif %}
</div>
</form>
</div>
{% endfor %}
</div>
</section>
<section class="add-alerts-section">
<h2>Bulk Upload Domains</h2>
<p class="section-description">Upload a CSV file with your Handshake domains to set up multiple alerts at once.</p>
<div class="bulk-upload-card">
<form method="POST" action="/bulk_upload" enctype="multipart/form-data" class="bulk-upload-form">
<div class="form-group">
<label for="bulk-file">CSV File:</label>
<input type="file" id="bulk-file" name="file" accept=".csv" required>
<small class="form-note">Upload a CSV file with one domain per line.</small>
</div>
<div class="form-actions">
<button type="submit" class="button primary">Upload CSV</button>
</div>
</form>
<div class="bulk-upload-info">
<p>Format: Each line should contain a domain name, followed by the type of notification (e.g., "exampledomain, email") & notification parameters</p>
<p>Example: <code>exampledomain, email</code></p>
<p>Supported types: email, discord, slack, webhook</p>
<p>Download example CSV: <a href="/assets/csv/example.csv" class="button secondary" download>Download Example CSV</a></p>
</div>
</section>
</main>
</div>
</body>
</html>