parent
faac5bb05a
commit
b44472a203
Binary file not shown.
@ -1,22 +1,60 @@
|
||||
<?php
|
||||
|
||||
use Fuel\Core\Controller_Template;
|
||||
use Fuel\Core\Response;
|
||||
use Fuel\Core\Session;
|
||||
use Fuel\Core\View;
|
||||
|
||||
class Controller_Admin extends Controller_Home
|
||||
class Controller_Admin extends Controller_Template
|
||||
{
|
||||
public $template = 'admin/body';
|
||||
|
||||
public function before()
|
||||
{
|
||||
parent::before();
|
||||
|
||||
$user = Session::get('user');
|
||||
|
||||
if(!$user->admin)
|
||||
if(!$user)
|
||||
Response::redirect('/login');
|
||||
|
||||
if(!$user->admin)
|
||||
Response::redirect('/home');
|
||||
|
||||
$this->template->user = Session::get('user');
|
||||
|
||||
$this->template->js_bottom = [];
|
||||
}
|
||||
|
||||
public function action_index()
|
||||
{
|
||||
Response::forge(View::forge('admin/index'));
|
||||
$body = View::forge('admin/index');
|
||||
|
||||
$this->template->body = $body;
|
||||
}
|
||||
|
||||
public function action_servers()
|
||||
{
|
||||
$this->template->js_bottom = ['plex_alert.js', 'server_refresh.js'];
|
||||
|
||||
$body = View::forge('admin/servers');
|
||||
|
||||
$servers = Model_Server::find_all();
|
||||
|
||||
$body->set('servers', $servers);
|
||||
|
||||
$this->template->body = $body;
|
||||
}
|
||||
|
||||
public function action_users()
|
||||
{
|
||||
$this->template->js_bottom = ['plex_alert.js'];
|
||||
|
||||
$body = View::forge('admin/users');
|
||||
|
||||
$users = Model_User::find_all();
|
||||
|
||||
$body->set('users', $users);
|
||||
|
||||
$this->template->body = $body;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Fuel\Core\Session;
|
||||
use Fuel\Core\View;
|
||||
|
||||
class Controller_Admin_Libraries extends Controller_Admin
|
||||
{
|
||||
public function action_index()
|
||||
{
|
||||
$this->template->js_bottom = ['plex_alert.js', 'server_refresh.js'];
|
||||
|
||||
$body = View::forge('admin/libraries');
|
||||
|
||||
$libraries = Model_Library::find_all();
|
||||
|
||||
$body->set('libraries', $libraries);
|
||||
|
||||
$this->template->body = $body;
|
||||
}
|
||||
|
||||
public function action_permissions()
|
||||
{
|
||||
$this->template->js_bottom = ['plex_alert.js'];
|
||||
|
||||
$body = View::forge('admin/libraries/permissions');
|
||||
|
||||
$library_id = $this->param('library_id');
|
||||
|
||||
$permissions = Model_Permission::find_all();
|
||||
|
||||
$body->set('permissions', $permissions);
|
||||
$body->set('user', Session::get('user'));
|
||||
|
||||
$this->template->body = $body;
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace Fuel\Tasks;
|
||||
|
||||
use Exception;
|
||||
use Fuel\Core\FuelException;
|
||||
use Model_Library;
|
||||
use Model_Season;
|
||||
use Model_Server;
|
||||
use Model_Tvshow;
|
||||
use function time;
|
||||
use Fuel\Core\Request;
|
||||
use function var_dump;
|
||||
|
||||
class Server
|
||||
{
|
||||
|
||||
public function run($message = 'Hello!')
|
||||
{
|
||||
echo $message;
|
||||
}
|
||||
|
||||
public function ping()
|
||||
{
|
||||
$servers = Model_Server::find();
|
||||
|
||||
foreach ($servers as $server) {
|
||||
try {
|
||||
$curl = Request::forge('http://' . $server->url . ($server->port ? ':' . $server->port : '') . '?X-Plex-Token=' . $server->token, 'curl');
|
||||
$curl->execute();
|
||||
|
||||
if ($curl->response()->status !== 200)
|
||||
throw new FuelException('No session found!');
|
||||
|
||||
$server->set([
|
||||
'lastcheck' => time(),
|
||||
'online' => 1
|
||||
]);
|
||||
|
||||
$server->save();
|
||||
} catch (Exception $exception) {
|
||||
$server->set([
|
||||
'lastcheck' => time(),
|
||||
'online' => 0
|
||||
]);
|
||||
|
||||
$server->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function browseServers()
|
||||
{
|
||||
$time = ini_get('max_execution_time');
|
||||
|
||||
$servers = Model_Server::find_all();
|
||||
|
||||
if($time > 0 && $time < ($servers * 5 * 60)) {
|
||||
ini_set('max_execution_time', 5 * $servers);
|
||||
}
|
||||
|
||||
foreach ($servers as $server) {
|
||||
try {
|
||||
Model_Server::BrowseServeur([$server]);
|
||||
} catch (Exception $exception) {
|
||||
echo 'Server: ' . $server->name . ' ERROR: ' . $exception->getMessage() . "\n\r";
|
||||
}
|
||||
try {
|
||||
$this->browseLibraries($server);
|
||||
} catch (Exception $exception) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function browseLibraries($server)
|
||||
{
|
||||
Model_Library::BrowseLibraries($server);
|
||||
|
||||
$this->browseSubContent($server);
|
||||
}
|
||||
|
||||
private function browseSubContent($server)
|
||||
{
|
||||
$libraries = Model_Library::find_by('server_id',$server->id);
|
||||
|
||||
foreach ($libraries as $library) {
|
||||
Model_Library::getSectionsContent($server, $library);
|
||||
}
|
||||
|
||||
$this->browseSeasons($server);
|
||||
}
|
||||
|
||||
private function browseSeasons($server)
|
||||
{
|
||||
$server_id = $server->id;
|
||||
|
||||
$tv_shows = Model_Tvshow::find(function ($query) use ($server_id) {
|
||||
$query
|
||||
->select('tvshow.*')
|
||||
->join('library')
|
||||
->on('tvshow.library_id', '=', 'library.id')
|
||||
->where('library.server_id', $server_id)
|
||||
;
|
||||
});
|
||||
|
||||
foreach ($tv_shows as $tv_show) {
|
||||
Model_Tvshow::getTvShowSeasons($server,$tv_show);
|
||||
}
|
||||
|
||||
$this->browseMovies($server);
|
||||
}
|
||||
|
||||
private function browseMovies($server)
|
||||
{
|
||||
$server_id = $server->id;
|
||||
|
||||
$seasons = Model_Season::find(function ($query) use ($server_id) {
|
||||
$query
|
||||
->select('season.*')
|
||||
->join('tvshow')
|
||||
->on('season.tv_show_id', '=', 'tvshow.id')
|
||||
->join('library')
|
||||
->on('tvshow.library_id', '=', 'library.id')
|
||||
->where('library.server_id', $server_id)
|
||||
;
|
||||
});
|
||||
|
||||
foreach ($seasons as $season) {
|
||||
Model_Season::getMovies($server,$season);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
<head>
|
||||
<title>PlexShare :: Administration</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<?php
|
||||
echo \Asset::css(['normalize.css', 'plex.css', 'settings.css']);
|
||||
echo \Asset::js('jquery.min.js');
|
||||
?>
|
||||
<link rel="shortcut icon"
|
||||
href="//assets.plex.tv/deploys/desktop/env-eb2798cc3c7d9533df5b563963d5c394/3.34.1-b51c37a/favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<div id="plex" class="application">
|
||||
<?php echo \View::forge('layout/nav_bar_header', ['user' => $user]); ?>
|
||||
<div class="background-container">
|
||||
<div data-reactroot="" class="FullPage-container-17Y0c">
|
||||
<div>
|
||||
<div>
|
||||
<div style="background-image: url('//assets.plex.tv/deploys/desktop/env-eb2798cc3c7d9533df5b563963d5c394/3.41.1-304f788/common/img/backgrounds/preset-dark.64cc1c942221cd2c153244bd8ecfb67a.png'); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;"
|
||||
class=""></div>
|
||||
</div>
|
||||
<div style="position: absolute; width: 100%; height: 100%; background: rgba(0, 0, 0, 0) url('//assets.plex.tv/deploys/desktop/env-eb2798cc3c7d9533df5b563963d5c394/3.41.1-304f788/common/img/backgrounds/noise.8b05ce45d0df59343e206bc9ae78d85d.png') repeat scroll 0% 0%; z-index: 2;"></div>
|
||||
</div></div>
|
||||
</div>
|
||||
<div id="content" class="scroll-container dark-scrollbar">
|
||||
<div class="container">
|
||||
<ul class="nav nav-header pull-right">
|
||||
<li class="web-nav-item"><a class="web-btn btn-gray" href="/admin">General</a></li>
|
||||
<li class="server-nav-item "><a class="server-btn btn-gray" href="/admin/servers">All Servers<span class="badge">0</span></a></li>
|
||||
<li class="users-nav-item "><a class="users-btn btn-gray" href="/admin/libraries">All Libraries<span class="badge">0</span></a></li>
|
||||
<li class="devices-nav-item "><a class="devices-btn btn-gray" href="/admin/users">Users</a></li>
|
||||
</ul>
|
||||
<h2>Administration</h2>
|
||||
<?php echo $body; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo \Asset::js(isset($js_bottom) ? $js_bottom : null);
|
||||
echo \Asset::js(['bootstrap.min.js']);
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip({ container: 'body'});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,83 @@
|
||||
<div class="settings-container">
|
||||
<div class="web-settings-container show-advanced">
|
||||
<div class="filter-bar"></div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-md-3">
|
||||
<ul class="settings-nav nav nav-cards">
|
||||
<li><a class="card btn-gray selected" href="#general-web-group">General</a></li>
|
||||
<li><a class="card btn-gray" href="#quality-web-group">Sub Account</a></li>
|
||||
<li><a class="card btn-gray" href="#player-web-group">Player</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-8 col-md-9">
|
||||
<form id="web-settings-form">
|
||||
<div id="general-web-group" class="settings-group active">
|
||||
<h4 class="version-title"> Version 0.1A </h4>
|
||||
<div class="form-group">
|
||||
<label for="language">Language</label>
|
||||
<select id="language">
|
||||
<option value="en" selected=""> English</option>
|
||||
<option value="fr"> Français</option>
|
||||
</select>
|
||||
<p class="help-block">
|
||||
Aidez-nous à traduire cette application dans votre langue <a href="https://transifex.com/plex-1/plex-web" target="_blank">ici</a>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="input_FriendlyName_c">
|
||||
Second refresh
|
||||
</label>
|
||||
<input id="input_FriendlyName_c" class="form-control" name="refresh" value="" placeholder="ex: 800" type="text">
|
||||
<p class="help-block">Number in second, you want to check new content on server.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="player-web-group" class="settings-group"><h4 class="settings-header-first ">Audio &
|
||||
sous-titres</h4>
|
||||
<div class="form-group advanced-setting"><label for="audioBoost">Augmenter le volume du son
|
||||
multi-canal</label> <select id="audioBoost" data-type="int">
|
||||
<option value="100" selected="">Aucun</option>
|
||||
<option value="150">Petite</option>
|
||||
<option value="200">Grande</option>
|
||||
<option value="250">Énorme</option>
|
||||
</select>
|
||||
<p class="help-block">Augmente le volume si le son est converti de multi-canal à
|
||||
stéréo.</p></div>
|
||||
<div class="form-group"><label for="subtitleSize">Taille des sous-titres</label> <select
|
||||
id="subtitleSize" data-type="int">
|
||||
<option value="50">Minuscule</option>
|
||||
<option value="75">Petite</option>
|
||||
<option value="100" selected="">Normale</option>
|
||||
<option value="125">Grande</option>
|
||||
<option value="200">Énorme</option>
|
||||
</select></div>
|
||||
<div class="form-group advanced-setting"><label for="subtitlesBurnLevel">Incruster les
|
||||
sous-titres</label> <select id="subtitlesBurnLevel">
|
||||
<option value="auto" selected="">Automatique</option>
|
||||
<option value="avoid">Seulement le format des images</option>
|
||||
<option value="always">Toujours</option>
|
||||
</select>
|
||||
<p class="help-block">Détermine si le serveur doit incruster les sous-titres lors de
|
||||
l'encodage, en fonction du format des sous-titres. Eviter l'incrustation des
|
||||
sous-titres améliore les performances du serveur, mais n'est possible qu'avec le
|
||||
lecteur HTML5.</p></div>
|
||||
<h4 class="settings-header">Bonus</h4>
|
||||
<div class="form-group"><label for="extrasPrefixCount">Bandes annonces de Cinema avant le
|
||||
film</label> <select id="extrasPrefixCount" data-type="int">
|
||||
<option value="0" selected="">Aucun</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
</select></div>
|
||||
</div>
|
||||
<div class="form-footer">
|
||||
<button type="submit" class="submit-btn btn btn-lg btn-primary btn-loading disabled">
|
||||
<div class="loading loading-sm"></div>
|
||||
<span class="btn-label">Enregistrer les modifications</span></button>
|
||||
<span class="form-message"></span></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,172 @@
|
||||
<div class="settings-container">
|
||||
<div class="filter-bar">
|
||||
<div class="filter-bar-right">
|
||||
<button class="toggle-advanced-btn btn btn-sm btn-default refresh">Refresh Libraries <i class="glyphicon refresh"></i></button>
|
||||
</div>
|
||||
<span id="primary-server-dropdown" class="dropdown">
|
||||
<a class="dropdown-toggle" href="#primary-server-dropdown" data-toggle="dropdown">
|
||||
<span class="dropdown-friendly-name">HF-Server</span> <i class="caret-icon"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a data-id="df1de861fbaba243c18ed9275fd42e3248d19336" href="#">
|
||||
<span class="dropdown-truncated-label">Chewbaka</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-id="11f086036e179128e7b077495e238d1c922d605c" href="#">
|
||||
<span class="dropdown-truncated-label">HF-Server</span>
|
||||
<i class="dropdown-selected-icon glyphicon ok-2"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
<div class="devices-container row">
|
||||
<div class="device-list-container col-sm-12 col-md-12">
|
||||
<ul class="list card-tile-list">
|
||||
<?php if($libraries) : ?>
|
||||
<?php foreach ($libraries as $library) : ?>
|
||||
<li class="card-tile-list-item card-3-col-item">
|
||||
<div class="card card-device <?php echo $library->disable ? 'disabled' : ''; ?>">
|
||||
<div class="card-actions">
|
||||
<a href="/settings/libraries/premissions/<?php echo $library->id; ?>">
|
||||
<button class="permissions-library-btn card-action-btn" data-library-id="<?php echo $library->id; ?>"
|
||||
data-toggle="tooltip" data-original-title="Permissions">
|
||||
<i class="glyphicon unlock"></i>
|
||||
</button>
|
||||
</a>
|
||||
<button class="refresh-library-btn card-action-btn btn-info" data-library-id="<?php echo $library->id; ?>"
|
||||
data-toggle="tooltip" data-original-title="Refresh">
|
||||
<i class="glyphicon refresh"></i>
|
||||
</button>
|
||||
<?php if($library->disable) : ?>
|
||||
<button class="enable-library-btn card-action-btn btn-success" data-library-id="<?php echo $library->id; ?>"
|
||||
data-toggle="tooltip" data-original-title="Enable">
|
||||
<i class="glyphicon ok-2"></i>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button class="disable-library-btn card-action-btn btn-danger" data-library-id="<?php echo $library->id; ?>"
|
||||
data-toggle="tooltip" data-original-title="Disable">
|
||||
<i class="glyphicon ban"></i>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<button class="remove-library-btn card-action-btn btn-danger" data-library-id="<?php echo $library->id; ?>"
|
||||
data-toggle="tooltip" data-original-title="Delete">
|
||||
<i class="glyphicon remove-2"></i>
|
||||
</button>
|
||||
</div>
|
||||
<h4 class="name">
|
||||
<?php echo $library->name; ?>
|
||||
<span class="glyphicon <?php echo $library->disable ? 'ban text-danger' : 'ok-2 text-success'; ?>" data-toggle="tooltip" data-original-title="<?php echo $library->disable ? 'Disabled' : 'Enabled'; ?>"></span>
|
||||
</h4>
|
||||
<div class="card-details">
|
||||
<div class="pull-right">
|
||||
<div class="last-seen text-muted"><i class="plex-icon-watch-later-560"></i> <?php echo $library->getLastUpdate(); ?></div>
|
||||
<span class="sync-info hidden">
|
||||
<span class="glyphicon circle-arrow-down sync-icon"></span>
|
||||
<span class="sync-count">123</span> / <span class="sync-size">456</span>
|
||||
</span>
|
||||
</div>
|
||||
<span class="version text-muted"><?php echo $library->type; ?></span>
|
||||
<div class="device-info-container">
|
||||
<div class="product"><?php echo $library->getServer()->name; ?></div>
|
||||
<div class="device text-muted"></div>
|
||||
<div class="platform-info text-muted">
|
||||
<span class="platform">Linux</span>
|
||||
<span class="platform-version">Debian 8</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.filter-bar .add').on('click', function () {
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/settings/add_server.json'
|
||||
}).done(function (data) {
|
||||
$('body').append(data);
|
||||
setTimeout(function(){
|
||||
$('.media-server-modal').removeClass('out').addClass('in');
|
||||
},100);
|
||||
});
|
||||
});
|
||||
$(document).on('click', '.media-server-modal button.close', function () {
|
||||
$('.media-server-modal').removeClass('in').addClass('out').delay(500).queue(function(){ $(this).remove()});
|
||||
});
|
||||
$(document).on('click', '#add-plex button', function () {
|
||||
var url = $('#add-plex #url').val();
|
||||
var port = $('#add-plex #port').val();
|
||||
var token = $('#add-plex #token').val();
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '/rest/settings/server.json',
|
||||
data: {url: url, port: port, token: token}
|
||||
}).done(function (data) {
|
||||
show_alert('success', 'Server save succesfully!');
|
||||
$('.media-server-modal button.close').click();
|
||||
}).fail(function (data) {
|
||||
data = JSON.parse(data.responseText);
|
||||
show_alert('error', data.message);
|
||||
setTimeout(function(){location.reload()}, 200);
|
||||
});
|
||||
});
|
||||
// LIBRARY BUTTON ACTION
|
||||
$('button.refresh-library-btn').on('click', function () {
|
||||
var library_id = $(this).data('library-id');
|
||||
ajax += 1;
|
||||
checkAjax();
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/browse/library.json',
|
||||
data: {library_id: library_id}
|
||||
}).done(function (library) {
|
||||
var server = {};
|
||||
server.id = library.server_id;
|
||||
server.name = library.server_name;
|
||||
updateLibrary(server, library);
|
||||
ajax -= 1;
|
||||
alert.toggleClass('transition-out');
|
||||
alert_status.html('Start browsing your library');
|
||||
});
|
||||
});
|
||||
$('button.disable-library-btn').on('click', function () {
|
||||
var button = this;
|
||||
var library_id = $(this).data('library-id');
|
||||
$.ajax({
|
||||
method: 'delete',
|
||||
url: '/rest/settings/library.json',
|
||||
data: {library_id: library_id}
|
||||
}).done(function (data) {
|
||||
show_alert('success', 'Library disable succesfully!');
|
||||
$(button).closest('.card.card-device').addClass('disabled');
|
||||
}).fail(function (data) {
|
||||
data = JSON.parse(data.responseText);
|
||||
show_alert('error', data.message);
|
||||
});
|
||||
});
|
||||
|
||||
// REFRESH ALL LIBRARIES
|
||||
$('.filter-bar .refresh').on('click', function () {
|
||||
ajax += 1;
|
||||
checkAjax();
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/browse/my_servers.json'
|
||||
}).done(function (data) {
|
||||
updateServers(data);
|
||||
ajax -= 1;
|
||||
alert.toggleClass('transition-out');
|
||||
alert_status.html('Browse all your server is GOOD!');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,164 @@
|
||||
<div class="settings-container">
|
||||
<div class="filter-bar">
|
||||
<button class="toggle-advanced-btn btn btn-sm Button-primary-2LQVw pull-left add"
|
||||
data-placement="top" data-toggle="tooltip" data-original-title="Add server"><i class="glyphicon circle-plus"></i></button>
|
||||
<button class="toggle-advanced-btn btn btn-sm btn-default pull-right refresh">Refresh Servers <i class="glyphicon refresh"></i></button>
|
||||
</div>
|
||||
<div class="devices-container row">
|
||||
<div class="device-list-container col-sm-12 col-md-12">
|
||||
<ul class="list card-tile-list">
|
||||
<?php if($servers) : ?>
|
||||
<?php foreach ($servers as $server) : ?>
|
||||
<li class="card-tile-list-item card-2-col-item">
|
||||
<div class="card card-device">
|
||||
<img class="card-poster device-icon" src="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTEwIDExMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGZpbGw9IiNlNWEwMGQiIGQ9Im0wIDBoMTEwdjExMGgtMTEweiIvPjxwYXRoIGQ9Im0zMCA2MGMxNi41NjkgMCAzMC0xMy40MzEgMzAtMzAgMC0xNi41NjktMTMuNDMxLTMwLTMwLTMwLTE2LjU2OSAwLTMwIDEzLjQzMS0zMCAzMCAwIDE2LjU2OSAxMy40MzEgMzAgMzAgMzBtLS41NzEtNDguNzJsMTIuMTQ5IDE4Ljc0OS0xMi4xNSAxOC43NWgtNS41MDQtNS41MDR2LS4wMDRsMTIuMTQ3LTE4Ljc0Ni0xMi4xNDctMTguNzQ2di0uMDAyaDExLjAxIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNSAyNSkiIGZpbGw9IiMxZjFmMWYiLz48L2c+PC9zdmc+">
|
||||
<div class="card-actions">
|
||||
<button class="refresh-server-btn card-action-btn btn-info" data-server-id="<?php echo $server->id; ?>"
|
||||
data-placement="top" data-toggle="tooltip" data-original-title="Refresh">
|
||||
<i class="glyphicon refresh"></i>
|
||||
</button>
|
||||
<button class="edit-server-btn card-action-btn" data-server-id="<?php echo $server->id; ?>"
|
||||
data-placement="top" data-toggle="tooltip" data-original-title="Edit">
|
||||
<i class="glyphicon pencil"></i>
|
||||
</button>
|
||||
<button class="disable-server-btn card-action-btn btn-danger" data-server-id="<?php echo $server->id; ?>"
|
||||
data-placement="top" data-toggle="tooltip" data-original-title="Disable">
|
||||
<i class="glyphicon ban"></i>
|
||||
</button>
|
||||
<button class="remove-server-btn card-action-btn btn-danger" data-server-id="<?php echo $server->id; ?>"
|
||||
data-placement="top" data-toggle="tooltip" data-original-title="Delete">
|
||||
<i class="glyphicon remove-2"></i>
|
||||
</button>
|
||||
</div>
|
||||
<h4 class="name"><?php echo $server->name; ?> <span data-placement="top" data-toggle="tooltip" data-original-title="<?php echo $server->online ? 'online' : 'offline' ; ?>" class="glyphicon <?php echo $server->online ? 'server text-success' : 'server-ban text-danger' ; ?>"></span></h4>
|
||||
<div class="card-details">
|
||||
<div class="pull-right">
|
||||
<div class="last-seen text-muted"><i class="plex-icon-watch-later-560"></i> <?php echo $server->getLastCheck(); ?></div>
|
||||
<span class="sync-info hidden">
|
||||
<span class="glyphicon circle-arrow-down sync-icon"></span>
|
||||
<span class="sync-count">123</span> / <span class="sync-size">456</span>
|
||||
</span>
|
||||
</div>
|
||||
<span class="version text-muted"><?php echo $server->version; ?></span>
|
||||
<div class="device-info-container">
|
||||
<div class="product">Plex Media Server</div>
|
||||
<div class="device text-muted"></div>
|
||||
<div class="platform-info text-muted">
|
||||
<span class="platform"><?php echo $server->plateforme; ?></span>
|
||||
<span class="platform-version"><?php echo $server->platformVersion; ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.filter-bar .add').on('click', function () {
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/settings/modal_server.json'
|
||||
}).done(function (data) {
|
||||
$('body').append(data);
|
||||
setTimeout(function(){
|
||||
$('.media-server-modal').removeClass('out').addClass('in');
|
||||
},100);
|
||||
});
|
||||
});
|
||||
$(document).on('click', '.media-server-modal button.close', function () {
|
||||
$('.media-server-modal').removeClass('in').addClass('out').delay(500).queue(function(){ $(this).remove()});
|
||||
});
|
||||
// ADD OR EDIT SERVER
|
||||
$(document).on('click', '#add-plex button', function () {
|
||||
var server_id = $('#add-plex #server_id').val();
|
||||
var url = $('#add-plex #url').val();
|
||||
var port = $('#add-plex #port').val();
|
||||
var token = $('#add-plex #token').val();
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '/rest/settings/server.json',
|
||||
data: {server_id: server_id, url: url, port: port, token: token}
|
||||
}).done(function (data) {
|
||||
show_alert('success', 'Server save succesfully!');
|
||||
$('.media-server-modal button.close').click();
|
||||
}).fail(function (data) {
|
||||
data = JSON.parse(data.responseText);
|
||||
show_alert('error', data.message);
|
||||
setTimeout(function(){location.reload()}, 200);
|
||||
});
|
||||
});
|
||||
// SERVER BUTTON ACTION
|
||||
$('button.refresh-server-btn').on('click', function () {
|
||||
var server_id = $(this).data('server-id');
|
||||
ajax += 1;
|
||||
checkAjax();
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/browse/server.json',
|
||||
data: {server_id: server_id}
|
||||
}).done(function (data) {
|
||||
updateServers(data);
|
||||
ajax -= 1;
|
||||
alert.toggleClass('transition-out');
|
||||
alert_status.html('Browse all your server is GOOD!');
|
||||
});
|
||||
});
|
||||
$('button.edit-server-btn').on('click', function () {
|
||||
var server_id = $(this).data('server-id');
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/settings/modal_server.json'
|
||||
}).done(function (modal) {
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/browse/server.json',
|
||||
data: {server_id: server_id}
|
||||
}).done(function (server) {
|
||||
$('body').append(modal);
|
||||
setTimeout(function(){
|
||||
$('#add-plex #server_id').val(server[0].id);
|
||||
$('#add-plex #url').val(server[0].url);
|
||||
$('#add-plex #port').val(server[0].port);
|
||||
$('#add-plex #token').val(server[0].token);
|
||||
$('.media-server-modal').removeClass('out').addClass('in');
|
||||
},100);
|
||||
});
|
||||
});
|
||||
});
|
||||
$('button.disable-server-btn').on('click', function () {
|
||||
var button = this;
|
||||
var server_id = $(this).data('server-id');
|
||||
$.ajax({
|
||||
method: 'delete',
|
||||
url: '/rest/settings/server.json',
|
||||
data: {server_id: server_id}
|
||||
}).done(function (data) {
|
||||
show_alert('success', 'Server disable succesfully!');
|
||||
$(button).closest('li').get(0).remove();
|
||||
}).fail(function (data) {
|
||||
data = JSON.parse(data.responseText);
|
||||
show_alert('error', data.message);
|
||||
});
|
||||
});
|
||||
|
||||
// REFRESH ALL SERVER
|
||||
$('.filter-bar .refresh').on('click', function () {
|
||||
ajax += 1;
|
||||
checkAjax();
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/browse/my_servers.json'
|
||||
}).done(function (data) {
|
||||
updateServers(data);
|
||||
ajax -= 1;
|
||||
alert.toggleClass('transition-out');
|
||||
alert_status.html('Browse all your server is GOOD!');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,125 @@
|
||||
<div class="settings-container">
|
||||
<div class="filter-bar">
|
||||
</div>
|
||||
<div class="devices-container row">
|
||||
<div class="device-list-container col-sm-12 col-md-12">
|
||||
<ul class="list card-tile-list">
|
||||
<?php if($users) : ?>
|
||||
<?php foreach ($users as $user) : ?>
|
||||
<li class="card-tile-list-item card-3-col-item">
|
||||
<div class="card card-device <?php echo $user->disable ? 'disabled' : ''; ?>">
|
||||
<div class="card-actions">
|
||||
<a href="/settings/users/premissions/<?php echo $user->id; ?>">
|
||||
<button class="permissions-user-btn card-action-btn" data-library-id="<?php echo $user->id; ?>"
|
||||
data-toggle="tooltip" data-original-title="Permissions">
|
||||
<i class="glyphicon unlock"></i>
|
||||
</button>
|
||||
</a>
|
||||
<?php if($user->disable) : ?>
|
||||
<button class="enable-user-btn card-action-btn btn-success" data-library-id="<?php echo $user->id; ?>"
|
||||
data-toggle="tooltip" data-original-title="Enable">
|
||||
<i class="glyphicon ok-2"></i>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button class="disable-user-btn card-action-btn btn-danger" data-library-id="<?php echo $user->id; ?>"
|
||||
data-toggle="tooltip" data-original-title="Disable">
|
||||
<i class="glyphicon ban"></i>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<button class="remove-user-btn card-action-btn btn-danger" data-library-id="<?php echo $user->id; ?>"
|
||||
data-toggle="tooltip" data-original-title="Delete">
|
||||
<i class="glyphicon remove-2"></i>
|
||||
</button>
|
||||
</div>
|
||||
<h4 class="name">
|
||||
<?php echo $user->username; ?>
|
||||
<span class="glyphicon <?php echo $user->disable ? 'ban text-danger' : 'ok-2 text-success'; ?>" data-toggle="tooltip" data-original-title="<?php echo $user->disable ? 'Disabled' : 'Enabled'; ?>"></span>
|
||||
</h4>
|
||||
<div class="card-details">
|
||||
<div class="pull-right">
|
||||
<div class="last-seen text-muted" data-toggle="tooltip" data-original-title="Last login">
|
||||
<i class="plex-icon-watch-later-560"></i> <?php echo $user->getLastLogin(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<span class="version text-muted"><?php echo $user->email; ?></span>
|
||||
<div class="device-info-container">
|
||||
<div class="product"><?php echo $user->admin ? 'Admin' : 'User'; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.filter-bar .add').on('click', function () {
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/settings/add_server.json'
|
||||
}).done(function (data) {
|
||||
$('body').append(data);
|
||||
setTimeout(function(){
|
||||
$('.media-server-modal').removeClass('out').addClass('in');
|
||||
},100);
|
||||
});
|
||||
});
|
||||
$(document).on('click', '.media-server-modal button.close', function () {
|
||||
$('.media-server-modal').removeClass('in').addClass('out').delay(500).queue(function(){ $(this).remove()});
|
||||
});
|
||||
$(document).on('click', '#add-plex button', function () {
|
||||
var url = $('#add-plex #url').val();
|
||||
var port = $('#add-plex #port').val();
|
||||
var token = $('#add-plex #token').val();
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '/rest/settings/server.json',
|
||||
data: {url: url, port: port, token: token}
|
||||
}).done(function (data) {
|
||||
show_alert('success', 'Server save succesfully!');
|
||||
$('.media-server-modal button.close').click();
|
||||
}).fail(function (data) {
|
||||
data = JSON.parse(data.responseText);
|
||||
show_alert('error', data.message);
|
||||
setTimeout(function(){location.reload()}, 200);
|
||||
});
|
||||
});
|
||||
// LIBRARY BUTTON ACTION
|
||||
$('button.refresh-library-btn').on('click', function () {
|
||||
var library_id = $(this).data('library-id');
|
||||
ajax += 1;
|
||||
checkAjax();
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/rest/browse/library.json',
|
||||
data: {library_id: library_id}
|
||||
}).done(function (library) {
|
||||
var server = {};
|
||||
server.id = library.server_id;
|
||||
server.name = library.server_name;
|
||||
updateLibrary(server, library);
|
||||
ajax -= 1;
|
||||
alert.toggleClass('transition-out');
|
||||
alert_status.html('Start browsing your library');
|
||||
});
|
||||
});
|
||||
$('button.disable-library-btn').on('click', function () {
|
||||
var button = this;
|
||||
var library_id = $(this).data('library-id');
|
||||
$.ajax({
|
||||
method: 'delete',
|
||||
url: '/rest/settings/library.json',
|
||||
data: {library_id: library_id}
|
||||
}).done(function (data) {
|
||||
show_alert('success', 'Library disable succesfully!');
|
||||
$(button).closest('.card.card-device').addClass('disabled');
|
||||
}).fail(function (data) {
|
||||
data = JSON.parse(data.responseText);
|
||||
show_alert('error', data.message);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue