mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Add intermediary login page to view Plex XML
This commit is contained in:
parent
86cf872595
commit
66e6b9499a
5 changed files with 72 additions and 23 deletions
|
@ -3680,10 +3680,6 @@ a.no-highlight:hover {
|
|||
.login-container .form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.login-container .form-group label {
|
||||
font-weight: 400;
|
||||
color: #999;
|
||||
}
|
||||
.login-container .form-control {
|
||||
height: 38px;
|
||||
line-height: 1.5em;
|
||||
|
|
|
@ -555,12 +555,9 @@ $.fn.slideToggleBool = function(bool, options) {
|
|||
};
|
||||
|
||||
function openPlexXML(endpoint, plextv, params) {
|
||||
var data = $.extend({endpoint: endpoint, plextv: plextv}, params);
|
||||
$.getJSON('return_plex_xml_url', data, function(xml_url) {
|
||||
if (xml_url) {
|
||||
window.open(xml_url, '_blank');
|
||||
}
|
||||
});
|
||||
var data = $.extend({endpoint: endpoint, plextv: plextv || false}, params);
|
||||
var query = new URLSearchParams(data)
|
||||
window.open('open_plex_xml?' + query.toString(), '_blank');
|
||||
}
|
||||
|
||||
function PopupCenter(url, title, w, h) {
|
||||
|
|
65
data/interfaces/default/xml_shortcut.html
Normal file
65
data/interfaces/default/xml_shortcut.html
Normal file
|
@ -0,0 +1,65 @@
|
|||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Tautulli - ${title}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="${http_root}css/bootstrap3/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="${http_root}css/tautulli.css${cache_param}" rel="stylesheet">
|
||||
<link href="${http_root}css/opensans.min.css" rel="stylesheet">
|
||||
<link href="${http_root}css/font-awesome.all.min.css" rel="stylesheet">
|
||||
<link href="${http_root}css/font-awesome.v4-shims.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Favicons -->
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="${http_root}images/favicon/favicon-32x32.png?v=2.6.0">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="${http_root}images/favicon/favicon-16x16.png?v=2.6.0">
|
||||
<link rel="shortcut icon" href="${http_root}images/favicon/favicon.ico?v=2.6.0">
|
||||
</head>
|
||||
|
||||
<body style="margin: 0; overflow: auto;">
|
||||
<div class="login-body-container">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="login-container">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-sm-offset-3">
|
||||
<div id="sign-in-alert" class="alert alert-danger login-alert"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-sm-offset-3">
|
||||
<div class="form-group">
|
||||
<label for="xml_url">Plex XML URL</label>
|
||||
<input id="xml_url" class="form-control" type="text" value="${url}" />
|
||||
</div>
|
||||
<span class="remember-group">
|
||||
Sign in with Plex to view the XML
|
||||
</span>
|
||||
<button id="sign-in-plex" class="btn btn-bright login-button"><i class="fa fa-sign-in"></i> Sign In</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="${http_root}js/jquery-3.6.0.min.js"></script>
|
||||
<script src="${http_root}js/platform.min.js"></script>
|
||||
<script src="${http_root}js/script.js${cache_param}"></script>
|
||||
<script>
|
||||
function OAuthSuccessCallback(authToken) {
|
||||
var url = new URL($('#xml_url').val());
|
||||
url.searchParams.append('X-Plex-Token', authToken);
|
||||
window.location.href = url.toString();
|
||||
}
|
||||
function OAuthErrorCallback() {
|
||||
$('#sign-in-alert').text('Error communicating with Plex.tv.').show();
|
||||
}
|
||||
|
||||
$('#sign-in-plex').click(function() {
|
||||
PlexOAuth(OAuthSuccessCallback, OAuthErrorCallback);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -75,7 +75,6 @@ _CONFIG_DEFINITIONS = {
|
|||
'PMS_UPDATE_DISTRO_BUILD': (str, 'PMS', ''),
|
||||
'PMS_UPDATE_CHECK_INTERVAL': (int, 'Advanced', 24),
|
||||
'PMS_WEB_URL': (str, 'PMS', 'https://app.plex.tv/desktop'),
|
||||
'PMS_XML_SHORTCUTS': (int, 'Advanced', 0),
|
||||
'TIME_FORMAT': (str, 'General', 'HH:mm'),
|
||||
'ANON_REDIRECT': (str, 'General', ''),
|
||||
'ANON_REDIRECT_DYNAMIC': (int, 'General', 1),
|
||||
|
|
|
@ -379,26 +379,18 @@ class WebInterface(object):
|
|||
return {'result': 'error', 'message': 'Failed to terminate session.'}
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
def return_plex_xml_url(self, endpoint='', plextv=False, **kwargs):
|
||||
if not (plexpy.CONFIG.HTTP_PASSWORD and plexpy.CONFIG.PMS_XML_SHORTCUTS):
|
||||
return
|
||||
|
||||
kwargs['X-Plex-Token'] = plexpy.CONFIG.PMS_TOKEN
|
||||
|
||||
def open_plex_xml(self, endpoint='', plextv=False, **kwargs):
|
||||
if helpers.bool_true(plextv):
|
||||
base_url = 'https://plex.tv'
|
||||
else:
|
||||
if plexpy.CONFIG.PMS_URL_OVERRIDE:
|
||||
base_url = plexpy.CONFIG.PMS_URL_OVERRIDE
|
||||
else:
|
||||
base_url = plexpy.CONFIG.PMS_URL
|
||||
base_url = plexpy.CONFIG.PMS_URL_OVERRIDE or plexpy.CONFIG.PMS_URL
|
||||
|
||||
if '{machine_id}' in endpoint:
|
||||
endpoint = endpoint.format(machine_id=plexpy.CONFIG.PMS_IDENTIFIER)
|
||||
|
||||
return base_url + endpoint + '?' + urlencode(kwargs)
|
||||
url = base_url + endpoint + ('?' + urlencode(kwargs) if kwargs else '')
|
||||
return serve_template(templatename="xml_shortcut.html", title="Plex XML", url=url)
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue