wireguard: Move segno import inside method

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
James Valleroy 2026-06-13 10:55:06 -04:00
parent efcdc8cb5c
commit 629cc866b6
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -3,7 +3,6 @@
Views for WireGuard application. Views for WireGuard application.
""" """
import segno
import urllib.parse import urllib.parse
from django.contrib import messages from django.contrib import messages
@ -109,16 +108,15 @@ class SessionClientDataMixin:
"""Rebuild client config from session.""" """Rebuild client config from session."""
data = self.get_session_client_data(request) data = self.get_session_client_data(request)
return utils.build_client_config( return utils.build_client_config(data['next_ip'], data['privkey'],
data['next_ip'], data['privkey'], data['pubkey'], data['endpoint'])
data['pubkey'], data['endpoint']
)
class ClientActionsView(SessionClientDataMixin, View): class ClientActionsView(SessionClientDataMixin, View):
action = None action = None
def get(self, request): def get(self, request):
import segno
if self.action == 'download': if self.action == 'download':
config = self.get_client_config(request) config = self.get_client_config(request)
response = HttpResponse(config, content_type='text/plain') response = HttpResponse(config, content_type='text/plain')