Skip to content

Commit

Permalink
Merge pull request #2 from causefx/v2-develop
Browse files Browse the repository at this point in the history
V2 develop
  • Loading branch information
henrywhitaker3 committed Mar 30, 2020
2 parents 9348508 + 762374e commit b371e3d
Show file tree
Hide file tree
Showing 10 changed files with 330 additions and 310 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -151,3 +151,7 @@ api/plugins/*
# =========================
api/pages/custom/*.php
/plugins/images/tabs/eatsleep.jpg
/plugins/images/cache/tautulli-show.svg
/plugins/images/cache/tautulli-android.svg
/plugins/images/cache/tautulli-artist.png
/plugins/images/cache/tautulli-movie.svg
5 changes: 3 additions & 2 deletions api/config/default.php
Expand Up @@ -107,7 +107,7 @@
'homepagCustomHTMLtwoAuth' => '1',
'homepageDelugeEnabled' => false,
'homepageDelugeAuth' => '1',
'homepageJdownloaderEnabled' => false,
'homepageJdownloaderEnabled' => false,
'homepageJdownloaderAuth' => '1',
'homepageSabnzbdEnabled' => false,
'homepageSabnzbdAuth' => '1',
Expand Down Expand Up @@ -162,7 +162,7 @@
'homepageOrderhealthchecks' => '17',
'homepageOrderjdownloader' => '18',
'homepageOrderunifi' => '19',
'homepageOrderPihole' => '20',
'homepageOrderPihole' => '20',
'homepageOrdertautulli' => '21',
'homepageShowStreamNames' => false,
'homepageShowStreamNamesAuth' => '1',
Expand Down Expand Up @@ -279,6 +279,7 @@
'tautulliTopPlatforms' => true,
'tautulliPopularMovies' => true,
'tautulliPopularTV' => true,
'tautulliHeader' => 'Tautulli',
'homepagePiholeEnabled' => false,
'homepagePiholeAuth' => '1',
'homepagePiholeRefresh' => '10000',
Expand Down
200 changes: 98 additions & 102 deletions api/functions/homepage-connect-functions.php

Large diffs are not rendered by default.

182 changes: 95 additions & 87 deletions api/functions/homepage-functions.php
Expand Up @@ -177,30 +177,30 @@ function buildHomepageItem($homepageItem)
}
}
break;
case 'homepageOrderjdownloader':
if ($GLOBALS['homepageJdownloaderEnabled'] && qualifyRequest($GLOBALS['homepageJdownloaderAuth'])) {
if ($GLOBALS['jdownloaderCombine']) {
$item .= '
case 'homepageOrderjdownloader':
if ($GLOBALS['homepageJdownloaderEnabled'] && qualifyRequest($GLOBALS['homepageJdownloaderAuth'])) {
if ($GLOBALS['jdownloaderCombine']) {
$item .= '
<script>
// JDownloader
buildDownloaderCombined(\'jdownloader\');
homepageDownloader("jdownloader", "' . $GLOBALS['homepageDownloadRefresh'] . '");
// End JDownloader
</script>
';
} else {
$item .= '<div class="white-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
$item .= '
} else {
$item .= '<div class="white-box"><h2 class="text-center" lang="en">Loading Download Queue...</h2></div>';
$item .= '
<script>
// JDownloader
$("#' . $homepageItem . '").html(buildDownloader("jdownloader"));
homepageDownloader("jdownloader", "' . $GLOBALS['homepageDownloadRefresh'] . '");
// End JDownloader
</script>
';
}
}
break;
}
}
break;
case 'homepageOrdersabnzbd':
if ($GLOBALS['homepageSabnzbdEnabled'] && qualifyRequest($GLOBALS['homepageSabnzbdAuth'])) {
if ($GLOBALS['sabnzbdCombine']) {
Expand Down Expand Up @@ -1048,13 +1048,13 @@ function getHomepageList()
)
)
),
array(
'name' => 'JDownloader',
'enabled' => (strpos('personal', $GLOBALS['license']) !== false) ? true : false,
'image' => 'plugins/images/tabs/jdownloader.png',
'category' => 'Downloader',
'settings' => array(
'custom' => '
array(
'name' => 'JDownloader',
'enabled' => (strpos('personal', $GLOBALS['license']) !== false) ? true : false,
'image' => 'plugins/images/tabs/jdownloader.png',
'category' => 'Downloader',
'settings' => array(
'custom' => '
<div class="row">
<div class="col-lg-12">
<div class="panel panel-info">
Expand All @@ -1073,62 +1073,62 @@ function getHomepageList()
</div>
</div>
',
'Enable' => array(
array(
'type' => 'switch',
'name' => 'homepageJdownloaderEnabled',
'label' => 'Enable',
'value' => $GLOBALS['homepageJdownloaderEnabled']
),
array(
'type' => 'select',
'name' => 'homepageJdownloaderAuth',
'label' => 'Minimum Authentication',
'value' => $GLOBALS['homepageJdownloaderAuth'],
'options' => $groups
)
),
'Connection' => array(
array(
'type' => 'input',
'name' => 'jdownloaderURL',
'label' => 'URL',
'value' => $GLOBALS['jdownloaderURL'],
'help' => 'Please make sure to use local IP address and port - You also may use local dns name too.',
'placeholder' => 'http(s)://hostname:port'
)
),
'Misc Options' => array(
array(
'type' => 'select',
'name' => 'homepageDownloadRefresh',
'label' => 'Refresh Seconds',
'value' => $GLOBALS['homepageDownloadRefresh'],
'options' => optionTime()
),
array(
'type' => 'switch',
'name' => 'jdownloaderCombine',
'label' => 'Add to Combined Downloader',
'value' => $GLOBALS['jdownloaderCombine']
),
),
'Test Connection' => array(
array(
'type' => 'blank',
'label' => 'Please Save before Testing'
),
array(
'type' => 'button',
'label' => '',
'icon' => 'fa fa-flask',
'class' => 'pull-right',
'text' => 'Test Connection',
'attr' => 'onclick="testAPIConnection(\'jdownloader\')"'
),
)
)
),
'Enable' => array(
array(
'type' => 'switch',
'name' => 'homepageJdownloaderEnabled',
'label' => 'Enable',
'value' => $GLOBALS['homepageJdownloaderEnabled']
),
array(
'type' => 'select',
'name' => 'homepageJdownloaderAuth',
'label' => 'Minimum Authentication',
'value' => $GLOBALS['homepageJdownloaderAuth'],
'options' => $groups
)
),
'Connection' => array(
array(
'type' => 'input',
'name' => 'jdownloaderURL',
'label' => 'URL',
'value' => $GLOBALS['jdownloaderURL'],
'help' => 'Please make sure to use local IP address and port - You also may use local dns name too.',
'placeholder' => 'http(s)://hostname:port'
)
),
'Misc Options' => array(
array(
'type' => 'select',
'name' => 'homepageDownloadRefresh',
'label' => 'Refresh Seconds',
'value' => $GLOBALS['homepageDownloadRefresh'],
'options' => optionTime()
),
array(
'type' => 'switch',
'name' => 'jdownloaderCombine',
'label' => 'Add to Combined Downloader',
'value' => $GLOBALS['jdownloaderCombine']
),
),
'Test Connection' => array(
array(
'type' => 'blank',
'label' => 'Please Save before Testing'
),
array(
'type' => 'button',
'label' => '',
'icon' => 'fa fa-flask',
'class' => 'pull-right',
'text' => 'Test Connection',
'attr' => 'onclick="testAPIConnection(\'jdownloader\')"'
),
)
)
),
array(
'name' => 'SabNZBD',
'enabled' => (strpos('personal', $GLOBALS['license']) !== false) ? true : false,
Expand Down Expand Up @@ -2577,6 +2577,15 @@ function getHomepageList()
'options' => $groups
)
),
'Options' => array(
array(
'type' => 'input',
'name' => 'tautulliHeader',
'label' => 'Title',
'value' => $GLOBALS['tautulliHeader'],
'help' => 'Sets the title of this homepage module'
)
),
'Connection' => array(
array(
'type' => 'input',
Expand Down Expand Up @@ -2654,7 +2663,6 @@ function getHomepageList()
),
),
'Misc Stats' => array(

array(
'type' => 'switch',
'name' => 'tautulliTopUsers',
Expand Down Expand Up @@ -2717,13 +2725,13 @@ function buildHomepageSettings()
$class .= ' faded';
}
break;
case 'homepageOrderjdownloader':
$class = 'bg-sab';
$image = 'plugins/images/tabs/jdownloader.png';
if (!$GLOBALS['homepageJdownloaderEnabled']) {
$class .= ' faded';
}
break;
case 'homepageOrderjdownloader':
$class = 'bg-sab';
$image = 'plugins/images/tabs/jdownloader.png';
if (!$GLOBALS['homepageJdownloaderEnabled']) {
$class .= ' faded';
}
break;
case 'homepageOrdersabnzbd':
$class = 'bg-sab';
$image = 'plugins/images/tabs/sabnzbd.png';
Expand Down Expand Up @@ -2805,12 +2813,12 @@ function buildHomepageSettings()
}
break;
case 'homepageOrdertautulli':
$class = 'bg-info';
$image = 'plugins/images/tabs/tautulli.png';
if (!$GLOBALS['homepageTautulliEnabled']) {
$class .= ' faded';
}
break;
$class = 'bg-info';
$image = 'plugins/images/tabs/tautulli.png';
if (!$GLOBALS['homepageTautulliEnabled']) {
$class .= ' faded';
}
break;
case 'homepageOrderPihole':
$class = 'bg-info';
$image = 'plugins/images/tabs/pihole.png';
Expand Down
10 changes: 5 additions & 5 deletions api/functions/normal-functions.php
Expand Up @@ -313,14 +313,14 @@ function getCert()
$file = __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . 'cacert.pem';
$file2 = __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . 'cacert-initial.pem';
$useCert = (file_exists($file)) ? $file : $file2;
if($GLOBALS['selfSignedCert'] !== ''){
if(file_exists($GLOBALS['selfSignedCert'])){
if ($GLOBALS['selfSignedCert'] !== '') {
if (file_exists($GLOBALS['selfSignedCert'])) {
return $GLOBALS['selfSignedCert'];
}
}
$context = stream_context_create(
array(
'ssl'=> array(
'ssl' => array(
'verify_peer' => true,
'cafile' => $useCert
)
Expand Down Expand Up @@ -420,7 +420,7 @@ function download($url, $path)

function localURL($url, $force = false)
{
if($force){
if ($force) {
return true;
}
if (strpos($url, 'https') !== false) {
Expand Down Expand Up @@ -764,4 +764,4 @@ function formatSeconds($seconds)
}
//return $timeExtra[0] . 's ' . (number_format(('0.' . substr($timeExtra[1], 0, 4)), 4, '.', '') * 1000) . 'ms';
//return (number_format(('0.' . substr($timeExtra[1], 0, 4)), 4, '.', '') * 1000) . 'ms';
}
}

0 comments on commit b371e3d

Please sign in to comment.