mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Proxy token check through server
This commit is contained in:
parent
c39f89356c
commit
d943877e76
3 changed files with 12 additions and 6 deletions
|
@ -2737,12 +2737,8 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "https://plex.tv/api/resources",
|
url: "check_pms_token",
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
dataType: 'json',
|
|
||||||
beforeSend: function (xhr) {
|
|
||||||
xhr.setRequestHeader('X-Plex-Token', $('#pms_token').val());
|
|
||||||
},
|
|
||||||
statusCode: {
|
statusCode: {
|
||||||
401: function (xhr, status) {
|
401: function (xhr, status) {
|
||||||
$("#updatebar").hide();
|
$("#updatebar").hide();
|
||||||
|
|
|
@ -277,13 +277,14 @@ class PlexTV(object):
|
||||||
|
|
||||||
return request
|
return request
|
||||||
|
|
||||||
def get_plextv_resources(self, include_https=False, output_format=''):
|
def get_plextv_resources(self, include_https=False, return_response=False, output_format=''):
|
||||||
if include_https:
|
if include_https:
|
||||||
uri = '/api/resources?includeHttps=1'
|
uri = '/api/resources?includeHttps=1'
|
||||||
else:
|
else:
|
||||||
uri = '/api/resources'
|
uri = '/api/resources'
|
||||||
request = self.request_handler.make_request(uri=uri,
|
request = self.request_handler.make_request(uri=uri,
|
||||||
request_type='GET',
|
request_type='GET',
|
||||||
|
return_response=return_response,
|
||||||
output_format=output_format)
|
output_format=output_format)
|
||||||
|
|
||||||
return request
|
return request
|
||||||
|
|
|
@ -3414,6 +3414,15 @@ class WebInterface(object):
|
||||||
|
|
||||||
return {'result': 'success', 'message': 'Settings saved.'}
|
return {'result': 'success', 'message': 'Settings saved.'}
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
@cherrypy.tools.json_out()
|
||||||
|
@requireAuth(member_of("admin"))
|
||||||
|
def check_pms_token(self, **kwargs):
|
||||||
|
plex_tv = plextv.PlexTV()
|
||||||
|
response = plex_tv.get_plextv_resources(return_response=True)
|
||||||
|
if not response.ok:
|
||||||
|
cherrypy.response.status = 401
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue