wireguard_webadmin integration papercuts

This commit is contained in:
Eduardo Silva 2024-04-04 10:45:28 -03:00
parent 19b714dc21
commit a8c52a5e46
4 changed files with 78 additions and 15 deletions

View file

@ -49,7 +49,7 @@ def view_launch_wireguard_webadmin(request):
@login_required()
def view_manage_wireguard_integration(request):
context = {
'page_title': 'Manage WireGuard Integration',
'page_title': 'Manage WireGuard WebAdmin Integration',
'delete_confirmation_message': 'Are you sure you want to delete this integration? This action cannot be undone. Type delete in the box below to confirm.'
}
wireguard_integration = ExternalIntegration.objects.filter(name='wireguard_webadmin', integration_type='wireguard_webadmin').first()
@ -73,4 +73,4 @@ def view_manage_wireguard_integration(request):
return redirect('/wireguard_webadmin/')
context['form'] = form
return render(request, 'generic_form.html', context=context)
return render(request, 'integration_manager/wireguard_webadmin_form.html', context=context)

View file

@ -23,11 +23,9 @@
<th>Schedule Type</th>
<th>Schedule Time</th>
<th>Finish Time</th>
<th class="min-width">Hash</th>
<th class="min-width"><i class="fas fa-code-branch" title="Configuration has changed"></i></th>
<th class="min-width" title="Backup hash"><i class="fas fa-code-branch" title="Configuration has changed"></i></th>
<th class="min-width">Status</th>
</thead>
<tbody>
{% for backup in backup_list %}
<tr>
@ -52,12 +50,7 @@
<a href="#" title="{{ backup.backup_text_hash }}">{{ backup.backup_text_hash|slice:":12" }}...</a>
{% endif %}
</td>
<td class="min-width">
{% if backup.config_change_detected %}
<i class="fas fa-code-branch text-info"
title="Configuration has changed since last backup"></i>
{% endif %}
</td>
<td class="min-width" style="text-align: center;">
{% if backup.success %}
<i class="far fa-check-circle text-success"></i>

View file

@ -0,0 +1,71 @@
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<div class='row'>
<div class='{% if form_size %}{{ form_size }}{% else %}col-lg-6{% endif %}'>
<div class="card card-primary card-outline">
{% if page_title %}
<div class="card-header">
<h3 class="card-title">{{ page_title }}</h3>
</div>
{% endif %}
<div class="card-body row">
<div class="col-lg-12">
{% csrf_token %}
{% crispy form %}
</div>
</div>
</div>
</div>
<div class='{% if form_size %}{{ form_size }}{% else %}col-lg-6{% endif %}'>
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title">Get Token from WireGuard WebAdmin</h3>
</div>
<div class="card-body row">
<div class="col-lg-12">
<strong>Generating an API Key:</strong>
<p>This steps should be reproduced on the host machine for wireguard_webadmin.</p>
<ul>
<li><strong>Outside the Container:</strong>
<pre><code>cat /proc/sys/kernel/random/uuid &gt; /var/lib/docker/volumes/wireguard_webadmin_wireguard/_data/routerfleet_key</code></pre>
</li>
<li><strong>Inside the Container:</strong>
<pre><code>cat /proc/sys/kernel/random/uuid &gt; /etc/wireguard/routerfleet_key</code></pre>
</li>
</ul>
<p>Remember, your <code>routerfleet_key</code> should be a valid UUID.</p>
<strong>Warning:</strong>
<p>Keep this KEY protected. Currently, It's used to authenticate users without password, including your own admin account.</p>
<strong>Disabling the API Key:</strong>
<p>If you ever need to disable your API key, you can generate a new one or simply delete the <code>routerfleet_key</code> file.</p>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block custom_page_scripts %}
<script>
function openCommandDialog(element) {
var command = element.getAttribute('data-command');
var confirmation = prompt("{% if delete_confirmation_message %}{{ delete_confirmation_message }}{% else %}Please type 'delete' to proceed.{% endif %}");
if (confirmation) {
var url = "?action=delete&confirmation=" + encodeURIComponent(confirmation);
window.location.href = url;
}
}
</script>
{% endblock %}

View file

@ -117,7 +117,7 @@
<th>Schedule</th>
<th>Time</th>
<th>Status</th>
<th><i class="fas fa-code-branch" title="Configuration has changed"></i></th>
<th><i class="fas fa-code-branch" title="backup hash"></i></th>
</tr>
</thead>
<tbody>
@ -145,9 +145,8 @@
{% endif %}
</td>
<td class="min-width">
{% if backup.config_change_detected %}
<i class="fas fa-code-branch text-info"
title="Configuration has changed since last backup"></i>
{% if backup.backup_text_hash %}
<a href="#" title="{{ backup.backup_text_hash }}">{{ backup.backup_text_hash|default_if_none:""|slice:":8" }}...</a>
{% endif %}
</td>
</tr>