Peer management translation

This commit is contained in:
Eduardo Silva 2025-04-15 14:22:40 -03:00
parent 52e0f19708
commit 036dcc75da
7 changed files with 334 additions and 105 deletions

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-15 13:18-0300\n" "POT-Creation-Date: 2025-04-15 14:21-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -58,15 +58,17 @@ msgstr "Destino inválido"
msgid "Enhanced filter is enabled. This command is not available." msgid "Enhanced filter is enabled. This command is not available."
msgstr "Filtro aprimorado está habilitado. Este comando não está disponível." msgstr "Filtro aprimorado está habilitado. Este comando não está disponível."
#: dns/forms.py:22 wireguard/forms.py:19 #: dns/forms.py:22 wireguard/forms.py:22
msgid "Primary DNS" msgid "Primary DNS"
msgstr "DNS Primário" msgstr "DNS Primário"
#: dns/forms.py:23 wireguard/forms.py:20 #: dns/forms.py:23 wireguard/forms.py:23
msgid "Secondary DNS" msgid "Secondary DNS"
msgstr "DNS Secundário" msgstr "DNS Secundário"
#: dns/forms.py:25 dns/forms.py:67 dns/forms.py:109 #: dns/forms.py:25 dns/forms.py:67 dns/forms.py:109
#: templates/wireguard/wireguard_manage_ip.html:42
#: templates/wireguard/wireguard_manage_peer.html:170
#: templates/wireguard/wireguard_peer_list.html:166 user_manager/forms.py:49 #: templates/wireguard/wireguard_peer_list.html:166 user_manager/forms.py:49
#: user_manager/forms.py:180 #: user_manager/forms.py:180
msgid "Back" msgid "Back"
@ -77,6 +79,8 @@ msgid "Resolver Settings"
msgstr "Resolução de DNS" msgstr "Resolução de DNS"
#: dns/forms.py:37 dns/forms.py:83 dns/forms.py:134 #: dns/forms.py:37 dns/forms.py:83 dns/forms.py:134
#: templates/wireguard/wireguard_manage_ip.html:41
#: templates/wireguard/wireguard_manage_peer.html:168
#: templates/wireguard/wireguard_manage_server.html:130 #: templates/wireguard/wireguard_manage_server.html:130
#: user_manager/forms.py:98 user_manager/forms.py:205 #: user_manager/forms.py:98 user_manager/forms.py:205
msgid "Save" msgid "Save"
@ -92,6 +96,7 @@ msgid "IP Address"
msgstr "Endereço IP" msgstr "Endereço IP"
#: dns/forms.py:68 dns/forms.py:110 #: dns/forms.py:68 dns/forms.py:110
#: templates/wireguard/wireguard_manage_ip.html:43
#: templates/wireguard/wireguard_peer_list.html:185 user_manager/forms.py:48 #: templates/wireguard/wireguard_peer_list.html:185 user_manager/forms.py:48
#: user_manager/forms.py:181 #: user_manager/forms.py:181
msgid "Delete" msgid "Delete"
@ -103,6 +108,7 @@ msgstr "DNS Estático"
#: dns/forms.py:111 templates/dns/static_host_list.html:68 #: dns/forms.py:111 templates/dns/static_host_list.html:68
#: templates/user_manager/peer_group_list.html:8 user_manager/forms.py:177 #: templates/user_manager/peer_group_list.html:8 user_manager/forms.py:177
#: wireguard_peer/forms.py:10
msgid "Name" msgid "Name"
msgstr "Nome" msgstr "Nome"
@ -400,6 +406,132 @@ msgstr "Instância do WireGuard"
msgid "Users" msgid "Users"
msgstr "Usuários" msgstr "Usuários"
#: templates/wireguard/wireguard_manage_ip.html:18
msgid "Enter Allowed IP"
msgstr "Inserir IP Permitido"
#: templates/wireguard/wireguard_manage_ip.html:34
#: templates/wireguard/wireguard_manage_peer.html:103
#: templates/wireguard/wireguard_manage_peer.html:153
#: wireguard_peer/forms.py:31
msgid "Priority"
msgstr "Prioridade"
#: templates/wireguard/wireguard_manage_ip.html:58
msgid "Please type \\\"delete\\\" to remove this IP address."
msgstr "Por favor, digite \\\"delete\\\" para remover este endereço IP."
#: templates/wireguard/wireguard_manage_peer.html:8
msgid "Peer Configuration"
msgstr "Configuração do Peer"
#: templates/wireguard/wireguard_manage_peer.html:17
msgid "Enter Name"
msgstr "Digite um Nome"
#: templates/wireguard/wireguard_manage_peer.html:23 wireguard_peer/forms.py:14
msgid "Persistent Keepalive"
msgstr "Conexão Persistente"
#: templates/wireguard/wireguard_manage_peer.html:29 wireguard/forms.py:14
#: wireguard_peer/forms.py:11
msgid "Public Key"
msgstr "Chave Pública"
#: templates/wireguard/wireguard_manage_peer.html:36 wireguard/forms.py:13
#: wireguard_peer/forms.py:12
msgid "Private Key"
msgstr "Chave Privada"
#: templates/wireguard/wireguard_manage_peer.html:46 wireguard_peer/forms.py:13
msgid "Pre-Shared Key"
msgstr "Chave Pré-Compartilhada"
#: templates/wireguard/wireguard_manage_peer.html:57
#: templates/wireguard/wireguard_peer_list.html:136
msgid "Peer Traffic"
msgstr "Tráfego do Peer"
#: templates/wireguard/wireguard_manage_peer.html:73
#: templates/wireguard/wireguard_peer_list.html:151
msgid "No traffic history, please wait a few minutes"
msgstr "Sem histórico de tráfego, por favor aguarde alguns minutos"
#: templates/wireguard/wireguard_manage_peer.html:85
msgid "AllowedIPs at Peer section of wg"
msgstr "AllowedIPs na seção Peer do wg"
#: templates/wireguard/wireguard_manage_peer.html:86
msgid "Peer IP Addresses and networks"
msgstr "Endereços IP e redes do Peer"
#: templates/wireguard/wireguard_manage_peer.html:88
#: templates/wireguard/wireguard_manage_peer.html:169
msgid "Add IP Address"
msgstr "Adicionar IP"
#: templates/wireguard/wireguard_manage_peer.html:101
#: templates/wireguard/wireguard_manage_peer.html:151
msgid "Main ip address"
msgstr "Endereço IP principal"
#: templates/wireguard/wireguard_manage_peer.html:116
msgid "Client Routing Configuration"
msgstr "Configuração de rotas do Cliente"
#: templates/wireguard/wireguard_manage_peer.html:118
msgid "Add Client route"
msgstr "Adicionar rota"
#: templates/wireguard/wireguard_manage_peer.html:124
msgid ""
"The client is not configured to use the VPN as the default gateway."
"\\n\\nOnly the specific networks listed below are routed through the VPN."
"\\n\\nNote: These routes are not automatically pushed to the client. You "
"will need to manually update the client configuration file to reflect these "
"settings."
msgstr ""
"O cliente não está configurado para usar a VPN como gateway padrão."
"\\n\\nSomente as redes específicas listadas abaixo são roteadas através da "
"VPN.\\n\\nObservação: Essas rotas não são enviadas automaticamente para o "
"cliente. Você precisará atualizar manualmente o arquivo de configuração do "
"cliente para refletir essas configurações."
#: templates/wireguard/wireguard_manage_peer.html:127
msgid ""
"The client is configured to use the VPN as the default gateway. \\n\\nThis "
"setting routes all client internet traffic through the VPN, enhancing "
"privacy and security across all connections."
msgstr ""
"O cliente está configurado para usar a VPN como gateway padrão. \\n\\nEsta "
"configuração direciona todo o tráfego de internet do cliente através da VPN, "
"aprimorando a privacidade e a segurança em todas as conexões."
#: templates/wireguard/wireguard_manage_peer.html:136
msgid "default route"
msgstr "rota padrão"
#: templates/wireguard/wireguard_manage_peer.html:171
msgid "Delete Peer"
msgstr "Excluir Peer"
#: templates/wireguard/wireguard_manage_peer.html:188
msgid "Action Required!"
msgstr "Ação Necessária!"
#: templates/wireguard/wireguard_manage_peer.html:189
msgid ""
"When manually updating the \"Public Key\", \"Pre-Shared Key\", or \"Private "
"Key\", please ensure the configuration is correct."
msgstr ""
"Ao atualizar manualmente a \"Chave Pública\", \"Chave Pré-compartilhada\" ou "
"\"Chave Privada\", por favor, certifique-se de que a configuração esteja "
"correta."
#: templates/wireguard/wireguard_manage_peer.html:209
msgid "Please type \\\"delete\\\" to remove peer configuration."
msgstr "Por favor, digite \\\"delete\\\" para remover a configuração do peer."
#: templates/wireguard/wireguard_manage_server.html:18 #: templates/wireguard/wireguard_manage_server.html:18
msgid "Create Instance" msgid "Create Instance"
msgstr "Criar Instância" msgstr "Criar Instância"
@ -447,14 +579,6 @@ msgstr "Criar Peer"
msgid "Show extras" msgid "Show extras"
msgstr "Exibir extras" msgstr "Exibir extras"
#: templates/wireguard/wireguard_peer_list.html:136
msgid "Peer Traffic"
msgstr "Tráfego do Peer"
#: templates/wireguard/wireguard_peer_list.html:151
msgid "No traffic history, please wait a few minutes"
msgstr "Sem histórico de tráfego, por favor aguarde alguns minutos"
#: templates/wireguard/wireguard_peer_list.html:158 #: templates/wireguard/wireguard_peer_list.html:158
msgid "Close QR Code" msgid "Close QR Code"
msgstr "Fechar QR Code" msgstr "Fechar QR Code"
@ -463,6 +587,10 @@ msgstr "Fechar QR Code"
msgid "VPN Invite Details" msgid "VPN Invite Details"
msgstr "Detalhes do Convite para VPN" msgstr "Detalhes do Convite para VPN"
#: templates/wireguard/wireguard_peer_list.html:174
msgid "Expires on"
msgstr "Expira em"
#: templates/wireguard/wireguard_peer_list.html:178 #: templates/wireguard/wireguard_peer_list.html:178
msgid "Enter Email or WhatsApp Number" msgid "Enter Email or WhatsApp Number"
msgstr "Digite o Email ou Número do WhatsApp" msgstr "Digite o Email ou Número do WhatsApp"
@ -611,7 +739,7 @@ msgstr "Recarregar o serviço Wireguard"
msgid "Instance Traffic" msgid "Instance Traffic"
msgstr "Tráfego da Instância" msgstr "Tráfego da Instância"
#: templates/wireguard/wireguard_status.html:46 wireguard/forms.py:12 #: templates/wireguard/wireguard_status.html:46 wireguard/forms.py:15
msgid "Public Address" msgid "Public Address"
msgstr "Endereço Público" msgstr "Endereço Público"
@ -827,55 +955,48 @@ msgstr ""
msgid "Please type the username to proceed." msgid "Please type the username to proceed."
msgstr "Por favor, digite o nome de usuário para prosseguir." msgstr "Por favor, digite o nome de usuário para prosseguir."
#: wireguard/forms.py:8 #: wireguard/forms.py:11
msgid "Display Name" msgid "Display Name"
msgstr "Nome de Exibição" msgstr "Nome de Exibição"
#: wireguard/forms.py:9 #: wireguard/forms.py:12
msgid "Instance ID" msgid "Instance ID"
msgstr "Instância" msgstr "Instância"
#: wireguard/forms.py:10 #: wireguard/forms.py:16
msgid "Private Key"
msgstr "Chave Privada"
#: wireguard/forms.py:11
msgid "Public Key"
msgstr "Chave Pública"
#: wireguard/forms.py:13
msgid "Listen Port" msgid "Listen Port"
msgstr "Porta" msgstr "Porta"
#: wireguard/forms.py:14 #: wireguard/forms.py:17
msgid "Internal IP Address" msgid "Internal IP Address"
msgstr "Endereço IP Interno" msgstr "Endereço IP Interno"
#: wireguard/forms.py:15 #: wireguard/forms.py:18 wireguard_peer/forms.py:30
msgid "Netmask" msgid "Netmask"
msgstr "Máscara de Rede" msgstr "Máscara de Rede"
#: wireguard/forms.py:16 #: wireguard/forms.py:19
msgid "Post Up" msgid "Post Up"
msgstr "Post Up" msgstr "Post Up"
#: wireguard/forms.py:17 #: wireguard/forms.py:20
msgid "Post Down" msgid "Post Down"
msgstr "Post Down" msgstr "Post Down"
#: wireguard/forms.py:18 #: wireguard/forms.py:21
msgid "Web Refresh Interval" msgid "Web Refresh Interval"
msgstr "Intervalo de Atualização Web" msgstr "Intervalo de Atualização Web"
#: wireguard/forms.py:39
msgid "Peer List Refresh Interval must be at least 5 seconds"
msgstr "Intervalo de Atualização da Lista de Peers deve ser de pelo menos 5 segundos"
#: wireguard/forms.py:42 #: wireguard/forms.py:42
msgid "Peer List Refresh Interval must be at least 5 seconds"
msgstr ""
"Intervalo de Atualização da Lista de Peers deve ser de pelo menos 5 segundos"
#: wireguard/forms.py:45
msgid "Invalid hostname or IP Address" msgid "Invalid hostname or IP Address"
msgstr "Endereço ou IP inválido" msgstr "Endereço ou IP inválido"
#: wireguard/forms.py:51 #: wireguard/forms.py:54
msgid "The selected network range overlaps with another instance." msgid "The selected network range overlaps with another instance."
msgstr "A faixa de rede selecionada se sobrepõe a outra instância." msgstr "A faixa de rede selecionada se sobrepõe a outra instância."
@ -921,10 +1042,118 @@ msgstr "Adicionar uma nova Instância do WireGuard"
msgid "New WireGuard Instance" msgid "New WireGuard Instance"
msgstr "Nova Instância do WireGuard" msgstr "Nova Instância do WireGuard"
#: wireguard_peer/forms.py:29
msgid "Allowed IP or Network"
msgstr "Endereço IP ou Rede Permitida"
#: wireguard_peer/forms.py:39
msgid "Please provide a valid IP address."
msgstr "Por favor, forneça um endereço IP válido."
#: wireguard_peer/forms.py:48
msgid "A peer can have only one IP with priority zero."
msgstr "Um peer pode ter apenas um IP com prioridade zero."
#: wireguard_peer/forms.py:54
msgid "This IP is already in use by another peer."
msgstr "Este IP já está em uso por outro peer."
#: wireguard_peer/forms.py:56
msgid ""
"The IP address does not belong to the Peer's WireGuard instance network "
"range. Please check the IP address or change the priority."
msgstr ""
"O endereço IP não pertence à faixa de rede da instância WireGuard do Peer. "
"Por favor, verifique o endereço IP ou altere a prioridade."
#: wireguard_peer/forms.py:58
msgid "The netmask for priority 0 IP must be 32."
msgstr "A máscara de rede para IP de prioridade 0 deve ser 32."
#: wireguard_peer/forms.py:60
msgid "The IP address is the same as the Peer's WireGuard instance address."
msgstr "O endereço IP é o mesmo que o endereço da instância WireGuard do Peer."
#: wireguard_peer/forms.py:63
msgid ""
"The IP address belongs to the Peer's WireGuard instance network range. "
"Please check the IP address or change use priority 0 instead."
msgstr ""
"O endereço IP pertence à faixa de rede da instância WireGuard do Peer. Por "
"favor, verifique o endereço IP ou use a prioridade 0 em vez disso."
#: wireguard_peer/forms.py:66
msgid "Priority must be greater than or equal to 1"
msgstr "Prioridade deve ser maior ou igual a 1"
#: wireguard_peer/forms.py:68
msgid "Invalid config file"
msgstr "Arquivo de configuração inválido"
#: wireguard_peer/views.py:50 #: wireguard_peer/views.py:50
msgid "WireGuard Peer List" msgid "WireGuard Peer List"
msgstr "Lista de Peers do WireGuard" msgstr "Lista de Peers do WireGuard"
#: wireguard_peer/views.py:129
msgid "Create a new Peer for instance wg"
msgstr "Criar um novo Peer para a instância wg"
#: wireguard_peer/views.py:148
msgid "Peer created|Peer created successfully."
msgstr "Peer adicionado|Peer adicionado com sucesso."
#: wireguard_peer/views.py:153
msgid "Error creating peer|No available IP address found for peer creation."
msgstr ""
"Erro ao criar peer|Nenhum endereço IP disponível encontrado para alocação. "
#: wireguard_peer/views.py:166
msgid "Peer deleted|Peer deleted successfully."
msgstr "Peer excluído|Peer excluído com sucesso."
#: wireguard_peer/views.py:169
msgid ""
"Error deleting peer|Invalid confirmation message. Type \"delete\" to confirm."
msgstr ""
"Erro ao excluir peer|Mensagem de confirmação inválida. Digite \"delete\" "
"para confirmar."
#: wireguard_peer/views.py:171
msgid "Update Peer: "
msgstr "Atualizar Peer: "
#: wireguard_peer/views.py:182
msgid "Peer updated|Peer updated successfully."
msgstr "Peer atualizado|Peer atualizado com sucesso."
#: wireguard_peer/views.py:220
msgid "IP address deleted|IP address deleted successfully."
msgstr "Endereço IP excluído|Endereço IP excluído com sucesso."
#: wireguard_peer/views.py:225
msgid ""
"Error deleting IP address|Invalid confirmation message. Type \"delete\" to "
"confirm."
msgstr ""
"Erro ao excluir endereço IP|Mensagem de confirmação inválida. Digite "
"\"delete\" para confirmar."
#: wireguard_peer/views.py:230
msgid "Manage client route"
msgstr "Gerenciar rota do cliente"
#: wireguard_peer/views.py:232
msgid "Manage IP address or Network"
msgstr "Gerenciar Endereço IP ou Rede"
#: wireguard_peer/views.py:245
msgid "IP address updated|IP address updated successfully."
msgstr "Endereço IP atualizado|Endereço IP atualizado com sucesso."
#: wireguard_peer/views.py:247
msgid "IP address added|IP address added successfully."
msgstr "Endereço IP adicionado|Endereço IP adicionado com sucesso."
#: wireguard_tools/views.py:160 #: wireguard_tools/views.py:160
msgid "" msgid ""
"Export successful!|WireGuard configuration files have been exported to /etc/" "Export successful!|WireGuard configuration files have been exported to /etc/"

