1
0
mirror of https://github.com/fHDHR/fHDHR_NextPVR.git synced 2025-12-06 11:16:58 -05:00

Use session to store the DeviceAuth

This commit is contained in:
deathbybandaid 2020-12-20 11:22:46 -05:00
parent 2cd30a38ca
commit e3a264f24e
2 changed files with 7 additions and 3 deletions

View File

@ -71,12 +71,17 @@ class fHDHR_HTTP_Server():
if session["is_plexmediaserver"]:
self.fhdhr.logger.debug("Client is a Plex Media Server.")
session["deviceauth"] = self.detect_plexmediaserver(request)
self.fhdhr.logger.debug("Client %s requested %s Opening" % (request.method, request.path))
def after_request(self, response):
self.fhdhr.logger.debug("Client %s requested %s Closing" % (request.method, request.path))
return response
def detect_deviceauth(self, request):
return request.args.get('DeviceAuth', default=None, type=str)
def detect_mobile(self, request):
user_agent = request.headers.get('User-Agent')
phones = ["iphone", "android", "blackberry"]

View File

@ -1,4 +1,4 @@
from flask import Response, request, redirect
from flask import Response, request, redirect, session
import xml.etree.ElementTree
from io import BytesIO
import urllib.parse
@ -30,8 +30,7 @@ class xmlTV():
def get(self, *args):
if self.fhdhr.config.dict["fhdhr"]["require_auth"]:
DeviceAuth = request.args.get('DeviceAuth', default=None, type=str)
if DeviceAuth != self.fhdhr.config.dict["fhdhr"]["device_auth"]:
if session["deviceauth"] != self.fhdhr.config.dict["fhdhr"]["device_auth"]:
return "not subscribed"
base_url = request.url_root[:-1]