mirror of https://github.com/snachodog/mybuddy.git
Black
This commit is contained in:
parent
a37258db1a
commit
643c9bec13
|
@ -9,6 +9,7 @@ from django.utils import timezone, translation
|
||||||
from django.contrib.auth.middleware import RemoteUserMiddleware
|
from django.contrib.auth.middleware import RemoteUserMiddleware
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
|
|
||||||
|
|
||||||
class UserLanguageMiddleware:
|
class UserLanguageMiddleware:
|
||||||
"""
|
"""
|
||||||
Customizes settings based on user language setting.
|
Customizes settings based on user language setting.
|
||||||
|
@ -113,6 +114,7 @@ class HomeAssistant:
|
||||||
)
|
)
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
request.is_homeassistant_ingress_request = (
|
request.is_homeassistant_ingress_request = (
|
||||||
|
@ -120,10 +122,6 @@ class HomeAssistant:
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.use_x_ingress_path_rewrite:
|
if self.use_x_ingress_path_rewrite:
|
||||||
request.build_absolute_uri = wrap_x_ingress_path(
|
request.build_absolute_uri = wrap_x_ingress_path(request.build_absolute_uri)
|
||||||
request.build_absolute_uri
|
|
||||||
)
|
|
||||||
|
|
||||||
return self.get_response(request)
|
return self.get_response(request)
|
||||||
|
|
||||||
|
|
|
@ -255,17 +255,12 @@ class UserAddDevice(LoginRequiredMixin, View):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
session_cookies = {}
|
session_cookies = {}
|
||||||
if request.is_homeassistant_ingress_request:
|
if request.is_homeassistant_ingress_request:
|
||||||
session_cookies["ingress_session"] = (
|
session_cookies["ingress_session"] = request.COOKIES.get("ingress_session")
|
||||||
request.COOKIES.get("ingress_session")
|
|
||||||
)
|
|
||||||
|
|
||||||
qr_code_response = render(
|
qr_code_response = render(
|
||||||
request,
|
request,
|
||||||
self.qr_code_template,
|
self.qr_code_template,
|
||||||
{
|
{"session_cookies": json.dumps(session_cookies)},
|
||||||
"session_cookies": json.dumps(session_cookies)
|
|
||||||
}
|
|
||||||
|
|
||||||
)
|
)
|
||||||
qr_code_data = qr_code_response.content.decode().strip()
|
qr_code_data = qr_code_response.content.decode().strip()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue