mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-03 03:38:52 +00:00
Remove support for sab, nzbget, couchpotato and nzbvortex integrations
This commit is contained in:
@@ -7,7 +7,6 @@ use App\Models\Category;
|
||||
use App\Models\Release;
|
||||
use App\Models\Settings;
|
||||
use App\Models\User;
|
||||
use Blacklight\SABnzbd;
|
||||
use Blacklight\utility\Utility;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
@@ -99,9 +98,6 @@ class AdminSiteController extends BasePageController
|
||||
]
|
||||
);
|
||||
|
||||
$this->smarty->assign('sabintegrationtype_ids', [SABnzbd::INTEGRATION_TYPE_USER, SABnzbd::INTEGRATION_TYPE_NONE]);
|
||||
$this->smarty->assign('sabintegrationtype_names', ['User', 'None (Off)']);
|
||||
|
||||
$this->smarty->assign('newgroupscan_names', ['Days', 'Posts']);
|
||||
|
||||
$this->smarty->assign('registerstatus_ids', [Settings::REGISTER_STATUS_OPEN, Settings::REGISTER_STATUS_INVITE, Settings::REGISTER_STATUS_CLOSED]);
|
||||
|
||||
@@ -8,7 +8,6 @@ use App\Models\Forumpost;
|
||||
use App\Models\Settings;
|
||||
use App\Models\User;
|
||||
use Blacklight\Contents;
|
||||
use Blacklight\SABnzbd;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -211,11 +210,6 @@ class BasePageController extends Controller
|
||||
$this->smarty->assign('weHasVortex', false);
|
||||
}
|
||||
|
||||
$sab = new SABnzbd($this);
|
||||
$this->smarty->assign('sabintegrated', $sab->integratedBool);
|
||||
if ($sab->integratedBool && $sab->url !== '' && $sab->apikey !== '') {
|
||||
$this->smarty->assign('sabapikeytype', $sab->apikeytype);
|
||||
}
|
||||
if ($this->userdata->hasRole('Admin')) {
|
||||
$this->smarty->assign('isadmin', 'true');
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ use App\Models\Settings;
|
||||
use App\Models\User;
|
||||
use App\Models\UserDownload;
|
||||
use App\Models\UserRequest;
|
||||
use Blacklight\NZBGet;
|
||||
use Blacklight\SABnzbd;
|
||||
use Blacklight\utility\Utility;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
@@ -26,7 +24,6 @@ class ProfileController extends BasePageController
|
||||
public function show(Request $request)
|
||||
{
|
||||
$this->setPreferences();
|
||||
$sab = new SABnzbd($this);
|
||||
|
||||
$userID = $this->userdata->id;
|
||||
$privileged = $this->userdata->hasRole('Admin') || $this->userdata->hasRole('Moderator');
|
||||
@@ -78,25 +75,10 @@ class ProfileController extends BasePageController
|
||||
]
|
||||
);
|
||||
|
||||
$sabApiKeyTypes = [
|
||||
SABnzbd::API_TYPE_NZB => 'Nzb Api Key',
|
||||
SABnzbd::API_TYPE_FULL => 'Full Api Key',
|
||||
];
|
||||
$sabPriorities = [
|
||||
SABnzbd::PRIORITY_FORCE => 'Force', SABnzbd::PRIORITY_HIGH => 'High',
|
||||
SABnzbd::PRIORITY_NORMAL => 'Normal', SABnzbd::PRIORITY_LOW => 'Low',
|
||||
];
|
||||
$sabSettings = [1 => 'Site', 2 => 'Cookie'];
|
||||
|
||||
// Pager must be fetched after the variables are assigned to smarty.
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'commentslist' => ReleaseComment::getCommentsForUserRange($userID),
|
||||
'saburl' => $sab->url,
|
||||
'sabapikey' => $sab->apikey,
|
||||
'sabapikeytype' => $sab->apikeytype !== '' ? $sabApiKeyTypes[$sab->apikeytype] : '',
|
||||
'sabpriority' => $sab->priority !== '' ? $sabPriorities[$sab->priority] : '',
|
||||
'sabsetting' => $sabSettings[$sab->checkCookie() ? 2 : 1],
|
||||
]
|
||||
);
|
||||
|
||||
@@ -125,8 +107,6 @@ class ProfileController extends BasePageController
|
||||
public function edit(Request $request)
|
||||
{
|
||||
$this->setPreferences();
|
||||
$sab = new SABnzbd($this);
|
||||
$nzbGet = new NZBGet($this);
|
||||
|
||||
$action = $request->input('action') ?? 'view';
|
||||
|
||||
@@ -140,20 +120,12 @@ class ProfileController extends BasePageController
|
||||
switch ($action) {
|
||||
case 'newapikey':
|
||||
User::updateRssKey($userid);
|
||||
|
||||
return redirect('profile');
|
||||
break;
|
||||
case 'clearcookies':
|
||||
$sab->unsetCookie();
|
||||
|
||||
return redirect('profileedit');
|
||||
break;
|
||||
case 'submit':
|
||||
|
||||
if ($request->has('saburl') && ! Str::endsWith($request->input('saburl'), '/') && trim($request->input('saburl')) !== '') {
|
||||
$request->merge(['saburl' => $request->input('saburl').'/']);
|
||||
}
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => ['nullable', 'string', 'email', 'max:255', 'unique:users', 'indisposable'],
|
||||
'password' => ['nullable', 'string', 'min:8', 'confirmed', 'regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/'],
|
||||
@@ -161,15 +133,7 @@ class ProfileController extends BasePageController
|
||||
|
||||
if ($validator->fails()) {
|
||||
$errorStr = implode('', Arr::collapse($validator->errors()->toArray()));
|
||||
} elseif (! empty($request->input('nzbgeturl')) && $nzbGet->verifyURL($request->input('nzbgeturl')) === false) {
|
||||
$errorStr = 'The NZBGet URL you entered is invalid!';
|
||||
} elseif (($request->missing('saburl') && $request->has('sabapikey')) || ($request->has('saburl') && $request->missing('sabapikey'))) {
|
||||
$errorStr = 'Insert a SABnzdb URL and API key.';
|
||||
} else {
|
||||
if ($request->has('sabetting') && $request->input('sabsetting') === 2) {
|
||||
$sab->setCookie($request->input('saburl'), $request->input('sabapikey'), $request->input('sabpriority'), $request->input('sabapikeytype'));
|
||||
}
|
||||
|
||||
User::updateUser(
|
||||
$userid,
|
||||
$this->userdata->username,
|
||||
@@ -184,18 +148,6 @@ class ProfileController extends BasePageController
|
||||
$request->has('xxxview') ? 1 : 0,
|
||||
$request->has('consoleview') ? 1 : 0,
|
||||
$request->has('bookview') ? 1 : 0,
|
||||
$request->input('queuetypeids'),
|
||||
$request->input('nzbgeturl') ?? '',
|
||||
$request->input('nzbgetusername') ?? '',
|
||||
$request->input('nzbgetpassword') ?? '',
|
||||
$request->has('saburl') ? Str::finish($request->input('saburl'), '/') : '',
|
||||
$request->input('sabapikey') ?? '',
|
||||
$request->input('sabpriority') ?? '',
|
||||
$request->input('sabapikeytype') ?? '',
|
||||
$request->input('nzbvortex_server_url') ?? '',
|
||||
$request->input('nzbvortex_api_key') ?? '',
|
||||
$request->input('cp_url') ?? '',
|
||||
$request->input('cp_api') ?? '',
|
||||
(int) Settings::settingValue('site.main.userselstyle') === 1 ? $request->input('style') : 'None'
|
||||
);
|
||||
|
||||
@@ -300,45 +252,10 @@ class ProfileController extends BasePageController
|
||||
$this->smarty->assign('user', $this->userdata);
|
||||
$this->smarty->assign('userexccat', User::getCategoryExclusionById($userid));
|
||||
|
||||
$this->smarty->assign('saburl_selected', $sab->url);
|
||||
$this->smarty->assign('sabapikey_selected', $sab->apikey);
|
||||
|
||||
$this->smarty->assign('sabapikeytype_ids', [SABnzbd::API_TYPE_NZB, SABnzbd::API_TYPE_FULL]);
|
||||
$this->smarty->assign('sabapikeytype_names', ['Nzb Api Key', 'Full Api Key']);
|
||||
$this->smarty->assign('sabapikeytype_selected', ($sab->apikeytype === '') ? SABnzbd::API_TYPE_NZB : $sab->apikeytype);
|
||||
|
||||
$this->smarty->assign('sabpriority_ids', [SABnzbd::PRIORITY_FORCE, SABnzbd::PRIORITY_HIGH, SABnzbd::PRIORITY_NORMAL, SABnzbd::PRIORITY_LOW, SABnzbd::PRIORITY_PAUSED]);
|
||||
$this->smarty->assign('sabpriority_names', ['Force', 'High', 'Normal', 'Low', 'Paused']);
|
||||
$this->smarty->assign('sabpriority_selected', ($sab->priority === '') ? SABnzbd::PRIORITY_NORMAL : $sab->priority);
|
||||
|
||||
$this->smarty->assign('sabsetting_ids', [1, 2]);
|
||||
$this->smarty->assign('sabsetting_names', ['Site', 'Cookie']);
|
||||
$this->smarty->assign('sabsetting_selected', ($sab->checkCookie() ? 2 : 1));
|
||||
|
||||
switch ($sab->integrated) {
|
||||
case SABnzbd::INTEGRATION_TYPE_USER:
|
||||
$queueTypes = ['None', 'Sabnzbd', 'NZBGet'];
|
||||
$queueTypeIDs = [User::QUEUE_NONE, User::QUEUE_SABNZBD, User::QUEUE_NZBGET];
|
||||
break;
|
||||
case SABnzbd::INTEGRATION_TYPE_NONE:
|
||||
$queueTypes = ['None', 'NZBGet'];
|
||||
$queueTypeIDs = [User::QUEUE_NONE, User::QUEUE_NZBGET];
|
||||
break;
|
||||
}
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'queuetypes' => $queueTypes,
|
||||
'queuetypeids' => $queueTypeIDs,
|
||||
]
|
||||
);
|
||||
|
||||
$meta_title = 'Edit User Profile';
|
||||
$meta_keywords = 'edit,profile,user,details';
|
||||
$meta_description = 'Edit User Profile for '.$this->userdata->username;
|
||||
|
||||
$this->smarty->assign('cp_url_selected', $this->userdata->cp_url);
|
||||
$this->smarty->assign('cp_api_selected', $this->userdata->cp_api);
|
||||
$this->smarty->assign('yesno_ids', [1, 0]);
|
||||
$this->smarty->assign('yesno_names', ['Yes', 'No']);
|
||||
|
||||
|
||||
@@ -1,327 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Settings;
|
||||
use Blacklight\NZBGet;
|
||||
use Blacklight\NZBVortex;
|
||||
use Blacklight\SABnzbd;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class QueueController extends BasePageController
|
||||
{
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function index(Request $request): void
|
||||
{
|
||||
$this->setPreferences();
|
||||
|
||||
$queueType = $error = '';
|
||||
$queue = null;
|
||||
switch (Settings::settingValue('apps.sabnzbplus.integrationtype')) {
|
||||
case SABnzbd::INTEGRATION_TYPE_NONE:
|
||||
if ($this->userdata->queuetype === 2) {
|
||||
$queueType = 'NZBGet';
|
||||
$queue = new NZBGet($this);
|
||||
}
|
||||
break;
|
||||
case SABnzbd::INTEGRATION_TYPE_USER:
|
||||
switch ((int) $this->userdata->queuetype) {
|
||||
case 1:
|
||||
$queueType = 'Sabnzbd';
|
||||
$queue = new SABnzbd($this);
|
||||
break;
|
||||
case 2:
|
||||
$queueType = 'NZBGet';
|
||||
$queue = new NZBGet($this);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($queue !== null) {
|
||||
if ($queueType === 'Sabnzbd') {
|
||||
if (empty($queue->url)) {
|
||||
$error = 'ERROR: The Sabnzbd URL is missing!';
|
||||
}
|
||||
|
||||
if (empty($queue->apikey)) {
|
||||
if ($error === '') {
|
||||
$error = 'ERROR: The Sabnzbd API key is missing!';
|
||||
} else {
|
||||
$error .= ' The Sabnzbd API key is missing!';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error === '') {
|
||||
if ($request->has('del')) {
|
||||
$queue->delFromQueue($request->input('del'));
|
||||
}
|
||||
|
||||
if ($request->has('pause')) {
|
||||
$queue->pauseFromQueue($request->input('pause'));
|
||||
}
|
||||
|
||||
if ($request->has('resume')) {
|
||||
$queue->resumeFromQueue($request->input('resume'));
|
||||
}
|
||||
|
||||
if ($request->has('pall')) {
|
||||
$queue->pauseAll();
|
||||
}
|
||||
|
||||
if ($request->has('rall')) {
|
||||
$queue->resumeAll();
|
||||
}
|
||||
|
||||
$this->smarty->assign('serverURL', $queue->url);
|
||||
}
|
||||
}
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'queueType' => $queueType,
|
||||
'error' => $error,
|
||||
'user' => $this->userdata,
|
||||
]
|
||||
);
|
||||
$title = 'Your '.$queueType.' Download Queue';
|
||||
$meta_title = 'View'.$queueType.' Queue';
|
||||
$meta_keywords = 'view,'.strtolower($queueType).',queue';
|
||||
$meta_description = 'View'.$queueType.' Queue';
|
||||
$content = $this->smarty->fetch('viewqueue.tpl');
|
||||
$this->smarty->assign(compact('title', 'content', 'meta_title', 'meta_keywords', 'meta_description'));
|
||||
$this->pagerender();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function nzbget()
|
||||
{
|
||||
$this->setPreferences();
|
||||
$nzbGet = new NZBGet($this);
|
||||
|
||||
$output = '';
|
||||
$data = $nzbGet->getQueue();
|
||||
|
||||
if ($data !== false) {
|
||||
if (\count($data) > 0) {
|
||||
$status = $nzbGet->status();
|
||||
|
||||
if ($status !== false) {
|
||||
$output .=
|
||||
"<div class='container text-center' style='display:block;'>
|
||||
<div style='width:16.666666667%;float:left;'><b>Avg Speed:</b><br /> ".human_filesize($status['AverageDownloadRate'], 2)."/s </div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Speed:</b><br /> ".human_filesize($status['DownloadRate'], 2)."/s </div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Limit:</b><br /> ".human_filesize($status['DownloadLimit'], 2)."/s </div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Queue Left(no pars):</b><br /> ".human_filesize($status['RemainingSizeLo'], 2)." </div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Free Space:</b><br /> ".human_filesize($status['FreeDiskSpaceMB'] * 1024000, 2)." </div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Status:</b><br /> ".($status['Download2Paused'] === 1 ? 'Paused' : 'Downloading').' </div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
$count = 1;
|
||||
$output .=
|
||||
"<table class='table table-striped table-condensed table-highlight data'>
|
||||
<thead>
|
||||
<tr >
|
||||
<th style='width=10px;text-align:center;'>#</th>
|
||||
<th style='text-align:left;'>Name</th>
|
||||
<th style='width:80px;text-align:center;'>Size</th>
|
||||
<th style='width:80px;text-align:center;'>Left(+pars)</th>
|
||||
<th style='width:50px;text-align:center;'>Done</th>
|
||||
<th style='width:80px;text-align:center;'>Status</th>
|
||||
<th style='width:50px;text-align:center;'>Delete</th>
|
||||
<th style='width:80px;text-align:center;'><a href='?pall'>Pause all</a></th>
|
||||
<th style='width:80px;text-align:center;'><a href='?rall'>Resume all</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>";
|
||||
|
||||
foreach ($data as $item) {
|
||||
$output .=
|
||||
'<tr>'.
|
||||
"<td style='text-align:center;width:10px'>".$count.'</td>'.
|
||||
"<td style='text-align:left;'>".$item['NZBName'].'</td>'.
|
||||
"<td style='text-align:center;'>".$item['FileSizeMB'].' MB</td>'.
|
||||
"<td style='text-align:center;'>".$item['RemainingSizeMB'].' MB</td>'.
|
||||
"<td style='text-align:center;'>".($item['FileSizeMB'] === 0 ? 0 : round(100 - ($item['RemainingSizeMB'] / $item['FileSizeMB']) * 100)).'%</td>'.
|
||||
"<td style='text-align:center;'>".($item['ActiveDownloads'] > 0 ? 'Downloading' : 'Paused').'</td>'.
|
||||
"<td style='text-align:center;'><a onclick=\"return confirm('Are you sure?');\" href='?del=".$item['LastID']."'>Delete</a></td>".
|
||||
"<td style='text-align:center;'><a href='?pause=".$item['LastID']."'>Pause</a></td>".
|
||||
"<td style='text-align:center;'><a href='?resume=".$item['LastID']."'>Resume</a></td>".
|
||||
'</tr>';
|
||||
$count++;
|
||||
}
|
||||
$output .=
|
||||
'</tbody>
|
||||
</table>';
|
||||
} else {
|
||||
$output .= "<br /><br /><p style='text-align:center;'>The queue is currently empty.</p>";
|
||||
}
|
||||
} else {
|
||||
$output .= "<p style='text-align:center;'>Error retreiving queue.</p>";
|
||||
}
|
||||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function sabnzbd()
|
||||
{
|
||||
$this->setPreferences();
|
||||
$sab = new SABnzbd($this);
|
||||
|
||||
$output = '';
|
||||
|
||||
$json = $sab->getAdvQueue();
|
||||
|
||||
if ($json !== false) {
|
||||
$obj = json_decode($json);
|
||||
$queue = $obj->{'queue'};
|
||||
$count = 1;
|
||||
|
||||
$output .=
|
||||
"<div class='text-center' style='display:block;'>
|
||||
<div style='width:16.666666667%;float:left;'><b>Speed:</b><br /> ".$obj->{'speed'}."B/s </div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Queued:</b><br /> ".round($obj->{'mbleft'}, 2).'MB / '.round($obj->{'mb'}, 2).'MB'." </div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Status:</b><br /> ".ucwords(strtolower($obj->{'state'}))." </div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Free (temp):</b><br /> ".round($obj->{'diskspace1'})."GB </div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Free Space:</b><br /> ".round($obj->{'diskspace2'})."GB</div>
|
||||
<div style='width:16.666666667%;float:left;'><b>Stats:</b><br /> ".preg_replace('/\s+\|\s+| /', ',', $obj->{'loadavg'}).' </div>
|
||||
</div>';
|
||||
|
||||
if (\count($queue) > 0) {
|
||||
$output .=
|
||||
"<table class='table table-striped table-condensed table-highlight data'>
|
||||
<thead>
|
||||
<tr >
|
||||
<th style='width=10px;text-align:center;'>#</th>
|
||||
<th style='text-align:left;'>Name</th>
|
||||
<th style='width:80px;text-align:center;'>Size</th>
|
||||
<th style='width:80px;text-align:center;'>Left</th>
|
||||
<th style='width:50px;text-align:center;'>Done</th>
|
||||
<th style='width:80px;text-align:center;'>Time Left</th>
|
||||
<th style='width:50px;text-align:center;'>Delete</th>
|
||||
<th style='width:80px;text-align:center;'><a href='?pall'>Pause all</a></th>
|
||||
<th style='width:80px;text-align:center;'><a href='?rall'>Resume all</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>";
|
||||
|
||||
foreach ($queue->{'slots'} as $item) {
|
||||
if (strpos($item->{'filename'}, 'fetch NZB') === false) {
|
||||
$output .=
|
||||
'<tr>'.
|
||||
"<td style='text-align:center;width:10px'>".$count.'</td>'.
|
||||
"<td style='text-align:left;'>".$item->{'filename'}.'</td>'.
|
||||
"<td style='text-align:center;'>".round($item->{'mb'}, 2).' MB</td>'.
|
||||
"<td style='text-align:center;'>".round($item->{'mbleft'}, 2).' MB</td>'.
|
||||
"<td style='text-align:center;'>".($item->{'mb'} === 0 ? 0 : round(100 - ($item->{'mbleft'} / $item->{'mb'}) * 100)).'%</td>'.
|
||||
"<td style='text-align:center;'>".$item->{'timeleft'}.'</td>'.
|
||||
"<td style='text-align:center;'><a onclick=\"return confirm('Are you sure?');\" href='?del=".$item->{'id'}."'>Delete</a></td>".
|
||||
"<td style='text-align:center;'><a href='?pause=".$item->{'id'}."'>Pause</a></td>".
|
||||
"<td style='text-align:center;'><a href='?resume=".$item->{'id'}."'>Resume</a></td>".
|
||||
'</tr>';
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$output .=
|
||||
'</tbody>
|
||||
</table>';
|
||||
} else {
|
||||
$output .= "<br /><br /><p style='text-align:center;'>The queue is currently empty.</p>";
|
||||
}
|
||||
} else {
|
||||
$output .= "<p style='text-align:center;'>Error retrieving queue.</p>";
|
||||
}
|
||||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function nzbVortex()
|
||||
{
|
||||
$this->setPreferences();
|
||||
try {
|
||||
if (isset($_GET['isAjax'])) {
|
||||
$vortex = new NZBVortex;
|
||||
|
||||
// I guess we Ajax this way.
|
||||
if (isset($_GET['getOverview'])) {
|
||||
$overview = $vortex->getOverview();
|
||||
$this->smarty->assign('overview', $overview);
|
||||
$content = $this->smarty->fetch('nzbvortex-ajax.tpl');
|
||||
echo $content;
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['addQueue'])) {
|
||||
$nzb = $_GET['addQueue'];
|
||||
$vortex->addQueue($nzb);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['resume'])) {
|
||||
$vortex->resume((int) $_GET['resume']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['pause'])) {
|
||||
$vortex->pause((int) $_GET['pause']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['moveup'])) {
|
||||
$vortex->moveUp((int) $_GET['moveup']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['movedown'])) {
|
||||
$vortex->moveDown((int) $_GET['movedown']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['movetop'])) {
|
||||
$vortex->moveTop((int) $_GET['movetop']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['movebottom'])) {
|
||||
$vortex->moveBottom((int) $_GET['movebottom']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['delete'])) {
|
||||
$vortex->delete((int) $_GET['delete']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['filelist'])) {
|
||||
$response = $vortex->getFilelist((int) $_GET['filelist']);
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
printf($e->getMessage());
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = 'NZBVortex';
|
||||
|
||||
$content = $this->smarty->fetch('nzbvortex.tpl');
|
||||
|
||||
$this->smarty->assign(compact('title', 'content'));
|
||||
|
||||
$this->pagerender();
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Blacklight\CouchPotato;
|
||||
use Blacklight\NZBGet;
|
||||
use Blacklight\SABnzbd;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SendReleaseController extends BasePageController
|
||||
{
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function couchPotato(Request $request): void
|
||||
{
|
||||
$this->setPreferences();
|
||||
if (empty($request->input('id'))) {
|
||||
$this->show404();
|
||||
} else {
|
||||
$cp = new CouchPotato($this);
|
||||
|
||||
if (empty($cp->cpurl)) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
if (empty($cp->cpapi)) {
|
||||
$this->show404();
|
||||
}
|
||||
$id = $request->input('id');
|
||||
$cp->sendToCouchPotato($id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function sabNzbd(Request $request)
|
||||
{
|
||||
$this->setPreferences();
|
||||
if (empty($request->input('id'))) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
$sab = new SABnzbd($this);
|
||||
|
||||
if (empty($sab->url)) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
if (empty($sab->apikey)) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
$guid = $request->input('id');
|
||||
|
||||
$sab->sendToSab($guid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function nzbGet(Request $request): void
|
||||
{
|
||||
$this->setPreferences();
|
||||
if (empty($request->input('id'))) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
$nzbget = new NZBGet($this);
|
||||
|
||||
if (empty($nzbget->url)) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
if (empty($nzbget->username)) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
if (empty($nzbget->password)) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
$guid = $request->input('id');
|
||||
|
||||
$nzbget->sendURLToNZBGet($guid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function queue(Request $request): void
|
||||
{
|
||||
$this->setPreferences();
|
||||
if (empty($request->input('id'))) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
$user = $this->userdata;
|
||||
if ((int) $this->userdata->queuetype !== 2) {
|
||||
$sab = new SABnzbd($this);
|
||||
if (empty($sab->url)) {
|
||||
$this->show404();
|
||||
}
|
||||
if (empty($sab->apikey)) {
|
||||
$this->show404();
|
||||
}
|
||||
$sab->sendToSab($request->input('id'));
|
||||
} elseif ((int) $user['queuetype'] === 2) {
|
||||
$nzbget = new NZBGet($this);
|
||||
$nzbget->sendURLToNZBGet($request->input('id'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user