Remove support for sab, nzbget, couchpotato and nzbvortex integrations

This commit is contained in:
DariusIII
2023-03-16 13:38:43 +01:00
parent cf3af9e35a
commit d775ff22e2
28 changed files with 134 additions and 2790 deletions
-85
View File
@@ -1,85 +0,0 @@
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (see LICENSE.txt in the base directory. If
* not, see:
*
* @link <http://www.gnu.org/licenses/>.
*
* @author DariusIII
* @copyright 2016 newznab-tmux
*/
namespace Blacklight;
use GuzzleHttp\Client;
/**
* Class CouchPotato.
*/
class CouchPotato
{
/**
* URL to the CP server.
*
* @var string
*/
public $cpurl = '';
/**
* The CP key.
*
* @var string
*/
public $cpapi = '';
/**
* Imdb ID.
*
* @var string
*/
public $imdbid = '';
/**
* CouchPotato constructor.
*
* @param \App\Http\Controllers\BasePageController $page
*/
public function __construct($page)
{
$this->cpurl = ! empty($page->userdata['cp_url']) ? $page->userdata['cp_url'] : '';
$this->cpapi = ! empty($page->userdata['cp_api']) ? $page->userdata['cp_api'] : '';
}
/**
* Send a movie to CouchPotato.
*
* @param string $id
* @return bool|mixed
*
* @throws \RuntimeException
*/
public function sendToCouchPotato($id)
{
$this->imdbid = $id;
return (new Client(['verify' => false]))->get(
$this->cpurl.
'/api/'.
$this->cpapi.
'/movie.add/?identifier=tt'.
$this->imdbid
)->getBody()->getContents();
}
}
-425
View File
@@ -1,425 +0,0 @@
<?php
namespace Blacklight;
use App\Models\Release;
use Blacklight\utility\Utility;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
/**
* Transfers data between an NZBGet server and a nntmux website.
*
*
* Class NZBGet
*/
class NZBGet
{
/**
* NZBGet username.
*
* @var string
*/
public $userName = '';
/**
* NZBGet password.
*
* @var string
*/
public $password = '';
/**
* NZBGet URL.
*
* @var string
*/
public $url = '';
/**
* Full URL (containing password/username/etc).
*
* @var string|bool
*/
protected $fullUrl = '';
/**
* User id.
*
* @var int
*/
protected $uid = 0;
/**
* The users RSS token.
*
* @var string
*/
protected $rsstoken = '';
/**
* URL to your NNTmux site.
*
* @var string
*/
protected $serverurl = '';
/**
* @var \Blacklight\Releases
*/
protected $releases;
/**
* @var \Blacklight\NZB
*/
protected $nzb;
/**
* @var \GuzzleHttp\Client
*/
protected $client;
/**
* Construct.
* Set up full URL.
*
* @var \App\Http\Controllers\BasePageController
*
* @throws \Exception
*/
public function __construct(&$page)
{
$this->serverurl = url('/');
$this->uid = $page->userdata['id'];
$this->api_token = $page->userdata['api_token'];
if (! empty($page->userdata['nzbgeturl'])) {
$this->url = $page->userdata['nzbgeturl'];
$this->userName = (empty($page->userdata['nzbgetusername']) ? '' : $page->userdata['nzbgetusername']);
$this->password = (empty($page->userdata['nzbgetpassword']) ? '' : $page->userdata['nzbgetpassword']);
}
$this->fullUrl = $this->verifyURL($this->url);
$this->releases = new Releases();
$this->nzb = new NZB();
$this->client = new Client();
}
/**
* @return \GuzzleHttp\Psr7\Request
*/
public function sendNZBToNZBGet($guid)
{
$relData = Release::getByGuid($guid);
$gzipFile = Utility::unzipGzipFile($this->nzb->NZBPath($guid));
$string = $gzipFile === false ? '' : $gzipFile;
$header =
'<?xml version="1.0"?>
<methodCall>
<methodName>append</methodName>
<params>
<param>
<value><string>'.$relData['searchname'].'</string></value>
</param>
<param>
<value><string>'.$relData['category_name'].'</string></value>
</param>
<param>
<value><i4>0</i4></value>
</param>
<param>
<value><boolean>>False</boolean></value>
</param>
<param>
<value>
<string>'.
base64_encode($string).
'</string>
</value>
</param>
</params>
</methodCall>';
return new Request('POST', $this->fullUrl.'append', ['Content-Type' => 'text/xml; charset=UTF8'], $header);
}
/**
* Send a NZB URL to NZBGet.
*
* @param string $guid Release identifier.
* @return bool|mixed
*/
public function sendURLToNZBGet($guid)
{
$reldata = Release::getByGuid($guid);
$header =
'<?xml version="1.0"?>
<methodCall>
<methodName>appendurl</methodName>
<params>
<param>
<value><string>'.$reldata['searchname'].'.nzb'.'</string></value>
</param>
<param>
<value><string>'.$reldata['category_name'].'</string></value>
</param>
<param>
<value><i4>0</i4></value>
</param>
<param>
<value><boolean>>False</boolean></value>
</param>
<param>
<value>
<string>'.
$this->serverurl.
'getnzb?id='.
$guid.
'%26r%3D'.
$this->api_token
.
'</string>
</value>
</param>
</params>
</methodCall>';
return new Request('POST', $this->fullUrl.'append', ['Content-Type' => 'text/xml; charset=UTF8'], $header);
}
/**
* Pause download queue on server. This method is equivalent for command "nzbget -P".
*
* @return void
*/
public function pauseAll()
{
$header =
'<?xml version="1.0"?>
<methodCall>
<methodName>pausedownload2</methodName>
<params>
<param>
<value><boolean>1</boolean></value>
</param>
</params>
</methodCall>';
new Request('POST', $this->fullUrl.'pausedownload2', ['Content-Type' => 'text/xml; charset=UTF8'], $header);
}
/**
* Resume (previously paused) download queue on server. This method is equivalent for command "nzbget -U".
*
* @return void
*/
public function resumeAll()
{
$header =
'<?xml version="1.0"?>
<methodCall>
<methodName>resumedownload2</methodName>
<params>
<param>
<value><boolean>1</boolean></value>
</param>
</params>
</methodCall>';
new Request('POST', $this->fullUrl.'resumedownload2', ['Content-Type' => 'text/xml; charset=UTF8'], $header);
}
/**
* Pause a single NZB from the queue.
*
* @param string $id
*/
public function pauseFromQueue($id)
{
$header =
'<?xml version="1.0"?>
<methodCall>
<methodName>editqueue</methodName>
<params>
<param>
<value><string>GroupPause</string></value>
</param>
<param>
<value><i4>0</i4></value>
</param>
<param>
<value><string>""</string></value>
</param>
<param>
<value>
<array>
<value><i4>'.$id.'</i4></value>
</array>
</value>
</param>
</params>
</methodCall>';
new Request('POST', $this->fullUrl.'editqueue', ['Content-Type' => 'text/xml; charset=UTF8'], $header);
}
/**
* Resume a single NZB from the queue.
*
* @param string $id
*/
public function resumeFromQueue($id)
{
$header =
'<?xml version="1.0"?>
<methodCall>
<methodName>editqueue</methodName>
<params>
<param>
<value><string>GroupResume</string></value>
</param>
<param>
<value><i4>0</i4></value>
</param>
<param>
<value><string>""</string></value>
</param>
<param>
<value>
<array>
<value><i4>'.$id.'</i4></value>
</array>
</value>
</param>
</params>
</methodCall>';
new Request('POST', $this->fullUrl.'editqueue', ['Content-Type' => 'text/xml; charset=UTF8'], $header);
}
/**
* Delete a single NZB from the queue.
*
* @param string $id
*/
public function delFromQueue($id)
{
$header =
'<?xml version="1.0"?>
<methodCall>
<methodName>editqueue</methodName>
<params>
<param>
<value><string>GroupDelete</string></value>
</param>
<param>
<value><i4>0</i4></value>
</param>
<param>
<value><string>""</string></value>
</param>
<param>
<value>
<array>
<value><i4>'.$id.'</i4></value>
</array>
</value>
</param>
</params>
</methodCall>';
new Request('POST', $this->fullUrl.'editqueue', ['Content-Type' => 'text/xml; charset=UTF8'], $header);
}
/**
* Set download speed limit. This method is equivalent for command "nzbget -R <Limit>".
*
* @param int $limit The speed to limit it to.
* @return void
*/
public function rate($limit)
{
$header =
'<?xml version="1.0"?>
<methodCall>
<methodName>rate</methodName>
<params>
<param>
<value><i4>'.$limit.'</i4></value>
</param>
</params>
</methodCall>';
new Request('POST', $this->fullUrl.'rate', ['Content-Type' => 'text/xml; charset=UTF8'], $header);
}
/**
* Get all items in download queue.
*
*
* @return array|false
*/
public function getQueue()
{
$data = $this->client->get($this->fullUrl.'listgroups')->getBody()->getContents();
$retVal = false;
if ($data) {
$xml = simplexml_load_string($data);
if ($xml) {
$retVal = [];
$i = 0;
foreach ($xml->params->param->value->array->data->value as $value) {
foreach ($value->struct->member as $member) {
$value = (array) $member->value;
$value = array_shift($value);
if (! \is_object($value)) {
$retVal[$i][(string) $member->name] = $value;
}
}
$i++;
}
}
}
return $retVal;
}
/**
* Request for current status (summary) information. Parts of informations returned by this method can be printed by command "nzbget -L".
*
* @return array|false The status.
*
* @throws \RuntimeException
*/
public function status()
{
$data = $this->client->get($this->fullUrl.'status')->getBody()->getContents();
$retVal = false;
if ($data) {
$xml = simplexml_load_string($data);
if ($xml) {
foreach ($xml->params->param->value->struct->member as $member) {
$value = (array) $member->value;
$value = array_shift($value);
if (! \is_object($value)) {
$retVal = [(string) $member->name => $value];
}
}
}
}
return $retVal;
}
/**
* Verify if the NZBGet URL is correct.
*
* @param string $url NZBGet URL to verify.
* @return bool|string
*/
public function verifyURL($url)
{
if (preg_match('/(?P<protocol>https?):\/\/(?P<url>.+?)(:(?P<port>\d+\/)|\/)$/i', $url, $hits)) {
return $hits['protocol'].'://'.$this->userName.':'.$this->password.'@'.$hits['url'].(isset($hits['port']) ? ':'.$hits['port'] : (substr($hits['url'], -1) === '/' ? '' : '/')).'xmlrpc/';
}
return false;
}
}
-337
View File
@@ -1,337 +0,0 @@
<?php
namespace Blacklight;
use App\Models\User;
use Page;
/**
* Class NZBVortex.
*/
final class NZBVortex
{
private $nonce = null;
private $session = null;
public function __construct()
{
if (null === $this->session) {
$this->getNonce();
$this->login();
}
}
/**
* get text for state.
*
* @param int $code
* @return string
*/
public function getState($code = 0)
{
$states = [
0 => 'Waiting',
1 => 'Downloading',
2 => 'Waiting for save',
3 => 'Saving',
4 => 'Saved',
5 => 'Password request',
6 => 'Queued for processing',
7 => 'User wait for processing',
8 => 'Checking',
9 => 'Repairing',
10 => 'Joining',
11 => 'Wait for further processing',
12 => 'Joining',
13 => 'Wait for uncompress',
14 => 'Uncompressing',
15 => 'Wait for cleanup',
16 => 'Cleaning up',
17 => 'Cleaned up',
18 => 'Moving to completed',
19 => 'Move completed',
20 => 'Done',
21 => 'Uncompress failed',
22 => 'Check failed, data corrupt',
23 => 'Move failed',
24 => 'Badly encoded download (uuencoded)',
];
return (isset($states[$code])) ?
$states[$code] : -1;
}
/**
* get overview of NZB's in queue.
*
* @return array
*/
public function getOverview()
{
$params = ['sessionid' => $this->session];
$response = $this->sendRequest(sprintf('app/webUpdate'), $params);
foreach ($response['nzbs'] as &$nzb) {
$nzb['original_state'] = $nzb['state'];
$nzb['state'] = ($nzb['isPaused'] === true) ? 'Paused' : $this->getState($nzb['state']);
}
return $response;
}
/**
* add NZB to queue.
*
* @param string $nzb
* @return void
*
* @throws \Exception
*/
public function addQueue($nzb = '')
{
if (! empty($nzb)) {
$page = new Page;
$host = $page->serverurl;
$data = User::find(User::currentUserId());
$url = sprintf('%sgetnzb?id=%s.nzb&i=%s&r=%s', $host, $nzb, $data['id'], $data['api_token']);
$params = [
'sessionid' => $this->session,
'url' => $url,
];
$response = $this->sendRequest('nzb/add', $params);
}
}
/**
* resume NZB.
*
* @param int $id
*
* @throws \Exception
*/
public function resume($id = 0): void
{
if ($id > 0) {
// /nzb/(id)/resume
$params = ['sessionid' => $this->session];
$response = $this->sendRequest(sprintf('nzb/%s/resume', $id), $params);
}
}
/**
* pause NZB.
*
* @param int $id
* @return void
*
* @throws \Exception
*/
public function pause($id = 0)
{
if ($id > 0) {
// /nzb/(id)/pause
$params = ['sessionid' => $this->session];
$response = $this->sendRequest(sprintf('nzb/%s/pause', $id), $params);
}
}
/**
* move NZB up in queue.
*
* @param int $id
* @return void
*
* @throws \Exception
*/
public function moveUp($id = 0)
{
if ($id > 0) {
// nzb/(nzbid)/moveup
$params = ['sessionid' => $this->session];
$response = $this->sendRequest(sprintf('nzb/%s/moveup', $id), $params);
}
}
/**
* move NZB down in queue.
*
* @param int $id
* @return void
*
* @throws \Exception
*/
public function moveDown($id = 0)
{
if ($id > 0) {
// nzb/(nzbid)/movedown
$params = ['sessionid' => $this->session];
$response = $this->sendRequest(sprintf('nzb/%s/movedown', $id), $params);
}
}
/**
* move NZB to bottom of queue.
*
* @param int $id
* @return void
*
* @throws \Exception
*/
public function moveBottom($id = 0)
{
if ($id > 0) {
// nzb/(nzbid)/movebottom
$params = ['sessionid' => $this->session];
$response = $this->sendRequest(sprintf('nzb/%s/movebottom', $id), $params);
}
}
/**
* Remove a (finished/unfinished) NZB from queue and delete files.
*
* @param int $id
* @return void
*
* @throws \Exception
*/
public function delete($id = 0)
{
if ($id > 0) {
// nzb/(nzbid)/movebottom
$params = ['sessionid' => $this->session];
$response = $this->sendRequest(sprintf('nzb/%s/cancelDelete', $id), $params);
}
}
/**
* move NZB to top of queue.
*
* @param int $id
* @return void
*
* @throws \Exception
*/
public function moveTop($id = 0)
{
if ($id > 0) {
// nzb/(nzbid)/movebottom
$params = ['sessionid' => $this->session];
$response = $this->sendRequest(sprintf('nzb/%s/movetop', $id), $params);
}
}
/**
* get filelist for nzb.
*
* @param int $id
* @return array|false
*
* @throws \Exception
*/
public function getFilelist($id = 0)
{
if ($id > 0) {
// file/(nzbid)
$params = ['sessionid' => $this->session];
return $this->sendRequest(sprintf('file/%s', $id), $params);
}
return false;
}
/**
* get /auth/nonce.
*
* @return void
*
* @throws \Exception
*/
protected function getNonce()
{
$response = $this->sendRequest('auth/nonce');
$this->nonce = $response['authNonce'];
}
/**
* @return void
*
* @throws \Exception
*/
protected function login()
{
$data = User::find(User::currentUserId());
$cnonce = generateUuid();
$hash = hash('sha256', sprintf('%s:%s:%s', $this->nonce, $cnonce, $data['nzbvortex_api_key']), true);
$hash = base64_encode($hash);
$params = [
'nonce' => $this->nonce,
'cnonce' => $cnonce,
'hash' => $hash,
];
$response = $this->sendRequest('auth/login', $params);
if ('successful' === $response['loginResult']) {
$this->session = $response['sessionID'];
}
if ('failed' === $response['loginResult']) {
}
}
/**
* sendRequest().
*
* @param array $params
* @return array
*
* @throws \Exception
*/
protected function sendRequest($path, $params = [])
{
$data = User::find(User::currentUserId());
$url = sprintf('%s/api', $data['nzbvortex_server_url']);
$params = http_build_query($params);
$ch = curl_init(sprintf('%s/%s?%s', $url, $path, $params));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
//curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
//curl_setopt($ch, CURLOPT_PROXY, 'localhost:8888');
$response = curl_exec($ch);
$response = json_decode($response, true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
switch ($status) {
case 0:
throw new \RuntimeException(sprintf('Unable to connect. Is NZBVortex running? Is your API key correct? Is something blocking ports? (Err: %s)', $error));
break;
case 200:
return $response;
break;
case 403:
throw new \RuntimeException('Unable to login. Is your API key correct?');
break;
default:
throw new \RuntimeException(sprintf('%s (%s): %s', $path, $status, $response['result']));
break;
}
}
}
-326
View File
@@ -1,326 +0,0 @@
<?php
namespace Blacklight;
use App\Models\Settings;
use GuzzleHttp\Client;
/**
* Class SABnzbd.
*/
class SABnzbd
{
/**
* Type of site integration.
*/
public const INTEGRATION_TYPE_NONE = 0;
public const INTEGRATION_TYPE_USER = 2;
/**
* Type of SAB API key.
*/
public const API_TYPE_NZB = 1;
public const API_TYPE_FULL = 2;
/**
* Priority to send the NZB to SAB.
*/
public const PRIORITY_PAUSED = -2;
public const PRIORITY_LOW = -1;
public const PRIORITY_NORMAL = 0;
public const PRIORITY_HIGH = 1; // Sab is completely disabled - no user can use it.
public const PRIORITY_FORCE = 2; // Sab is enabled, 1 remote SAB server for the whole site.
/**
* @var string
*/
public $url = '';
/**
* @var string
*/
public $apikey = '';
/**
* @var string
*/
public $priority = '';
/**
* @var string
*/
public $apikeytype = '';
/**
* @var int
*/
public $integrated = self::INTEGRATION_TYPE_NONE;
/**
* Is sab integrated into the site or not.
*
* @var bool
*/
public $integratedBool = false;
/**
* ID of the current user, to send to SAB when downloading a NZB.
*
*
* @var int|string
*/
protected $uid = '';
/**
* User's nntmux API key to send to SAB when downloading a NZB.
*
* @var string
*/
protected $rsstoken = '';
/**
* nZEDb Site URL to send to SAB to download the NZB.
*
* @var string
*/
protected $serverurl = '';
private $client;
/**
* SABnzbd constructor.
*
* @param \App\Http\Controllers\BasePageController $page
*
* @throws \Exception
*/
public function __construct($page)
{
$this->uid = $page->userdata['id'];
$this->api_token = $page->userdata['api_token'];
$this->serverurl = url('/');
$this->client = new Client(['verify' => false]);
// Set up properties.
switch (Settings::settingValue('apps.sabnzbplus.integrationtype')) {
case self::INTEGRATION_TYPE_USER:
if (! empty($_COOKIE['sabnzbd_'.$this->uid.'__apikey']) && ! empty($_COOKIE['sabnzbd_'.$this->uid.'__host'])) {
$this->url = $_COOKIE['sabnzbd_'.$this->uid.'__host'];
$this->apikey = $_COOKIE['sabnzbd_'.$this->uid.'__apikey'];
$this->priority = $_COOKIE['sabnzbd_'.$this->uid.'__priority'] ?? 0;
$this->apikeytype = $_COOKIE['sabnzbd_'.$this->uid.'__apitype'] ?? 1;
} elseif (! empty($page->userdata['sabapikey']) && ! empty($page->userdata['saburl'])) {
$this->url = $page->userdata['saburl'];
$this->apikey = $page->userdata['sabapikey'];
$this->priority = $page->userdata['sabpriority'];
$this->apikeytype = $page->userdata['sabapikeytype'];
}
$this->integrated = self::INTEGRATION_TYPE_USER;
switch ((int) $page->userdata['queuetype']) {
case 1:
case 2:
$this->integratedBool = true;
break;
default:
$this->integratedBool = false;
break;
}
break;
case self::INTEGRATION_TYPE_NONE:
$this->integrated = self::INTEGRATION_TYPE_NONE;
// This is for nzbget.
if ($page->userdata['queuetype'] === 2) {
$this->integratedBool = true;
}
break;
}
// Verify the URL is good, fix it if not.
if ($this->url !== '' && preg_match('/(?P<first>\/)?(?P<sab>[a-z]+)?(?P<last>\/)?$/i', $this->url, $hits)) {
if (! isset($hits['first'])) {
$this->url .= '/';
}
if (! isset($hits['sab'])) {
$this->url .= 'sabnzbd';
} elseif ($hits['sab'] !== 'sabnzbd') {
$this->url .= 'sabnzbd';
}
if (! isset($hits['last'])) {
$this->url .= '/';
}
}
}
/**
* @throws \RuntimeException
*/
public function sendToSab($guid): string
{
return $this->client->post(
$this->url.
'api?mode=addurl&priority='.
$this->priority.
'&apikey='.
$this->apikey.
'&name='.
urlencode(
$this->serverurl.
'getnzb?id='.
$guid.
'&r='.
$this->api_token
)
)->getBody()->getContents();
}
/**
* @throws \RuntimeException
*/
public function getAdvQueue(): string
{
return $this->client->get(
$this->url.
'api?mode=queue&start=START&limit=LIMIT&output=json&apikey='.
$this->apikey
)->getBody()->getContents();
}
/**
* @throws \RuntimeException
*/
public function getHistory(): string
{
return $this->client->get(
$this->url.
'api?mode=history&start=START&limit=LIMIT&category=CATEGORY&search=SEARCH&failed_only=0&output=json&apikey='.
$this->apikey
)->getBody()->getContents();
}
/**
* @throws \RuntimeException
*/
public function delFromQueue($id): string
{
return $this->client->get(
$this->url.
'api?mode=queue&name=delete&value='.
$id.
'&apikey='.
$this->apikey
)->getBody()->getContents();
}
/**
* @throws \RuntimeException
*/
public function pauseFromQueue($id): string
{
return $this->client->get(
$this->url.
'api?mode=queue&name=pause&value='.
$id.
'&apikey='.
$this->apikey
)->getBody()->getContents();
}
/**
* @return string
*
* @throws \RuntimeException
*/
public function resumeFromQueue($id)
{
return $this->client->get(
$this->url.
'api?mode=queue&name=resume&value='.
$id.
'&apikey='.
$this->apikey
)->getBody()->getContents();
}
/**
* @throws \RuntimeException
*/
public function pauseAll(): string
{
return $this->client->get(
$this->url.
'api?mode=pause'.
'&apikey='.
$this->apikey
)->getBody()->getContents();
}
/**
* Resume all NZB's in the SAB queue.
*
*
* @throws \RuntimeException
*/
public function resumeAll(): string
{
return $this->client->get(
$this->url.
'api?mode=resume'.
'&apikey='.
$this->apikey
)->getBody()->getContents();
}
/**
* Check if the SAB cookies are in the User's browser.
*
* @return bool
*/
public function checkCookie()
{
$res = false;
if (isset($_COOKIE['sabnzbd_'.$this->uid.'__apikey'])) {
$res = true;
}
if (isset($_COOKIE['sabnzbd_'.$this->uid.'__host'])) {
$res = true;
}
if (isset($_COOKIE['sabnzbd_'.$this->uid.'__priority'])) {
$res = true;
}
if (isset($_COOKIE['sabnzbd_'.$this->uid.'__apitype'])) {
$res = true;
}
return $res;
}
/**
* Creates the SAB cookies for the user's browser.
*/
public function setCookie($host, $apikey, $priority, $apitype)
{
setcookie('sabnzbd_'.$this->uid.'__host', $host, now()->addDays(30)->timestamp);
setcookie('sabnzbd_'.$this->uid.'__apikey', $apikey, now()->addDays(30)->timestamp);
setcookie('sabnzbd_'.$this->uid.'__priority', $priority, now()->addDays(30)->timestamp);
setcookie('sabnzbd_'.$this->uid.'__apitype', $apitype, now()->addDays(30)->timestamp);
}
/**
* Deletes the SAB cookies from the user's browser.
*/
public function unsetCookie()
{
setcookie('sabnzbd_'.$this->uid.'__host', '', now()->subDays(30)->timestamp);
setcookie('sabnzbd_'.$this->uid.'__apikey', '', now()->subDays(30)->timestamp);
setcookie('sabnzbd_'.$this->uid.'__priority', '', now()->subDays(30)->timestamp);
setcookie('sabnzbd_'.$this->uid.'__apitype', '', now()->subDays(30)->timestamp);
}
}
-2
View File
@@ -24,8 +24,6 @@ NNTmux improves upon the original design, implementing several new features incl
- Intelligent local caching of metadata
- Tmux (terminal session multiplexing) engine that provides thread, database and performance monitoring
- Image and video samples
- SABnzbd/NZBGet integration (web, API and pause/resume)
- CouchPotato integration (web and API)
## Prerequisites
@@ -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']);
-327
View File
@@ -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'));
}
}
}
+134 -223
View File
@@ -7,6 +7,10 @@ use App\Jobs\SendAccountWillExpireEmail;
use App\Jobs\SendInviteEmail;
use Carbon\CarbonImmutable;
use DariusIII\Token\Facades\Token;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Http\Request;
use Illuminate\Notifications\Notifiable;
@@ -54,7 +58,6 @@ use Spatie\Permission\Traits\HasRoles;
* @property string|null $sabapikey
* @property bool|null $sabapikeytype
* @property bool|null $sabpriority
* @property bool $queuetype Type of queue, Sab or NZBGet
* @property string|null $nzbgeturl
* @property string|null $nzbgetusername
* @property string|null $nzbgetpassword
@@ -76,48 +79,47 @@ use Spatie\Permission\Traits\HasRoles;
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserRequest[] $request
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserSerie[] $series
*
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereApiaccess($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereBookview($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereConsoleview($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereCpApi($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereCpUrl($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereFirstname($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereGameview($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereGrabs($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereHost($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereInvitedby($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereInvites($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereLastlogin($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereLastname($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereMovieview($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereMusicview($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereNotes($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereNzbgetpassword($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereNzbgeturl($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereNzbgetusername($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereNzbvortexApiKey($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereNzbvortexServerUrl($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User wherePassword($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereQueuetype($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereRememberToken($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereResetguid($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereRolechangedate($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereRsstoken($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereSabapikey($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereSabapikeytype($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereSabpriority($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereSaburl($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereStyle($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereUserRolesId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereUsername($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereUserseed($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereXxxview($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereVerified($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereApiToken($value)
* @method static Builder|\App\Models\User whereApiaccess($value)
* @method static Builder|\App\Models\User whereBookview($value)
* @method static Builder|\App\Models\User whereConsoleview($value)
* @method static Builder|\App\Models\User whereCpApi($value)
* @method static Builder|\App\Models\User whereCpUrl($value)
* @method static Builder|\App\Models\User whereCreatedAt($value)
* @method static Builder|\App\Models\User whereEmail($value)
* @method static Builder|\App\Models\User whereFirstname($value)
* @method static Builder|\App\Models\User whereGameview($value)
* @method static Builder|\App\Models\User whereGrabs($value)
* @method static Builder|\App\Models\User whereHost($value)
* @method static Builder|\App\Models\User whereId($value)
* @method static Builder|\App\Models\User whereInvitedby($value)
* @method static Builder|\App\Models\User whereInvites($value)
* @method static Builder|\App\Models\User whereLastlogin($value)
* @method static Builder|\App\Models\User whereLastname($value)
* @method static Builder|\App\Models\User whereMovieview($value)
* @method static Builder|\App\Models\User whereMusicview($value)
* @method static Builder|\App\Models\User whereNotes($value)
* @method static Builder|\App\Models\User whereNzbgetpassword($value)
* @method static Builder|\App\Models\User whereNzbgeturl($value)
* @method static Builder|\App\Models\User whereNzbgetusername($value)
* @method static Builder|\App\Models\User whereNzbvortexApiKey($value)
* @method static Builder|\App\Models\User whereNzbvortexServerUrl($value)
* @method static Builder|\App\Models\User wherePassword($value)
* @method static Builder|\App\Models\User whereRememberToken($value)
* @method static Builder|\App\Models\User whereResetguid($value)
* @method static Builder|\App\Models\User whereRolechangedate($value)
* @method static Builder|\App\Models\User whereRsstoken($value)
* @method static Builder|\App\Models\User whereSabapikey($value)
* @method static Builder|\App\Models\User whereSabapikeytype($value)
* @method static Builder|\App\Models\User whereSabpriority($value)
* @method static Builder|\App\Models\User whereSaburl($value)
* @method static Builder|\App\Models\User whereStyle($value)
* @method static Builder|\App\Models\User whereUpdatedAt($value)
* @method static Builder|\App\Models\User whereUserRolesId($value)
* @method static Builder|\App\Models\User whereUsername($value)
* @method static Builder|\App\Models\User whereUserseed($value)
* @method static Builder|\App\Models\User whereXxxview($value)
* @method static Builder|\App\Models\User whereVerified($value)
* @method static Builder|\App\Models\User whereApiToken($value)
*
* @mixin \Eloquent
*
@@ -134,15 +136,14 @@ use Spatie\Permission\Traits\HasRoles;
* @property-read \Spatie\Permission\Models\Role $role
* @property-read \Illuminate\Database\Eloquent\Collection|\Spatie\Permission\Models\Role[] $roles
*
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User permission($permissions)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User role($roles, $guard = null)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereEmailVerifiedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereRateLimit($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereRolesId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereVerificationToken($value)
* @method static Builder|\App\Models\User newModelQuery()
* @method static Builder|\App\Models\User newQuery()
* @method static Builder|\App\Models\User permission($permissions)
* @method static Builder|\App\Models\User query()
* @method static Builder|\App\Models\User whereEmailVerifiedAt($value)
* @method static Builder|\App\Models\User whereRateLimit($value)
* @method static Builder|\App\Models\User whereRolesId($value)
* @method static Builder|\App\Models\User whereVerificationToken($value)
*/
class User extends Authenticatable
{
@@ -297,36 +298,23 @@ class User extends Authenticatable
}
/**
* @param int $id
* @param string $userName
* @param string $email
* @param int $grabs
* @param int $role
* @param string $notes
* @param int $invites
* @param int $movieview
* @param int $musicview
* @param int $gameview
* @param int $xxxview
* @param int $consoleview
* @param int $bookview
* @param string $queueType
* @param string $nzbgetURL
* @param string $nzbgetUsername
* @param string $nzbgetPassword
* @param string $saburl
* @param string $sabapikey
* @param string $sabpriority
* @param string $sabapikeytype
* @param bool $nzbvortexServerUrl
* @param bool $nzbvortexApiKey
* @param bool $cp_url
* @param bool $cp_api
* @param string $style
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
* @param int $id
* @param string $userName
* @param string $email
* @param int $grabs
* @param int $role
* @param string $notes
* @param int $invites
* @param int $movieview
* @param int $musicview
* @param int $gameview
* @param int $xxxview
* @param int $consoleview
* @param int $bookview
* @param string $style
* @return int
*/
public static function updateUser($id, $userName, $email, $grabs, $role, $notes, $invites, $movieview, $musicview, $gameview, $xxxview, $consoleview, $bookview, $queueType = '', $nzbgetURL = '', $nzbgetUsername = '', $nzbgetPassword = '', $saburl = '', $sabapikey = '', $sabpriority = '', $sabapikeytype = '', $nzbvortexServerUrl = false, $nzbvortexApiKey = false, $cp_url = false, $cp_api = false, $style = 'None'): int
public static function updateUser(int $id, string $userName, string $email, int $grabs, int $role, string $notes, int $invites, int $movieview, int $musicview, int $gameview, int $xxxview, int $consoleview, int $bookview, string $style = 'None'): int
{
$userName = trim($userName);
@@ -345,18 +333,6 @@ class User extends Authenticatable
'consoleview' => $consoleview,
'bookview' => $bookview,
'style' => $style,
'queuetype' => $queueType,
'nzbgeturl' => $nzbgetURL,
'nzbgetusername' => $nzbgetUsername,
'nzbgetpassword' => $nzbgetPassword,
'saburl' => $saburl,
'sabapikey' => $sabapikey,
'sabapikeytype' => $sabapikeytype,
'sabpriority' => $sabpriority,
'nzbvortex_server_url' => $nzbvortexServerUrl,
'nzbvortex_api_key' => $nzbvortexApiKey,
'cp_url' => $cp_url,
'cp_api' => $cp_api,
'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60,
];
@@ -373,7 +349,8 @@ class User extends Authenticatable
}
/**
* @return \Illuminate\Database\Eloquent\Model|null|static
* @param string $userName
* @return User|Builder|Model|object|null
*/
public static function getByUsername(string $userName)
{
@@ -381,9 +358,9 @@ class User extends Authenticatable
}
/**
* @return \Illuminate\Database\Eloquent\Model|static
* @return Model|static
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
* @throws ModelNotFoundException
*/
public static function getByEmail(string $email)
{
@@ -393,7 +370,7 @@ class User extends Authenticatable
/**
* @return bool
*/
public static function updateUserRole(int $uid, int $role)
public static function updateUserRole(int $uid, int $role): bool
{
$roleQuery = Role::query()->where('id', $role)->first();
$roleName = $roleQuery->name;
@@ -405,10 +382,10 @@ class User extends Authenticatable
}
/**
* @param int $uid
* @param int $addYear
* @param int $uid
* @param int $addYear
*/
public static function updateUserRoleChangeDate($uid, $date = '', $addYear = 0): void
public static function updateUserRoleChangeDate(int $uid, $date = '', int $addYear = 0): void
{
$user = self::find($uid);
$currRoleExp = $user->rolechangedate ?? now()->toDateTimeString();
@@ -444,16 +421,16 @@ class User extends Authenticatable
}
/**
* @param string $userName
* @param string $email
* @param string $host
* @param string $role
* @param bool $apiRequests
* @param string $userName
* @param string $email
* @param string $host
* @param string $role
* @param bool $apiRequests
* @return \Illuminate\Database\Eloquent\Collection
*
* @throws \Throwable
*/
public static function getRange($start, $offset, $orderBy, $userName = '', $email = '', $host = '', $role = '', $apiRequests = false)
public static function getRange($start, $offset, $orderBy, string $userName = '', string $email = '', string $host = '', string $role = '', bool $apiRequests = false)
{
if ($apiRequests) {
UserRequest::clearApiRequests(false);
@@ -499,38 +476,18 @@ class User extends Authenticatable
{
$order = (empty($orderBy) ? 'username_desc' : $orderBy);
$orderArr = explode('_', $order);
switch ($orderArr[0]) {
case 'email':
$orderField = 'email';
break;
case 'host':
$orderField = 'host';
break;
case 'createdat':
$orderField = 'created_at';
break;
case 'lastlogin':
$orderField = 'lastlogin';
break;
case 'apiaccess':
$orderField = 'apiaccess';
break;
case 'grabs':
$orderField = 'grabs';
break;
case 'role':
$orderField = 'rolename';
break;
case 'rolechangedate':
$orderField = 'rolechangedate';
break;
case 'verification':
$orderField = 'verified';
break;
default:
$orderField = 'username';
break;
}
$orderField = match ($orderArr[0]) {
'email' => 'email',
'host' => 'host',
'createdat' => 'created_at',
'lastlogin' => 'lastlogin',
'apiaccess' => 'apiaccess',
'grabs' => 'grabs',
'role' => 'rolename',
'rolechangedate' => 'rolechangedate',
'verification' => 'verified',
default => 'username',
};
$orderSort = (isset($orderArr[1]) && preg_match('/^asc|desc$/i', $orderArr[1])) ? $orderArr[1] : 'desc';
return [$orderField, $orderSort];
@@ -541,11 +498,11 @@ class User extends Authenticatable
*
* Automatically update the hash if it needs to be.
*
* @param string $password Password to check against hash.
* @param string|bool $hash Hash to check against password.
* @param int $userID ID of the user.
* @param string $password Password to check against hash.
* @param bool|string $hash Hash to check against password.
* @param int $userID ID of the user.
*/
public static function checkPassword($password, $hash, $userID = -1): bool
public static function checkPassword(string $password, bool|string $hash, int $userID = -1): bool
{
if (Hash::check($password, $hash) === false) {
return false;
@@ -585,17 +542,18 @@ class User extends Authenticatable
}
/**
* @return mixed
* @param $password
* @return string
*/
public static function hashPassword($password)
public static function hashPassword($password): string
{
return Hash::make($password);
}
/**
* @return \Illuminate\Database\Eloquent\Model|static
* @return Model|static
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
* @throws ModelNotFoundException
*/
public static function getByPassResetGuid(string $guid)
{
@@ -603,31 +561,15 @@ class User extends Authenticatable
}
/**
* @param int $num
* @param int $num
*/
public static function incrementGrabs(int $id, $num = 1): void
public static function incrementGrabs(int $id, int $num = 1): void
{
self::find($id)->increment('grabs', $num);
}
/**
* Check if the user is in the database, and if their API key is good, return user data if so.
*
*
* @return bool|\Illuminate\Database\Eloquent\Model|null|static
*/
public static function getByIdAndRssToken($userID, $rssToken)
{
$user = self::query()->where(['id' => $userID, 'api_token' => $rssToken])->first();
if ($user === null) {
return false;
}
return $user;
}
/**
* @return \Illuminate\Database\Eloquent\Model|null|static
* @return Model|null|static
*/
public static function getByRssToken(string $rssToken)
{
@@ -640,36 +582,30 @@ class User extends Authenticatable
}
/**
* Generate a random username.
*/
public static function generateUsername(): string
{
return Str::random();
}
/**
* @param int $length
* @param int $length
*
* @throws \Exception
*/
public static function generatePassword($length = 15): string
public static function generatePassword(int $length = 15): string
{
return Token::random($length, true);
}
/**
* Register a new user.
*
* @param int $invites
* @param string $inviteCode
* @param bool $forceInviteMode
* @param int $role
* @param bool $validate
* @param $userName
* @param $password
* @param $email
* @param $host
* @param $notes
* @param int $invites
* @param string $inviteCode
* @param bool $forceInviteMode
* @param int $role
* @param bool $validate
* @return bool|int|string
*
* @throws \Exception
*/
public static function signUp($userName, $password, $email, $host, $notes, $invites = Invitation::DEFAULT_INVITES, $inviteCode = '', $forceInviteMode = false, $role = self::ROLE_USER, $validate = true)
public static function signUp($userName, $password, $email, $host, $notes, int $invites = Invitation::DEFAULT_INVITES, string $inviteCode = '', bool $forceInviteMode = false, int $role = self::ROLE_USER, bool $validate = true): bool|int|string
{
$user = [
'username' => trim($userName),
@@ -685,9 +621,7 @@ class User extends Authenticatable
]);
if ($validator->fails()) {
$error = implode('', Arr::collapse($validator->errors()->toArray()));
return $error;
return implode('', Arr::collapse($validator->errors()->toArray()));
}
}
@@ -726,19 +660,19 @@ class User extends Authenticatable
/**
* Add a new user.
*
* @param string $userName
* @param string $password
* @param string $email
* @param int $role
* @param string $notes
* @param string $host
* @param int $invites
* @param int $invitedBy
* @param string $userName
* @param string $password
* @param string $email
* @param int $role
* @param string $notes
* @param string $host
* @param int $invites
* @param int $invitedBy
* @return bool|int
*
* @throws \Exception
*/
public static function add($userName, $password, $email, $role, $notes = '', $host = '', $invites = Invitation::DEFAULT_INVITES, $invitedBy = 0)
public static function add(string $userName, string $password, string $email, int $role, string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0)
{
$password = self::hashPassword($password);
if (! $password) {
@@ -766,11 +700,11 @@ class User extends Authenticatable
/**
* Get the list of categories the user has excluded.
*
* @param int $userID ID of the user.
* @param int $userID ID of the user.
*
* @throws \Exception
*/
public static function getCategoryExclusionById($userID): array
public static function getCategoryExclusionById(int $userID): array
{
$ret = [];
@@ -822,9 +756,7 @@ class User extends Authenticatable
}
}
$exclusion = Category::query()->whereIn('root_categories_id', $ret)->pluck('id')->toArray();
return $exclusion;
return Category::query()->whereIn('root_categories_id', $ret)->pluck('id')->toArray();
}
/**
@@ -869,27 +801,6 @@ class User extends Authenticatable
return $url;
}
/**
* Deletes old rows FROM the user_requests and user_downloads tables.
* if site->userdownloadpurgedays SET to 0 then all release history is removed but
* the download/request rows must remain for at least one day to allow the role based
* limits to apply.
*
* @param int $days
*
* @throws \Exception
*/
public static function pruneRequestHistory($days = 0): void
{
if ($days === 0) {
$days = 1;
UserDownload::query()->update(['releases_id' => null]);
}
UserRequest::query()->where('timestamp', '<', now()->subDays($days))->delete();
UserDownload::query()->where('timestamp', '<', now()->subDays($days))->delete();
}
/**
* Deletes users that have not verified their accounts for 3 or more days.
*/
@@ -898,7 +809,7 @@ class User extends Authenticatable
static::whereVerified(0)->where('created_at', '<', now()->subDays(3))->delete();
}
public function passwordSecurity(): \Illuminate\Database\Eloquent\Relations\HasOne
public function passwordSecurity(): HasOne
{
return $this->hasOne(PasswordSecurity::class);
}
@@ -38,20 +38,8 @@ class CreateUsersTable extends Migration
$table->integer('bookview')->default(1);
$table->integer('gameview')->default(1);
$table->integer('rate_limit')->default(60);
$table->string('saburl')->nullable();
$table->string('sabapikey')->nullable();
$table->boolean('sabapikeytype')->nullable();
$table->boolean('sabpriority')->nullable();
$table->boolean('queuetype')->default(1)->comment('Type of queue, Sab or NZBGet');
$table->string('nzbgeturl')->nullable();
$table->string('nzbgetusername')->nullable();
$table->string('nzbgetpassword')->nullable();
$table->string('nzbvortex_api_key', 10)->nullable();
$table->string('nzbvortex_server_url')->nullable();
$table->string('userseed', 50);
$table->string('notes')->nullable();
$table->string('cp_url')->nullable();
$table->string('cp_api')->nullable();
$table->string('style')->nullable();
$table->dateTime('rolechangedate')->nullable()->comment('When does the role expire');
$table->timestamp('email_verified_at')->nullable();
-328
View File
@@ -40,145 +40,6 @@ jQuery(function($) {
return false;
});
$('.sabsend').click(function(e) {
if ($(this).hasClass('icon_sab_clicked')) return false;
let guid = $('.guid')
.attr('id')
.substring(4);
let nzburl = base_url + '/sendtoqueue/' + guid;
$.post(nzburl, function(resp) {
$(e.target)
.addClass('icon_sab_clicked')
.attr('title', 'Added to Queue');
PNotify.defaults.icons = 'fontawesome5';
PNotify.success({
title: 'Release added to your download queue!',
type: 'success',
icon: 'fa fa-info fa-3x',
Animate: {
animate: true,
in_class: 'bounceInLeft',
out_class: 'bounceOutRight',
},
desktop: {
desktop: true,
fallback: true,
},
});
});
return false;
});
$('.getsend').click(function(e) {
if ($(this).hasClass('icon_nzbget_clicked')) return false;
let guid = $('.guid')
.attr('id')
.substring(4);
let nzburl = base_url + '/sendtoqueue/' + guid;
$.post(nzburl, function(resp) {
$(e.target)
.addClass('icon_nzbget_clicked')
.attr('title', 'Added to Queue');
PNotify.defaults.icons = 'fontawesome5';
PNotify.success({
title: 'Release added to your download queue!',
type: 'success',
icon: 'fa fa-info fa-3x',
Animate: {
animate: true,
in_class: 'bounceInLeft',
out_class: 'bounceOutRight',
},
desktop: {
desktop: true,
fallback: true,
},
});
});
return false;
});
$('.sendtocouch').click(function(e) {
if ($(this).hasClass('icon_cp_clicked')) return false;
let id = $(this)
.attr('id')
.substring(4);
let cpurl = base_url + 'sendtocouch/' + id;
$.post(cpurl, function(resp) {
$(e.target)
.addClass('icon_cp_clicked')
.attr('title', 'Added to CouchPotato');
PNotify.defaults.icons = 'fontawesome5';
PNotify.success({
title: 'Movie added to CoucPotato wanted list!',
type: 'success',
icon: 'fa fa-info fa-3x',
Animate: {
animate: true,
in_class: 'bounceInLeft',
out_class: 'bounceOutRight',
},
desktop: {
desktop: true,
fallback: true,
},
});
});
return false;
});
$('.vortexsend').click(function(event) {
if ($(this).hasClass('icon_nzbvortex_clicked')) return false;
let guid = $('.guid')
.attr('id')
.substring(4);
if (guid && guid.length > 0) {
$.ajax({
url: base_url + 'nzbvortex?addQueue=' + guid + '&isAjax',
cache: false,
})
.done(function(html) {
let message = 'Added ' + guid + ' to queue.';
$(event.target)
.addClass('icon_nzbvortex_clicked')
.attr('title', message);
PNotify.defaults.icons = 'fontawesome5';
PNotify.success({
title: 'Release added to your download queue!',
type: 'success',
icon: 'fa fa-info fa-3x',
Animate: {
animate: true,
in_class: 'bounceInLeft',
out_class: 'bounceOutRight',
},
desktop: {
desktop: true,
fallback: true,
},
});
})
.fail(function(response) {
alert(response.responseText);
});
}
return false;
});
let vortexStates = new Array();
vortexStates[0] = 'Waiting';
vortexStates[1] = 'Downloading';
vortexStates[2] = 'Downloaded';
vortexStates[3] = 'Saving';
vortexStates[4] = 'Saved';
vortexStates[5] = 'Skipped';
// browse.tpl, search.tpl -- show icons on hover
let orig_opac = $('table.data tr')
.children('td.icons')
@@ -289,195 +150,6 @@ jQuery(function($) {
return false;
});
$('.icon_nzbvortex').click(function(event) {
if ($(this).hasClass('icon_nzbvortex_clicked')) return false;
let guid = $(this)
.parent()
.parent()
.attr('id')
.substring(4);
if (guid && guid.length > 0) {
$.ajax({
url: base_url + '/nzbvortex?addQueue=' + guid + '&isAjax',
cache: false,
})
.done(function(html) {
let message = 'Added ' + guid + ' to queue.';
$(event.target)
.addClass('icon_nzbvortex_clicked')
.attr('title', message);
PNotify.defaults.icons = 'fontawesome5';
PNotify.success({
title: 'ADDED TO NZBVORTEX!',
type: 'success',
icon: 'fa fa-info fa-3x',
Animate: {
animate: true,
in_class: 'bounceInLeft',
out_class: 'bounceOutRight',
},
desktop: {
desktop: true,
fallback: true,
},
});
})
.fail(function(response) {
alert(response.responseText);
});
}
return false;
});
$(document).on('click', 'a.vortex-resume', function(event) {
event.preventDefault();
$('#vortex-overlay-' + $(this).attr('href')).show();
$.get(base_url + 'nzbvortex?resume=' + $(this).attr('href') + '&isAjax');
$(this).removeAttr('href');
return false;
});
$(document).on('click', 'a.vortex-pause', function(event) {
event.preventDefault();
$('#vortex-overlay-' + $(this).attr('href')).show();
$.get(base_url + 'nzbvortex?pause=' + $(this).attr('href') + '&isAjax');
$(this).removeAttr('href');
return false;
});
$(document).on('click', 'a.vortex-moveup', function(event) {
event.preventDefault();
$('#vortex-overlay-' + $(this).attr('href')).show();
$.get(base_url + 'nzbvortex?moveup=' + $(this).attr('href') + '&isAjax');
$(this).removeAttr('href');
return false;
});
$(document).on('click', 'a.vortex-movedown', function(event) {
event.preventDefault();
$('#vortex-overlay-' + $(this).attr('href')).show();
$.get(base_url + 'nzbvortex?movedown=' + $(this).attr('href') + '&isAjax');
$(this).removeAttr('href');
return false;
});
$(document).on('click', 'a.vortex-movetop', function(event) {
event.preventDefault();
$('#vortex-overlay-' + $(this).attr('href')).show();
$.get(base_url + 'nzbvortex?movetop=' + $(this).attr('href') + '&isAjax');
$(this).removeAttr('href');
return false;
});
$(document).on('click', 'a.vortex-movebottom', function(event) {
event.preventDefault();
$('#vortex-overlay-' + $(this).attr('href')).show();
$.get(base_url + 'nzbvortex?movebottom=' + $(this).attr('href') + '&isAjax');
$(this).removeAttr('href');
return false;
});
$(document).on('click', 'a.vortex-trash', function(event) {
event.preventDefault();
$('#vortex-overlay-' + $(this).attr('href')).show();
$.get(base_url + 'nzbvortex?delete=' + $(this).attr('href') + '&isAjax');
$(this).removeAttr('href');
return false;
});
$(document).on('click', 'a.vortex-filelist', function(event) {
event.preventDefault();
let id = $(this).attr('href');
$('#vortex-overlay-' + id).show();
$.colorbox({});
$.ajax({
url: base_url + '/nzbvortex?filelist=' + id + '&isAjax',
cache: false,
})
.done(function(response) {
$('#cboxLoadingGraphic').hide();
let json = $.parseJSON(response);
console.log(json);
$.each(json.files, function(k, v) {
$('#cboxContent').append(
'<strong>' + v.fileName + '</strong> (' + vortexStates[v.state] + ')<br />'
);
});
})
.fail(function(response) {
alert('Unable to retrieve filelist: ' + response.responseText);
});
$(this).removeAttr('href');
return false;
});
$('.icon_sab').click(function(e) {
if ($(this).hasClass('icon_sab_clicked')) return false;
let guid = $(this)
.attr('id')
.substring(4);
let nzburl = base_url + '/sendtoqueue/' + guid;
$.post(nzburl, function(resp) {
$(e.target)
.addClass('icon_sab_clicked')
.attr('title', 'Release added to Queue');
PNotify.defaults.icons = 'fontawesome5';
PNotify.success({
title: 'Release added to your download queue!',
type: 'success',
icon: 'fa fa-info fa-3x',
Animate: {
animate: true,
in_class: 'bounceInLeft',
out_class: 'bounceOutRight',
},
desktop: {
desktop: true,
fallback: true,
},
});
});
return false;
});
$('.icon_nzbget').click(function(e) {
if ($(this).hasClass('icon_nzbget_clicked')) return false;
let guid = $(this)
.attr('id')
.substring(4);
let nzburl = base_url + '/sendtoqueue/' + guid;
$.post(nzburl, function(resp) {
$(e.target)
.addClass('icon_nzbget_clicked')
.attr('title', 'Added to Queue');
PNotify.defaults.icons = 'fontawesome5';
PNotify.success({
title: 'Release added to your download queue!',
type: 'success',
icon: 'fa fa-info fa-3x',
Animate: {
animate: true,
in_class: 'bounceInLeft',
out_class: 'bounceOutRight',
},
desktop: {
desktop: true,
fallback: true,
},
});
});
return false;
});
$('table.data a.modal_nfo').colorbox({
// NFO modal
href: function() {
-16
View File
@@ -188,22 +188,6 @@
data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to my download basket"></i></a>
{if isset($sabintegrated) && $sabintegrated !=""}
<a href="#">
<i id="guid{$result->guid}"
class="icon_sab text-muted fa fa-share"
data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to my Queue">
</i>
</a>
{/if}
{if $weHasVortex}
<a href="#" class="icon_vortex text-muted"><i
class="fa fa-share" data-bs-toggle="tooltip"
data-bs-placement="top"
title data-original-title="Send to NZBVortex"></i></a>
{/if}
</td>
</tr>
{/foreach}
-36
View File
@@ -171,24 +171,6 @@
data-bs-toggle="tooltip" data-bs-placement="top" title
data-original-title="Send to my download basket"><i
class="fa fa-shopping-basket"></i></span></a>
{if isset($sabintegrated) && $sabintegrated !=""}
<span class="btn btn-hover btn-light btn-xs icon_sab text-muted"
id="guid{$mguid[$m@index]}"
data-bs-toggle="tooltip" data-bs-placement="top"
title
data-original-title="Send to my Queue"><i
class="fa fa-share"></i></span>
{/if}
{if !empty($cpurl) && !empty($cpapi)}
<span
id="imdb{$result->imdbid}"
href="javascript:;"
class="btn btn-hover btn-light btn-xs sendtocouch text-muted"
data-bs-toggle="tooltip" data-bs-placement="top"
title data-original-title="Send to CouchPotato">
<i class="fa fa-bed"></i>
</span>
{/if}
{if !empty($mfailed[$m@index])}
<span class="btn btn-light btn-xs"
title="This release has failed to download for some users">
@@ -315,24 +297,6 @@
data-bs-toggle="tooltip" data-bs-placement="top" title
data-original-title="Send to my download basket"><i
class="fa fa-shopping-basket"></i></span></a>
{if isset($sabintegrated) && $sabintegrated !=""}
<span class="btn btn-hover btn-light btn-xs icon_sab text-muted"
id="guid{$mguid[$m@index]}"
data-bs-toggle="tooltip" data-bs-placement="top"
title
data-original-title="Send to my Queue"><i
class="fa fa-share"></i></span>
{/if}
{if !empty($cpurl) && !empty($cpapi)}
<span
id="imdb{$result->imdbid}"
href="javascript:;"
class="btn btn-hover btn-light btn-xs sendtocouch text-muted"
data-bs-toggle="tooltip" data-bs-placement="top"
title data-original-title="Send to CouchPotato">
<i class="fa fa-bed"></i>
</span>
{/if}
{if !empty($mfailed[$m@index])}
<span class="btn btn-light btn-xs"
title="This release has failed to download for some users">
@@ -1,59 +0,0 @@
{if $overview['nzbs']|@count gt 0}
{foreach from=$overview['nzbs'] item=nzb}
<div style="border-top: 2px solid #eee; margin: 0 0 5px 0; position: relative">
<div id="vortex-overlay-{$nzb['id']}"
style="position: absolute; background-color: #000; opacity: 0.2; width: 100%; height: 100%; display: none"></div>
<div class="vortex-nzb" style="padding: 5px 0 5px 0">
<i>{$nzb['uiTitle']}</i>
<br/>
<div style="width: 20px; float: left; margin: 7px 0 0 0">
{if $nzb['isPaused'] == 1}
<img src="{{asset("/assets/images/icons/vortex/blah.png")}}"
style="float: left; margin: 0 5px 0 0"/>
{else}
<img src="{{asset("/assets/images/icons/vortex/bigsmile.png")}}"
style="float: left; margin: 0 5px 0 0"/>
{/if}
</div>
<div class="vortex-progressbar"
style="margin: 5px 0 0 0; background-color: #eee; height: 15px; padding: 3px; border-radius: 2px; float: left; width: 720px">
<div style="float: left; background-color: {if $nzb['isPaused'] == 1}#FB8084{else}#91BA98{/if}; height: 15px; width: {$nzb['progress']}%"></div>
</div>
<br style="clear: both"/>
<strong>{$nzb['state']}{if $nzb['statusText'] neq ''} ({$nzb['statusText']|lower}){/if}</strong>: {$nzb['progress']|round}
% of {math|string_format:"%.2f" equation="size / 1024 / 1024" size=$nzb['totalDownloadSize']}
MB {if $nzb['transferedSpeed'] neq 0}@ {math|string_format:"%.2f" equation="size / 1024 / 1024" size=$nzb['transferedSpeed']} MB/s{/if}
<div class="vortex-controls" style="margin: 5px 0 0 0">
<div style="border-right: 2px solid #eee; width: 41px; float: left; margin: 0 5px 0 0">
{if $nzb['isPaused'] == 1}
<a class="vortex-resume" title="Resume" href="{$nzb['id']}"><img
src="{{asset("/assets/images/icons/vortex/play.png")}}"/></a>
{else}
<a class="vortex-pause" title="Pause" href="{$nzb['id']}"><img
src="{{asset("/assets/images/icons/vortex/pause.png")}}"/></a>
{/if}
<a class="vortex-filelist" title="View filelist" href="{$nzb['id']}"><img
src="{{asset("/assets/images/icons/vortex/tv.png")}}"/></a>
</div>
<div class="vortex-controls" style="float: left">
<a class="vortex-moveup" title="Move up in queue" href="{$nzb['id']}"><img
src="{{asset("/assets/images/icons/vortex/arrow2_n.png")}}"/></a>
<a class="vortex-movedown" title="Move down in queue" href="{$nzb['id']}"><img
src="{{asset("/assets/images/icons/vortex/arrow2_s.png")}}"/></a>
<a class="vortex-movebottom" title="Move to bottom of queue" href="{$nzb['id']}"><img
src="{{asset("/assets/images/icons/vortex/arrow3_s.png")}}"/></a>
<a class="vortex-movetop" title="Move to top of queue" href="{$nzb['id']}"><img
src="{{asset("/assets/images/icons/vortex/arrow3_n.png")}}"/></a>
<a class="vortex-trash" title="Cancel and delete NZB" href="{$nzb['id']}"><img
src="{{asset("/assets/images/icons/vortex/trash.png")}}"/></a>
</div>
<br style="clear: both"/>
</div>
</div>
</div>
{/foreach}
{else}
<div id="vortex-info" style="background-color: #2A8FBD; text-align: center; padding: 5px; color: #eee">
Nothing in queue, go ahead and add something!
</div>
{/if}
@@ -1,40 +0,0 @@
<div class="header">
<h2>NZBVortex > <strong>Queue</strong></h2>
<div class="breadcrumb-wrapper">
<ol class="breadcrumb">
<li><a href="{{url("{$site->home_link}")}}">Home</a></li>
/ NZB
</ol>
</div>
</div>
{if $weHasVortex}
<div id="vortex-error"
style="display: none; background-color: #767A9E; text-align: center; padding: 5px; color: #eee"></div>
<div id="vortex">
</div>
{literal}
<script type="text/javascript">
var timer = 0;
function getOverview() {
$.ajax
({
url:{{url('/nzbvortex?getOverview&isAjax')}},
cache: false
}).done(function (html) {
$("#vortex").html(html);
timer = setTimeout(getOverview, 2500);
}).fail(function (response) {
$('#vortex').hide();
$('#vortex-error').show();
$('#vortex-error').html(response.responseText);
clearTimeout(timer);
});
}
getOverview();
</script>
{/literal}
{else}
<p>Make sure you've entered API key and server URL under profile settings.</p>
{/if}
@@ -119,22 +119,6 @@
<th>Downloads Total</th>
<td>{$user.grabs}</td>
</tr>
{if $site->integrationtype == 2 && !$publicview}
<tr>
<th>SABnzbd Integration:</th>
<td>
<b>Url:</b> {if $saburl == ''}N/A{else}{$saburl}{/if}
<br/>
<b>Key:</b> {if $sabapikey == ''}N/A{else}{$sabapikey}{/if}
<br/>
<b>Type:</b> {if $sabapikeytype == ''}N/A{else}{$sabapikeytype}{/if}
<br/>
<b>Priority:</b> {if $sabpriority == ''}N/A{else}{$sabpriority}{/if}
<br/>
<b>Storage:</b> {if $sabsetting == ''}N/A{else}{$sabsetting}{/if}
</td>
</tr>
{/if}
{if (isset($isadmin) && $isadmin === "true") || !$publicview}
<tr>
<th title="Not public">API/RSS Key</th>
@@ -229,136 +229,6 @@
</table>
{/if}
</div>
<div class="tab-pane fade" id="downloaders" role="tabpanel" aria-labelledby="downloaders-tab">
<div class="alert alert-info">
These settings are only needed if you want to be able to push NZB's
to your downloader straight from the website. You don't need this
for automation software like Sonarr, Sickbeard, SickRage, SickGear
or Couchpotato to
function.
</div>
<br>
{if {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} != 1}
<table class="data table table-striped">
<tbody>
<tr class="bg-aqua-active">
<td colspan="2" style="padding-left: 8px;"><strong>Queue
type
<small>(NZBGet or SABnzbd)</small>
</strong></td>
</tr>
<tr>
<th width="200">Select type</th>
<td>
{html_options id="queuetypeids" name='queuetypeids' values=$queuetypeids output=$queuetypes selected=$user.queuetype}
<span class="form-text.text-muted">Pick the type of queue you wish to use, once you save your profile, the page will reload, the box will appear and you can fill out the details.</span>
</td>
</tr>
</tbody>
</table>
{/if}
{if $user.queuetype == 1 && {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} == 2}
<table class="data table table-striped">
<tbody>
<tr class="bg-aqua-active">
<td colspan="2" style="padding-left: 8px;">
<strong>SABnzbd</strong>
</td>
</tr>
<tr>
<th width="200">URL</th>
<td><input id="saburl" class="form-inline"
name="saburl" type="text"
placeholder="SABNZBd URL"
value="{$saburl_selected}"></td>
</tr>
<tr>
<th width="200">API Key</th>
<td><input id="sabapikey" class="form-inline"
name="sabapikey" type="text"
placeholder="SABNZbd API Key"
value="{$sabapikey_selected}"></td>
</tr>
<tr>
<th width="200">API Key Type</th>
<td>
{html_radios id="sabapikeytype" name='sabapikeytype' values=$sabapikeytype_ids output=$sabapikeytype_names selected=$sabapikeytype_selected separator='<br />'}
<div class="hint">
Select the type of api key you entered in the
above setting. Using your full SAB api key will
allow you access to the SAB queue from within
this site.
</div>
</td>
</tr>
<tr>
<th width="200">Priority Level</th>
<td>
{html_options id="sabpriority" class="form-inline" name='sabpriority' values=$sabpriority_ids output=$sabpriority_names selected=$sabpriority_selected}
<div class="hint">Set the priority level for NZBs that
are added to your queue
</div>
</td>
</tr>
<tr>
<th width="200">Setting Storage</th>
<td>
{html_radios id="sabsetting" name='sabsetting' values=$sabsetting_ids output=$sabsetting_names selected=$sabsetting_selected separator='&nbsp;&nbsp;'}{if $sabsetting_selected == 2}&nbsp;&nbsp;[
<a class="confirm_action"
href="?action=clearcookies">Clear Cookies</a>
]{/if}
<div class="hint">Where to store the SAB setting.<br/>&bull;
<b>Cookie</b> will store the setting in your
browsers coookies and will only work when using your
current browser.<br/>&bull; <b>Site</b> will store
the setting in your user account enabling it to work
no matter where you are logged in from.<br/><span
class="warning"><b>Please Note:</b></span>
You should only store your full SAB api key with
sites you trust.
</div>
</td>
</tr>
</tbody>
</table>
{/if}
{if $user.queuetype == 2 && ({{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} == 0 || {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} == 2)}
<table class="data table table-striped">
<tbody>
<tr class="bg-aqua-active">
<td colspan="2" style="padding-left: 8px;">
<strong>NZBget</strong>
</td>
</tr>
<tr>
<th width="200">URL</th>
<td><input id="nzbgeturl" placeholder="NZBGet URL"
class="form-inline" name="nzbgeturl"
type="text" value="{$user.nzbgeturl}"/></td>
</tr>
<tr>
<th width="200">Username / Password</th>
<td>
<div class="form-inline">
<input id="nzbgetusername"
placeholder="NZBGet Username"
class="form-inline"
name="nzbgetusername" type="text"
value="{$user.nzbgetusername}"/>
/
<input id="nzbgetpassword"
placeholder="NZBGet Password"
class="form-inline"
name="nzbgetpassword" type="text"
value="{$user.nzbgetpassword}"/>
</div>
</td>
</tr>
</tbody>
</table>
{/if}
<br/>
</div>
</div>
{{Form::submit('Save', ['class' => 'btn btn-success'])}}
{{Form::close()}}
-15
View File
@@ -367,21 +367,6 @@
data-bs-toggle="tooltip"
data-bs-placement="top"
data-original-title="Send to my download basket"></i></a>
{if isset($sabintegrated) && $sabintegrated !=""}
<a href="#">
<i id="guid{$result->guid}"
class="icon_sab text-muted fa fa-share"
data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to my Queue">
</i>
</a>
{/if}
{if $weHasVortex}
<a href="#" class="icon_vortex text-muted"><i
class="fa fa-share" data-bs-toggle="tooltip" data-bs-placement="top"
title data-original-title="Send to NZBVortex"></i></a>
{/if}
</td>
</tr>
{/foreach}
@@ -154,23 +154,6 @@
data-original-title="Send to my Download Basket">
</i>
</a>
{if isset($sabintegrated) && $sabintegrated !=""}
<a href="#">
<i
id="guid{$result->guid}"
class="fa fa-share"
data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to My Queue">
</i>
</a>
{/if}
{if $weHasVortex}
<a href="#" class="icon_vortex text-muted"><i
class="fa fa-share" data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to NZBVortex"></i></a>
{/if}
</td>
</tr>
{/foreach}
@@ -169,23 +169,6 @@
data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to my download basket"></i></a>
{if isset($sabintegrated) && $sabintegrated !=""}
<a href="#">
<i id="guid{$mguid[$m@index]}"
class="icon_sab text-muted fa fa-share"
data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to my Queue">
</i>
</a>
{/if}
{if $weHasVortex}
<a href="#" class="icon_vortex text-muted"><i
class="fa fa-share" data-bs-toggle="tooltip"
data-bs-placement="top"
title
data-original-title="Send to NZBVortex"></i></a>
{/if}
</td>
</tr>
{/foreach}
@@ -249,26 +249,6 @@
id="guid{$release.guid}"></i> Send to Queue
</button>
{/if}
{if !empty($movie.imdbid)}
{if !empty($cpurl) && !empty($cpapi)}
<button
type="button"
id="imdb{$movie.imdbid}"
href="javascript:;"
class="btn btn-success btn-sm btn-info btn-transparent sendtocouch">
<i class="fa fa-bed"></i>
Send to CouchPotato
</button>
{/if}
{/if}
{if $weHasVortex}
<button type="button"
class="btn btn-success btn-sm btn-transparent vortexsend">
<i class="icon_sab fa fa-arrow-right"
id="guid{$release.guid}"></i> Send to
NZBVortex
</button>
{/if}
</div>
</div>
<div class="col-md-9 small-gutter-left">
@@ -1,70 +0,0 @@
<div class="well well-sm">
<div class="header">
<h2>Download > <strong>Queue</strong></h2>
<div class="breadcrumb-wrapper">
<ol class="breadcrumb">
<li><a href="{{url("{$site->home_link}")}}">Home</a></li>
/ NZB
</ol>
</div>
</div>
{if $error == ''}
{if {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} > 0 || $user.queuetype == 2}
<p style="text-align:center;">
The following queue is pulled from
<a href="{$serverURL|escape:"htmlall"}">{$serverURL|escape:"htmlall"}</a>.
<br/>
{if {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} == 2 || $user.queuetype == 2}Edit your queue settings in
<a href="{{route('profileedit')}}">your profile</a>
.{/if}
</p>
<div class="sab_queue"></div>
{if $user.queuetype == 2}
{literal}
<script type="text/javascript">
function getQueue() {
var rand_no = Math.random();
$.ajax({
url: "nzbgetqueuedata?id=" + rand_no,
cache: false,
success: function (html) {
$(".sab_queue").html(html);
setTimeout("getQueue()", 2500);
},
error: function () {
$(".sab_queue").html("<p style='text-align:center;'>Could not contact your queue. <a href=\"javascript:location.reload(true)\">Refresh</a></p>");
},
timeout: 5000
});
}
</script>
{/literal}
{else}
{literal}
<script type="text/javascript">
function getQueue() {
var rand_no = Math.random();
$.ajax({
url: "sabqueuedata?id=" + rand_no,
cache: false,
success: function (html) {
$(".sab_queue").html(html);
setTimeout("getQueue()", 2500);
},
error: function () {
$(".sab_queue").html("<p style='text-align:center;'>Could not contact your queue. <a href=\"javascript:location.reload(true)\">Refresh</a></p>");
},
timeout: 5000
});
}
</script>
{/literal}
{/if}
<body onLoad="getQueue();">
{else}
<p style="text-align:center;">The {$queueType} queue has been disabled by the administrator.</p>
{/if}
{else}
<p style="text-align:center;">{$error}</p>
{/if}
</div>
@@ -227,24 +227,6 @@
data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to my download basket"></i></a>
{if isset($sabintegrated) && $sabintegrated !=""}
<a href="#">
<i id="guid{$result->guid}"
class="icon_sab text-muted fa fa-share"
data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to my Queue">
</i>
</a>
{/if}
{if $weHasVortex}
<a href="#" class="icon_vortex text-muted"><i
class="fa fa-share"
data-bs-toggle="tooltip"
data-bs-placement="top"
title
data-original-title="Send to NZBVortex"></i></a>
{/if}
</td>
</tr>
{/foreach}
@@ -155,21 +155,6 @@
class="text-muted fa fa-shopping-basket" data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to my download basket"></i></a>
{if isset($sabintegrated) && $sabintegrated !=""}
<a href="#">
<i id="guid{$mguid[$m@index]}"
class="icon_sab text-muted fa fa-share"
data-bs-toggle="tooltip"
data-bs-placement="top" title
data-original-title="Send to my Queue">
</i>
</a>
{/if}
{if $weHasVortex}
<a href="#" class="icon_vortex text-muted"><i
class="fa fa-share" data-bs-toggle="tooltip" data-bs-placement="top"
title data-original-title="Send to NZBVortex"></i></a>
{/if}
</td>
</tr>
{/foreach}
@@ -271,23 +271,6 @@
</table>
</fieldset>
<fieldset>
<legend>Download Queue Integration Settings</legend>
<table class="input data table table-striped responsive-utilities jambo-table">
<tr>
<td style="width:160px;"><label for="sabintegrationtype">Integration Type</label>:</td>
<td>
{html_radios id="sabintegrationtype" name='sabintegrationtype' values=$sabintegrationtype_ids output=$sabintegrationtype_names selected=$site->integrationtype separator='<br />'}
<div class="hint">Whether to allow integration with a SAB/NZBGet install or not<br/></div>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>Usenet Settings</legend>
<table class="input data table table-striped responsive-utilities jambo-table">
-32
View File
@@ -232,42 +232,10 @@ Route::group(['middleware' => ['isVerified']], function () {
Route::post('btc_payment_callback', [BtcPaymentController::class, 'callback'])->name('btc_payment_callback');
Route::get('queue', [QueueController::class, 'index'])->name('queue');
Route::post('queue', [QueueController::class, 'index'])->name('queue');
Route::get('nzbgetqueuedata', [QueueController::class, 'nzbget']);
Route::post('nzbgetqueuedata', [QueueController::class, 'nzbget']);
Route::get('sabqueuedata', [QueueController::class, 'sabnzbd']);
Route::post('sabqueuedata', [QueueController::class, 'sabnzbd']);
Route::get('sendtosab', [SendReleaseController::class, 'sabNzbd']);
Route::post('sendtosab', [SendReleaseController::class, 'sabNzbd']);
Route::get('sendtonzbget', [SendReleaseController::class, 'nzbGet']);
Route::post('sendtonzbget', [SendReleaseController::class, 'nzbGet']);
Route::get('sendtoqueue', [SendReleaseController::class, 'queue']);
Route::post('sendtoqueue', [SendReleaseController::class, 'queue']);
Route::get('sendtocouch', [SendReleaseController::class, 'couchPotato']);
Route::post('sendtocouch', [SendReleaseController::class, 'couchPotato']);
Route::get('series/{id?}', [SeriesController::class, 'index'])->name('series');
Route::post('series/{id?}', [SeriesController::class, 'index'])->name('series');
Route::get('nzbvortex', [QueueController::class, 'nzbvortex']);
Route::post('nzbvortex', [QueueController::class, 'nzbvortex']);
Route::get('ajax_profile', [AjaxController::class, 'profile']);
Route::post('ajax_profile', [AjaxController::class, 'profile']);