View File

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %}
{% block content %} {% block content %}
<div class='row'> <div class='row'>
@ -15,7 +15,7 @@
<!-- Allowed IP --> <!-- Allowed IP -->
<div class="form-group"> <div class="form-group">
<label for="{{ form.allowed_ip.id_for_label }}">{{ form.allowed_ip.label }}</label> <label for="{{ form.allowed_ip.id_for_label }}">{{ form.allowed_ip.label }}</label>
<input type="text" class="form-control" id="{{ form.allowed_ip.id_for_label }}" name="{{ form.allowed_ip.html_name }}" placeholder="Enter Allowed IP" value="{{ form.allowed_ip.value|default_if_none:'' }}" required> <input type="text" class="form-control" id="{{ form.allowed_ip.id_for_label }}" name="{{ form.allowed_ip.html_name }}" placeholder="{% trans 'Enter Allowed IP' %}" value="{{ form.allowed_ip.value|default_if_none:'' }}" required>
</div> </div>
<!-- Netmask --> <!-- Netmask -->
@ -31,16 +31,16 @@
<!-- Priority --> <!-- Priority -->
<div class="form-group"> <div class="form-group">
<label for="{{ form.priority.id_for_label }}">{{ form.priority.label }}</label> <label for="{{ form.priority.id_for_label }}">{{ form.priority.label }}</label>
<input type="number" class="form-control" id="{{ form.priority.id_for_label }}" name="{{ form.priority.html_name }}" placeholder="Priority" value="{{ form.priority.value|default_if_none:'' }}" required> <input type="number" class="form-control" id="{{ form.priority.id_for_label }}" name="{{ form.priority.html_name }}" placeholder="{% trans 'Priority' %}" value="{{ form.priority.value|default_if_none:'' }}" required>
</div> </div>
</div> </div>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button type="submit" class="btn btn-primary">Submit</button> <button type="submit" class="btn btn-primary">{% trans 'Save' %}</button>
<a class="btn btn-outline-secondary" href="/peer/manage/?peer={{ current_peer.uuid }}">Back</a> <a class="btn btn-outline-secondary" href="/peer/manage/?peer={{ current_peer.uuid }}">{% trans 'Back' %}</a>
{% if current_ip %}<a href='javascript:void(0)' class='btn btn-outline-danger' data-command='delete' onclick='openCommandDialog(this)'>Delete IP</a>{% endif %} {% if current_ip %}<a href='javascript:void(0)' class='btn btn-outline-danger' data-command='delete' onclick='openCommandDialog(this)'>{% trans 'Delete' %}</a>{% endif %}
</div> </div>
</form> </form>
</div> </div>
@ -55,7 +55,7 @@
<script> <script>
function openCommandDialog(element) { function openCommandDialog(element) {
var command = element.getAttribute('data-command'); var command = element.getAttribute('data-command');
var confirmation = prompt("Please type 'delete' to remove this IP address."); var confirmation = prompt("{% trans 'Please type \"delete\" to remove this IP address.' %}");
if (confirmation) { if (confirmation) {
var url = "?ip={{ current_ip.uuid }}&action=delete&confirmation=" + encodeURIComponent(confirmation); var url = "?ip={{ current_ip.uuid }}&action=delete&confirmation=" + encodeURIComponent(confirmation);
window.location.href = url; window.location.href = url;

View File

@ -1,10 +1,11 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %}
{% block content %} {% block content %}
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Configure Peer</h3> <h3 class="card-title">{% trans 'Peer Configuration' %}</h3>
</div> </div>
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
@ -13,26 +14,26 @@
<!-- Name --> <!-- Name -->
<div class="form-group"> <div class="form-group">
<label for="{{ form.name.id_for_label }}">{{ form.name.label }}</label> <label for="{{ form.name.id_for_label }}">{{ form.name.label }}</label>
<input type="text" class="form-control" id="{{ form.name.id_for_label }}" name="{{ form.name.html_name }}" placeholder="Enter Name" value="{{ form.name.value|default_if_none:'' }}"> <input type="text" class="form-control" id="{{ form.name.id_for_label }}" name="{{ form.name.html_name }}" placeholder="{% trans 'Enter Name' %}" value="{{ form.name.value|default_if_none:'' }}">
</div> </div>
<!-- Persistent Keepalive --> <!-- Persistent Keepalive -->
<div class="form-group"> <div class="form-group">
<label for="{{ form.persistent_keepalive.id_for_label }}">{{ form.persistent_keepalive.label }}</label> <label for="{{ form.persistent_keepalive.id_for_label }}">{{ form.persistent_keepalive.label }}</label>
<input type="number" class="form-control" id="{{ form.persistent_keepalive.id_for_label }}" name="{{ form.persistent_keepalive.html_name }}" placeholder="Persistent Keepalive" value="{{ form.persistent_keepalive.value|default_if_none:'' }}" required> <input type="number" class="form-control" id="{{ form.persistent_keepalive.id_for_label }}" name="{{ form.persistent_keepalive.html_name }}" placeholder="{% trans 'Persistent Keepalive' %}" value="{{ form.persistent_keepalive.value|default_if_none:'' }}" required>
</div> </div>
<!-- Public Key --> <!-- Public Key -->
<div class="form-group"> <div class="form-group">
<label for="{{ form.public_key.id_for_label }}">{{ form.public_key.label }}</label> <label for="{{ form.public_key.id_for_label }}">{{ form.public_key.label }}</label>
<input type="text" class="form-control" id="{{ form.public_key.id_for_label }}" name="{{ form.public_key.html_name }}" placeholder="Public Key" value="{{ form.public_key.value|default_if_none:'' }}" required> <input type="text" class="form-control" id="{{ form.public_key.id_for_label }}" name="{{ form.public_key.html_name }}" placeholder="{% trans 'Public Key' %}" value="{{ form.public_key.value|default_if_none:'' }}" required>
</div> </div>
<!-- Private Key --> <!-- Private Key -->
<div class="form-group"> <div class="form-group">
<label for="{{ form.private_key.id_for_label }}">{{ form.private_key.label }}</label> <label for="{{ form.private_key.id_for_label }}">{{ form.private_key.label }}</label>
<div class="input-group"> <div class="input-group">
<input type="password" class="form-control" id="{{ form.private_key.id_for_label }}" name="{{ form.private_key.html_name }}" placeholder="Private Key" value="{{ form.private_key.value|default_if_none:'' }}" required> <input type="password" class="form-control" id="{{ form.private_key.id_for_label }}" name="{{ form.private_key.html_name }}" placeholder="{% trans 'Private Key' %}" value="{{ form.private_key.value|default_if_none:'' }}" required>
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-outline-secondary toggle-password" type="button"><i class="fas fa-eye"></i></button> <button class="btn btn-outline-secondary toggle-password" type="button"><i class="fas fa-eye"></i></button>
</div> </div>
@ -42,7 +43,7 @@
<!-- Pre-Shared Key --> <!-- Pre-Shared Key -->
<div class="form-group"> <div class="form-group">
<label for="{{ form.pre_shared_key.id_for_label }}">{{ form.pre_shared_key.label }}</label> <label for="{{ form.pre_shared_key.id_for_label }}">{{ form.pre_shared_key.label }}</label>
<input type="text" class="form-control" id="{{ form.pre_shared_key.id_for_label }}" name="{{ form.pre_shared_key.html_name }}" placeholder="Pre-Shared Key" value="{{ form.pre_shared_key.value|default_if_none:'' }}" required> <input type="text" class="form-control" id="{{ form.pre_shared_key.id_for_label }}" name="{{ form.pre_shared_key.html_name }}" placeholder="{% trans 'Pre-Shared Key' %}" value="{{ form.pre_shared_key.value|default_if_none:'' }}" required>
</div> </div>
</div> </div>
@ -53,7 +54,7 @@
<div class="d-flex justify-content-between align-items-center "> <div class="d-flex justify-content-between align-items-center ">
<label> <label>
<i class="fas fa-chart-area"></i> <i class="fas fa-chart-area"></i>
Peer Traffic {% trans 'Peer Traffic' %}
</label> </label>
<div class="btn-group" role="group" aria-label="Graph interval"> <div class="btn-group" role="group" aria-label="Graph interval">
<a href="#" data-period="1h" class="btn btn-outline-primary btn-xs">1h</a> <a href="#" data-period="1h" class="btn btn-outline-primary btn-xs">1h</a>
@ -69,7 +70,7 @@
</div> </div>
<center> <center>
<img id="graphImg" src="/rrd/graph/?peer={{ current_peer.uuid }}{% if request.GET.period %}&period={{ request.GET.period }}{% endif %}" class="img-fluid" alt="No traffic history, please wait a few minutes" onerror="this.onerror=null; this.style.display='none'; this.insertAdjacentHTML('afterend', this.alt);"> <img id="graphImg" src="/rrd/graph/?peer={{ current_peer.uuid }}{% if request.GET.period %}&period={{ request.GET.period }}{% endif %}" class="img-fluid" alt="{% trans 'No traffic history, please wait a few minutes' %}" onerror="this.onerror=null; this.style.display='none'; this.insertAdjacentHTML('afterend', this.alt);">
</center> </center>
<div class="d-flex justify-content-between align-items-center border-bottom mb-3" style="padding-top: 16px;"></div> <div class="d-flex justify-content-between align-items-center border-bottom mb-3" style="padding-top: 16px;"></div>
@ -81,10 +82,10 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<label> <label>
<i class="fas fa-info-circle" title="AllowedIPs at Peer section of wg{{ current_peer.wireguard_instance.instance_id }}.conf"></i> <i class="fas fa-info-circle" title="{% trans 'AllowedIPs at Peer section of wg' %}{{ current_peer.wireguard_instance.instance_id }}.conf"></i>
Peer IP Addresses and networks {% trans 'Peer IP Addresses and networks' %}
</label> </label>
<a class="btn btn-outline-primary btn-xs" href="/peer/manage_ip_address/?peer={{ current_peer.uuid }}&config=server" >Add IP Address</a> <a class="btn btn-outline-primary btn-xs" href="/peer/manage_ip_address/?peer={{ current_peer.uuid }}&config=server" >{% trans 'Add IP Address' %}</a>
</div> </div>
{% for ip_address in peer_ip_list %} {% for ip_address in peer_ip_list %}
@ -94,15 +95,12 @@
<i class="fas fa-network-wired"></i> <i class="fas fa-network-wired"></i>
{{ ip_address}} {{ ip_address}}
</a> </a>
</p> </p>
<p class="d-flex flex-column text-right small"> <p class="d-flex flex-column text-right small">
{% if ip_address.priority == 0 %} {% if ip_address.priority == 0 %}
Main ip address {% trans 'Main ip address' %}
{% else %} {% else %}
Priority: {{ ip_address.priority }} {% trans 'Priority' %}: {{ ip_address.priority }}
{% endif %} {% endif %}
</p> </p>
</div> </div>
@ -115,18 +113,18 @@
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<label> <label>
<i class="fas fa-info-circle" title="AllowedIPs at client configuration file"></i> <i class="fas fa-info-circle" title="AllowedIPs at client configuration file"></i>
Client Routing Configuration {% trans 'Client Routing Configuration' %}
</label> </label>
<a class="btn btn-outline-primary btn-xs" href="/peer/manage_ip_address/?peer={{ current_peer.uuid }}&config=client" >Add Client route</a> <a class="btn btn-outline-primary btn-xs" href="/peer/manage_ip_address/?peer={{ current_peer.uuid }}&config=client" >{% trans 'Add Client route' %}</a>
</div> </div>
<div class="d-flex justify-content-between align-items-center border-bottom mb-3"> <div class="d-flex justify-content-between align-items-center border-bottom mb-3">
<p> <p>
<a href="#" <a href="#"
{% if peer_client_ip_list %} {% if peer_client_ip_list %}
onclick="alert('The client is not configured to use the VPN as the default gateway.\n\nOnly the specific networks listed below are routed through the VPN.\n\nNote: These routes are not automatically pushed to the client. You will need to manually update the client configuration file to reflect these settings.');" onclick="alert('{% trans 'The client is not configured to use the VPN as the default gateway.\n\nOnly the specific networks listed below are routed through the VPN.\n\nNote: These routes are not automatically pushed to the client. You will need to manually update the client configuration file to reflect these settings.' %}');"
style="text-decoration: line-through;" style="text-decoration: line-through;"
{% else %} {% else %}
onclick="alert('The client is configured to use the VPN as the default gateway. \n\nThis setting routes all client internet traffic through the VPN, enhancing privacy and security across all connections.');" onclick="alert('{% trans 'The client is configured to use the VPN as the default gateway. \n\nThis setting routes all client internet traffic through the VPN, enhancing privacy and security across all connections.' %}');"
{% endif %} {% endif %}
> >
@ -135,7 +133,7 @@
</a> </a>
</p> </p>
<p class="d-flex flex-column text-right small"> <p class="d-flex flex-column text-right small">
default route {% trans 'default route' %}
</p> </p>
</div> </div>
@ -150,9 +148,9 @@
</p> </p>
<p class="d-flex flex-column text-right small"> <p class="d-flex flex-column text-right small">
{% if ip_address.priority == 0 %} {% if ip_address.priority == 0 %}
Main ip address {% trans 'Main ip address' %}
{% else %} {% else %}
Priority: {{ ip_address.priority }} {% trans 'Priority' %}: {{ ip_address.priority }}
{% endif %} {% endif %}
</p> </p>
</div> </div>
@ -167,10 +165,10 @@
</div> </div>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<button type="submit" class="btn btn-primary">Submit</button> <button type="submit" class="btn btn-primary">{% trans 'Save' %}</button>
<a href="/peer/manage_ip_address/?peer={{ current_peer.uuid }}" class="btn btn-outline-primary">Add IP Address</a> <a href="/peer/manage_ip_address/?peer={{ current_peer.uuid }}" class="btn btn-outline-primary">{% trans 'Add IP Address' %}</a>
<a class="btn btn-outline-secondary" href="/peer/list/?uuid={{ current_peer.wireguard_instance.uuid }}#peer-{{ current_peer.public_key }}">Back</a> <a class="btn btn-outline-secondary" href="/peer/list/?uuid={{ current_peer.wireguard_instance.uuid }}#peer-{{ current_peer.public_key }}">{% trans 'Back' %}</a>
<a href='javascript:void(0)' class='btn btn-outline-danger' data-command='delete' onclick='openCommandDialog(this)'>Delete Peer</a> <a href='javascript:void(0)' class='btn btn-outline-danger' data-command='delete' onclick='openCommandDialog(this)'>{% trans 'Delete Peer' %}</a>
</div> </div>
</form> </form>
@ -187,9 +185,8 @@
if (!alertShown) { if (!alertShown) {
$(document).Toasts('create', { $(document).Toasts('create', {
class: 'bg-warning', class: 'bg-warning',
title: 'Action Required!', title: '{% trans 'Action Required!' %}',
body: 'When manually updating the "Public Key", "Pre-Shared Key", or "Private Key", please ensure the configuration is correct.', body: '{% trans 'When manually updating the "Public Key", "Pre-Shared Key", or "Private Key", please ensure the configuration is correct.' %}',
}); });
alertShown = true; alertShown = true;
} }
@ -209,7 +206,7 @@
<script> <script>
function openCommandDialog(element) { function openCommandDialog(element) {
var command = element.getAttribute('data-command'); var command = element.getAttribute('data-command');
var confirmation = prompt("Please type 'delete' to remove peer configuration."); var confirmation = prompt("{% trans 'Please type \"delete\" to remove peer configuration.' %}");
if (confirmation) { if (confirmation) {
var url = "?peer={{ current_peer.uuid }}&action=delete&confirmation=" + encodeURIComponent(confirmation); var url = "?peer={{ current_peer.uuid }}&action=delete&confirmation=" + encodeURIComponent(confirmation);
window.location.href = url; window.location.href = url;

View File

@ -170,7 +170,7 @@
</div> </div>
<p id="invitePassword"></p> <p id="invitePassword"></p>
<p> <p>
Expires on: <span id="inviteExpiration"></span> {% trans 'Expires on' %}: <span id="inviteExpiration"></span>
<i class="fas fa-sync-alt" id="refreshInviteButton" style="cursor: pointer;" title="Refresh Invite"></i> <i class="fas fa-sync-alt" id="refreshInviteButton" style="cursor: pointer;" title="Refresh Invite"></i>
</p> </p>
<div class="form-group"> <div class="form-group">

View File

@ -1,14 +1,17 @@
from django import forms
from wireguard.models import Peer, PeerAllowedIP, NETMASK_CHOICES
import ipaddress import ipaddress
from django import forms
from django.utils.translation import gettext_lazy as _
from wireguard.models import NETMASK_CHOICES, Peer, PeerAllowedIP
class PeerForm(forms.ModelForm): class PeerForm(forms.ModelForm):
name = forms.CharField(label='Name', required=False) name = forms.CharField(label=_('Name'), required=False)
public_key = forms.CharField(label='Public Key', required=True) public_key = forms.CharField(label=_('Public Key'), required=True)
private_key = forms.CharField(label='Private Key', required=False) private_key = forms.CharField(label=_('Private Key'), required=False)
pre_shared_key = forms.CharField(label='Pre-Shared Key', required=True) pre_shared_key = forms.CharField(label=_('Pre-Shared Key'), required=True)
persistent_keepalive = forms.IntegerField(label='Persistent Keepalive', required=True) persistent_keepalive = forms.IntegerField(label=_('Persistent Keepalive'), required=True)
class Meta: class Meta:
model = Peer model = Peer
@ -23,9 +26,9 @@ class PeerAllowedIPForm(forms.ModelForm):
self.current_peer = current_peer self.current_peer = current_peer
self.config_file = config_file self.config_file = config_file
allowed_ip = forms.GenericIPAddressField(label='Allowed IP or Network', required=True) allowed_ip = forms.GenericIPAddressField(label=_('Allowed IP or Network'), required=True)
netmask = forms.ChoiceField(choices=NETMASK_CHOICES, label='Netmask', initial=24, required=True) netmask = forms.ChoiceField(choices=NETMASK_CHOICES, label=_('Netmask'), initial=24, required=True)
priority = forms.IntegerField(label='Priority', required=True, initial=1) priority = forms.IntegerField(label=_('Priority'), required=True, initial=1)
def clean(self): def clean(self):
cleaned_data = super().clean() cleaned_data = super().clean()
@ -33,7 +36,7 @@ class PeerAllowedIPForm(forms.ModelForm):
allowed_ip = cleaned_data.get('allowed_ip') allowed_ip = cleaned_data.get('allowed_ip')
netmask = cleaned_data.get('netmask') netmask = cleaned_data.get('netmask')
if allowed_ip is None: if allowed_ip is None:
raise forms.ValidationError("Please provide a valid IP address.") raise forms.ValidationError(_("Please provide a valid IP address."))
if self.config_file == 'server': if self.config_file == 'server':
wireguard_network = ipaddress.ip_network(f"{self.current_peer.wireguard_instance.address}/{self.current_peer.wireguard_instance.netmask}", strict=False) wireguard_network = ipaddress.ip_network(f"{self.current_peer.wireguard_instance.address}/{self.current_peer.wireguard_instance.netmask}", strict=False)
@ -42,27 +45,27 @@ class PeerAllowedIPForm(forms.ModelForm):
if self.instance: if self.instance:
zero_priority_ips_query = zero_priority_ips_query.exclude(uuid=self.instance.uuid) zero_priority_ips_query = zero_priority_ips_query.exclude(uuid=self.instance.uuid)
if zero_priority_ips_query.exists(): if zero_priority_ips_query.exists():
raise forms.ValidationError("A peer can have only one IP with priority zero.") raise forms.ValidationError(_("A peer can have only one IP with priority zero."))
duplicated_ip = PeerAllowedIP.objects.filter(config_file='server', allowed_ip=allowed_ip) duplicated_ip = PeerAllowedIP.objects.filter(config_file='server', allowed_ip=allowed_ip)
if self.instance: if self.instance:
duplicated_ip = duplicated_ip.exclude(uuid=self.instance.uuid) duplicated_ip = duplicated_ip.exclude(uuid=self.instance.uuid)
if duplicated_ip.exists(): if duplicated_ip.exists():
raise forms.ValidationError("This IP is already in use by another peer.") raise forms.ValidationError(_("This IP is already in use by another peer."))
if ipaddress.ip_address(allowed_ip) not in wireguard_network: if ipaddress.ip_address(allowed_ip) not in wireguard_network:
raise forms.ValidationError("The IP address does not belong to the Peer's WireGuard instance network range. Please check the IP address or change the priority.") raise forms.ValidationError(_("The IP address does not belong to the Peer's WireGuard instance network range. Please check the IP address or change the priority."))
if str(netmask) != str(32): if str(netmask) != str(32):
raise forms.ValidationError("The netmask for priority 0 IP must be 32.") raise forms.ValidationError(_("The netmask for priority 0 IP must be 32."))
if self.current_peer.wireguard_instance.address == allowed_ip: if self.current_peer.wireguard_instance.address == allowed_ip:
raise forms.ValidationError("The IP address is the same as the Peer's WireGuard instance address.") raise forms.ValidationError(_("The IP address is the same as the Peer's WireGuard instance address."))
else: else:
if ipaddress.ip_address(allowed_ip) in wireguard_network: if ipaddress.ip_address(allowed_ip) in wireguard_network:
raise forms.ValidationError("The IP address belongs to the Peer's WireGuard instance network range. Please check the IP address or change use priority 0 instead.") raise forms.ValidationError(_("The IP address belongs to the Peer's WireGuard instance network range. Please check the IP address or change use priority 0 instead."))
elif self.config_file == 'client': elif self.config_file == 'client':
if priority < 1: if priority < 1:
raise forms.ValidationError("Priority must be greater than or equal to 1") raise forms.ValidationError(_("Priority must be greater than or equal to 1"))
else: else:
raise forms.ValidationError('Invalid config file') raise forms.ValidationError(_('Invalid config file'))
class Meta: class Meta:
model = PeerAllowedIP model = PeerAllowedIP

View File

@ -126,7 +126,7 @@ def view_wireguard_peer_manage(request):
if not user_has_access_to_instance(user_acl, current_instance): if not user_has_access_to_instance(user_acl, current_instance):
raise Http404 raise Http404
current_peer = None current_peer = None
page_title = 'Create a new Peer for instance wg' + str(current_instance.instance_id) page_title = _('Create a new Peer for instance wg') + str(current_instance.instance_id)
new_peer_data = generate_peer_default(current_instance) new_peer_data = generate_peer_default(current_instance)
if new_peer_data['allowed_ip']: if new_peer_data['allowed_ip']:
@ -145,12 +145,12 @@ def view_wireguard_peer_manage(request):
priority=0, priority=0,
netmask=32, netmask=32,
) )
messages.success(request, 'Peer created|Peer for instance wg' + str(current_instance.instance_id) + ' created successfully with IP ' + new_peer_data['allowed_ip'] + '/32.') messages.success(request, _('Peer created|Peer created successfully.'))
new_peer.wireguard_instance.pending_changes = True new_peer.wireguard_instance.pending_changes = True
new_peer.wireguard_instance.save() new_peer.wireguard_instance.save()
return redirect('/peer/manage/?peer=' + str(new_peer.uuid)) return redirect('/peer/manage/?peer=' + str(new_peer.uuid))
else: else:
messages.warning(request, 'Error creating peer|No available IP address found for peer creation.') messages.warning(request, _('Error creating peer|No available IP address found for peer creation.'))
return redirect('/peer/list/') return redirect('/peer/list/')
elif request.GET.get('peer'): elif request.GET.get('peer'):
@ -163,12 +163,12 @@ def view_wireguard_peer_manage(request):
current_peer.wireguard_instance.pending_changes = True current_peer.wireguard_instance.pending_changes = True
current_peer.wireguard_instance.save() current_peer.wireguard_instance.save()
current_peer.delete() current_peer.delete()
messages.success(request, 'Peer deleted|Peer deleted successfully.') messages.success(request, _('Peer deleted|Peer deleted successfully.'))
return redirect('/peer/list/?uuid=' + str(current_instance.uuid)) return redirect('/peer/list/?uuid=' + str(current_instance.uuid))
else: else:
messages.warning(request, 'Error deleting peer|Invalid confirmation message. Type "delete" to confirm.') messages.warning(request, _('Error deleting peer|Invalid confirmation message. Type "delete" to confirm.'))
return redirect('/peer/manage/?peer=' + str(current_peer.uuid)) return redirect('/peer/manage/?peer=' + str(current_peer.uuid))
page_title = 'Update Peer ' page_title = _('Update Peer: ')
peer_ip_list = current_peer.peerallowedip_set.filter(config_file='server').order_by('priority') peer_ip_list = current_peer.peerallowedip_set.filter(config_file='server').order_by('priority')
peer_client_ip_list = current_peer.peerallowedip_set.filter(config_file='client').order_by('priority') peer_client_ip_list = current_peer.peerallowedip_set.filter(config_file='client').order_by('priority')
if current_peer.name: if current_peer.name:
@ -179,7 +179,7 @@ def view_wireguard_peer_manage(request):
form = PeerForm(request.POST, instance=current_peer) form = PeerForm(request.POST, instance=current_peer)
if form.is_valid(): if form.is_valid():
form.save() form.save()
messages.success(request, 'Peer updated|Peer updated successfully.') messages.success(request, _('Peer updated|Peer updated successfully.'))
current_peer.wireguard_instance.pending_changes = True current_peer.wireguard_instance.pending_changes = True
current_peer.wireguard_instance.save() current_peer.wireguard_instance.save()
return redirect('/peer/list/?uuid=' + str(current_peer.wireguard_instance.uuid)) return redirect('/peer/list/?uuid=' + str(current_peer.wireguard_instance.uuid))
@ -217,19 +217,19 @@ def view_manage_ip_address(request):
if request.GET.get('action') == 'delete': if request.GET.get('action') == 'delete':
if request.GET.get('confirmation') == 'delete': if request.GET.get('confirmation') == 'delete':
current_ip.delete() current_ip.delete()
messages.success(request, 'IP address deleted|IP address deleted successfully.') messages.success(request, _('IP address deleted|IP address deleted successfully.'))
current_peer.wireguard_instance.pending_changes = True current_peer.wireguard_instance.pending_changes = True
current_peer.wireguard_instance.save() current_peer.wireguard_instance.save()
return redirect('/peer/manage/?peer=' + str(current_peer.uuid)) return redirect('/peer/manage/?peer=' + str(current_peer.uuid))
else: else:
messages.warning(request, 'Error deleting IP address|Invalid confirmation message. Type "delete" to confirm.') messages.warning(request, _('Error deleting IP address|Invalid confirmation message. Type "delete" to confirm.'))
return redirect('/peer/ip/?ip=' + str(current_ip.uuid)) return redirect('/peer/manage_ip_address/?ip=' + str(current_ip.uuid))
if config_file not in ['client', 'server']: if config_file not in ['client', 'server']:
config_file = 'server' config_file = 'server'
if config_file == 'client': if config_file == 'client':
page_title = 'Manage client route' page_title = _('Manage client route')
else: else:
page_title = 'Manage IP address or Network' page_title = _('Manage IP address or Network')
if request.method == 'POST': if request.method == 'POST':
form = PeerAllowedIPForm(request.POST or None, instance=current_ip, current_peer=current_peer, config_file=config_file) form = PeerAllowedIPForm(request.POST or None, instance=current_ip, current_peer=current_peer, config_file=config_file)
@ -242,9 +242,9 @@ def view_manage_ip_address(request):
current_peer.wireguard_instance.pending_changes = True current_peer.wireguard_instance.pending_changes = True
current_peer.wireguard_instance.save() current_peer.wireguard_instance.save()
if current_ip: if current_ip:
messages.success(request, 'IP address updated|IP address updated successfully.') messages.success(request, _('IP address updated|IP address updated successfully.'))
else: else:
messages.success(request, 'IP address added|IP address added successfully.') messages.success(request, _('IP address added|IP address added successfully.'))
return redirect('/peer/manage/?peer=' + str(current_peer.uuid)) return redirect('/peer/manage/?peer=' + str(current_peer.uuid))
else: else:
form = PeerAllowedIPForm(instance=current_ip, current_peer=current_peer) form = PeerAllowedIPForm(instance=current_ip, current_peer=current_peer)