mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 07:56:57 -05:00
Use session to store the DeviceAuth
This commit is contained in:
parent
2cd30a38ca
commit
e3a264f24e
@ -71,12 +71,17 @@ class fHDHR_HTTP_Server():
|
|||||||
if session["is_plexmediaserver"]:
|
if session["is_plexmediaserver"]:
|
||||||
self.fhdhr.logger.debug("Client is a Plex Media Server.")
|
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))
|
self.fhdhr.logger.debug("Client %s requested %s Opening" % (request.method, request.path))
|
||||||
|
|
||||||
def after_request(self, response):
|
def after_request(self, response):
|
||||||
self.fhdhr.logger.debug("Client %s requested %s Closing" % (request.method, request.path))
|
self.fhdhr.logger.debug("Client %s requested %s Closing" % (request.method, request.path))
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
def detect_deviceauth(self, request):
|
||||||
|
return request.args.get('DeviceAuth', default=None, type=str)
|
||||||
|
|
||||||
def detect_mobile(self, request):
|
def detect_mobile(self, request):
|
||||||
user_agent = request.headers.get('User-Agent')
|
user_agent = request.headers.get('User-Agent')
|
||||||
phones = ["iphone", "android", "blackberry"]
|
phones = ["iphone", "android", "blackberry"]
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from flask import Response, request, redirect
|
from flask import Response, request, redirect, session
|
||||||
import xml.etree.ElementTree
|
import xml.etree.ElementTree
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
@ -30,8 +30,7 @@ class xmlTV():
|
|||||||
def get(self, *args):
|
def get(self, *args):
|
||||||
|
|
||||||
if self.fhdhr.config.dict["fhdhr"]["require_auth"]:
|
if self.fhdhr.config.dict["fhdhr"]["require_auth"]:
|
||||||
DeviceAuth = request.args.get('DeviceAuth', default=None, type=str)
|
if session["deviceauth"] != self.fhdhr.config.dict["fhdhr"]["device_auth"]:
|
||||||
if DeviceAuth != self.fhdhr.config.dict["fhdhr"]["device_auth"]:
|
|
||||||
return "not subscribed"
|
return "not subscribed"
|
||||||
|
|
||||||
base_url = request.url_root[:-1]
|
base_url = request.url_root[:-1]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user