mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-17 11:10:23 +00:00
wireguard: Move segno import inside method
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
efcdc8cb5c
commit
629cc866b6
@ -3,7 +3,6 @@
|
||||
Views for WireGuard application.
|
||||
"""
|
||||
|
||||
import segno
|
||||
import urllib.parse
|
||||
|
||||
from django.contrib import messages
|
||||
@ -99,26 +98,25 @@ class SessionClientDataMixin:
|
||||
raise Http404("Session expired")
|
||||
|
||||
return {
|
||||
'next_ip': next_ip,
|
||||
'privkey': privkey,
|
||||
'pubkey': pubkey,
|
||||
'endpoint': endpoint
|
||||
}
|
||||
'next_ip': next_ip,
|
||||
'privkey': privkey,
|
||||
'pubkey': pubkey,
|
||||
'endpoint': endpoint
|
||||
}
|
||||
|
||||
def get_client_config(self, request):
|
||||
"""Rebuild client config from session."""
|
||||
data = self.get_session_client_data(request)
|
||||
|
||||
return utils.build_client_config(
|
||||
data['next_ip'], data['privkey'],
|
||||
data['pubkey'], data['endpoint']
|
||||
)
|
||||
return utils.build_client_config(data['next_ip'], data['privkey'],
|
||||
data['pubkey'], data['endpoint'])
|
||||
|
||||
|
||||
class ClientActionsView(SessionClientDataMixin, View):
|
||||
action = None
|
||||
|
||||
def get(self, request):
|
||||
import segno
|
||||
if self.action == 'download':
|
||||
config = self.get_client_config(request)
|
||||
response = HttpResponse(config, content_type='text/plain')
|
||||
@ -174,7 +172,7 @@ class AutoAddClientView(SuccessMessageMixin, FormView):
|
||||
'client_privkey': client_privkey,
|
||||
'client_pubkey': client_pubkey,
|
||||
'endpoint': endpoint
|
||||
}
|
||||
}
|
||||
|
||||
# Add properties to template context
|
||||
context['domains'] = filtered_domains
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user