wireguard: Get config for both download and qr actions

Re-arrange imports

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

View File

@ -3,6 +3,7 @@
Views for WireGuard application. Views for WireGuard application.
""" """
from io import BytesIO
import urllib.parse import urllib.parse
from django.contrib import messages from django.contrib import messages
@ -13,8 +14,6 @@ from django.urls import reverse_lazy
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.views.generic import FormView, TemplateView, View from django.views.generic import FormView, TemplateView, View
from io import BytesIO
from plinth import network from plinth import network
from plinth.modules.names.components import DomainName from plinth.modules.names.components import DomainName
from plinth.views import AppView from plinth.views import AppView
@ -117,8 +116,9 @@ class ClientActionsView(SessionClientDataMixin, View):
def get(self, request): def get(self, request):
import segno import segno
config = self.get_client_config(request)
if self.action == 'download': if self.action == 'download':
config = self.get_client_config(request)
response = HttpResponse(config, content_type='text/plain') response = HttpResponse(config, content_type='text/plain')
response['Content-Disposition'] = \ response['Content-Disposition'] = \
'attachment; filename="wg-client.conf"' 'attachment; filename="wg-client.conf"'