Files
Key-service-Server/Code/templates/main.html
T

85 lines
3.8 KiB
HTML

{% extends "base.html" %}
{% block title %}Keys & HWIDs{% endblock %}
{% block content %}
<div class="d-flex flex-wrap justify-content-between align-items-center gap-3 mb-4">
<div>
<h2 class="mb-1">All Keys</h2>
<p class="text-muted mb-0">Overview of license keys and bound HWIDs.</p>
</div>
<div class="d-flex gap-2">
<form method="POST" action="{{ url_for('generate_new') }}" style="display: inline;">
<button type="submit" class="btn btn-success">Generate New Key</button>
</form>
<a href="{{ url_for('download_backup') }}" class="btn btn-info">Download Backup</a>
<button type="button" class="btn btn-warning" data-bs-toggle="modal" data-bs-target="#uploadModal">Upload Backup</button>
</div>
</div>
<div class="table-wrap">
<table class="table table-striped table-hover align-middle">
<thead>
<tr>
<th scope="col">User ID</th>
<th scope="col">License Key</th>
<th scope="col">HWID</th>
<th scope="col" class="text-end">Actions</th>
</tr>
</thead>
<tbody>
{% for item in keys %}
<tr>
<td>{{ item.user_id }}</td>
<td><code>{{ item.license_key }}</code></td>
<td>
{% if item.hwid_uuid %}
<code>{{ item.hwid_uuid }}</code>
{% else %}
<span class="text-warning">Not assigned</span>
{% endif %}
</td>
<td class="text-end">
<form method="POST" action="{{ url_for('remove_key', user_id=item.user_id) }}" onsubmit="return confirm('Remove key for user {{ item.user_id }}?');">
<button type="submit" class="btn btn-sm btn-danger">Remove</button>
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="4" class="text-center text-muted py-4">No keys found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Upload Backup Modal -->
<div class="modal fade" id="uploadModal" tabindex="-1" aria-labelledby="uploadModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="uploadModalLabel">Upload Licenses Backup</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form method="POST" action="{{ url_for('upload_backup') }}" enctype="multipart/form-data">
<div class="modal-body">
<div class="mb-3">
<label for="backupFile" class="form-label">Select JSON backup file</label>
<input class="form-control" type="file" id="backupFile" name="file" accept=".json" required>
<small class="text-muted">Select a previously downloaded licenses_backup.json file</small>
</div>
<div class="alert alert-warning" role="alert">
<strong>Warning:</strong> Uploading a backup will replace all current licenses. This action cannot be undone.
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to restore from this backup? Current licenses will be replaced.');">Restore</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}