diff --git a/Blacklight/CouchPotato.php b/Blacklight/CouchPotato.php deleted file mode 100755 index 44cd62bd4..000000000 --- a/Blacklight/CouchPotato.php +++ /dev/null @@ -1,85 +0,0 @@ -. - * - * @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(); - } -} diff --git a/Blacklight/NZBGet.php b/Blacklight/NZBGet.php deleted file mode 100755 index e9561a8a9..000000000 --- a/Blacklight/NZBGet.php +++ /dev/null @@ -1,425 +0,0 @@ -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 = - ' - - append - - - '.$relData['searchname'].' - - - '.$relData['category_name'].' - - - 0 - - - >False - - - - '. - base64_encode($string). - ' - - - - '; - - 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 = - ' - - appendurl - - - '.$reldata['searchname'].'.nzb'.' - - - '.$reldata['category_name'].' - - - 0 - - - >False - - - - '. - $this->serverurl. - 'getnzb?id='. - $guid. - '%26r%3D'. - $this->api_token - . - ' - - - - '; - - 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 = - ' - - pausedownload2 - - - 1 - - - '; - 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 = - ' - - resumedownload2 - - - 1 - - - '; - 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 = - ' - - editqueue - - - GroupPause - - - 0 - - - "" - - - - - '.$id.' - - - - - '; - 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 = - ' - - editqueue - - - GroupResume - - - 0 - - - "" - - - - - '.$id.' - - - - - '; - 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 = - ' - - editqueue - - - GroupDelete - - - 0 - - - "" - - - - - '.$id.' - - - - - '; - 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 ". - * - * @param int $limit The speed to limit it to. - * @return void - */ - public function rate($limit) - { - $header = - ' - - rate - - - '.$limit.' - - - '; - 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('/(?Phttps?):\/\/(?P.+?)(:(?P\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; - } -} diff --git a/Blacklight/NZBVortex.php b/Blacklight/NZBVortex.php deleted file mode 100755 index 08a9c0077..000000000 --- a/Blacklight/NZBVortex.php +++ /dev/null @@ -1,337 +0,0 @@ -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; - } - } -} diff --git a/Blacklight/SABnzbd.php b/Blacklight/SABnzbd.php deleted file mode 100755 index 20e001c28..000000000 --- a/Blacklight/SABnzbd.php +++ /dev/null @@ -1,326 +0,0 @@ -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\/)?(?P[a-z]+)?(?P\/)?$/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); - } -} diff --git a/README.md b/README.md index 88474374c..dcf6532e6 100755 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/Http/Controllers/Admin/AdminSiteController.php b/app/Http/Controllers/Admin/AdminSiteController.php index 80d137899..cdbcf1fc6 100644 --- a/app/Http/Controllers/Admin/AdminSiteController.php +++ b/app/Http/Controllers/Admin/AdminSiteController.php @@ -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]); diff --git a/app/Http/Controllers/BasePageController.php b/app/Http/Controllers/BasePageController.php index 82a6f9836..ea398d318 100644 --- a/app/Http/Controllers/BasePageController.php +++ b/app/Http/Controllers/BasePageController.php @@ -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'); } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index ef205e549..d943a6164 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -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']); diff --git a/app/Http/Controllers/QueueController.php b/app/Http/Controllers/QueueController.php deleted file mode 100644 index 92921f65f..000000000 --- a/app/Http/Controllers/QueueController.php +++ /dev/null @@ -1,327 +0,0 @@ -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 .= - "
-
Avg Speed:
".human_filesize($status['AverageDownloadRate'], 2)."/s
-
Speed:
".human_filesize($status['DownloadRate'], 2)."/s
-
Limit:
".human_filesize($status['DownloadLimit'], 2)."/s
-
Queue Left(no pars):
".human_filesize($status['RemainingSizeLo'], 2)."
-
Free Space:
".human_filesize($status['FreeDiskSpaceMB'] * 1024000, 2)."
-
Status:
".($status['Download2Paused'] === 1 ? 'Paused' : 'Downloading').'
-
'; - } - - $count = 1; - $output .= - " - - - - - - - - - - - - - - "; - - foreach ($data as $item) { - $output .= - ''. - "'. - "'. - "'. - "'. - "'. - "'. - "". - "". - "". - ''; - $count++; - } - $output .= - ' -
#NameSizeLeft(+pars)DoneStatusDeletePause allResume all
".$count.'".$item['NZBName'].'".$item['FileSizeMB'].' MB".$item['RemainingSizeMB'].' MB".($item['FileSizeMB'] === 0 ? 0 : round(100 - ($item['RemainingSizeMB'] / $item['FileSizeMB']) * 100)).'%".($item['ActiveDownloads'] > 0 ? 'Downloading' : 'Paused').'DeletePauseResume
'; - } else { - $output .= "

The queue is currently empty.

"; - } - } else { - $output .= "

Error retreiving queue.

"; - } - - 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 .= - "
-
Speed:
".$obj->{'speed'}."B/s
-
Queued:
".round($obj->{'mbleft'}, 2).'MB / '.round($obj->{'mb'}, 2).'MB'."
-
Status:
".ucwords(strtolower($obj->{'state'}))."
-
Free (temp):
".round($obj->{'diskspace1'})."GB
-
Free Space:
".round($obj->{'diskspace2'})."GB
-
Stats:
".preg_replace('/\s+\|\s+| /', ',', $obj->{'loadavg'}).'
-
'; - - if (\count($queue) > 0) { - $output .= - " - - - - - - - - - - - - - - "; - - foreach ($queue->{'slots'} as $item) { - if (strpos($item->{'filename'}, 'fetch NZB') === false) { - $output .= - ''. - "'. - "'. - "'. - "'. - "'. - "'. - "". - "". - "". - ''; - $count++; - } - } - $output .= - ' -
#NameSizeLeftDoneTime LeftDeletePause allResume all
".$count.'".$item->{'filename'}.'".round($item->{'mb'}, 2).' MB".round($item->{'mbleft'}, 2).' MB".($item->{'mb'} === 0 ? 0 : round(100 - ($item->{'mbleft'} / $item->{'mb'}) * 100)).'%".$item->{'timeleft'}.'DeletePauseResume
'; - } else { - $output .= "

The queue is currently empty.

"; - } - } else { - $output .= "

Error retrieving queue.

"; - } - - 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(); - } -} diff --git a/app/Http/Controllers/SendReleaseController.php b/app/Http/Controllers/SendReleaseController.php deleted file mode 100644 index 24030bd3c..000000000 --- a/app/Http/Controllers/SendReleaseController.php +++ /dev/null @@ -1,114 +0,0 @@ -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')); - } - } -} diff --git a/app/Models/User.php b/app/Models/User.php index ba8759627..50bfe1bb1 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -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); } diff --git a/database/migrations/2014_01_16_195548_create_users_table.php b/database/migrations/2014_01_16_195548_create_users_table.php index b6b693752..0d1e578b0 100644 --- a/database/migrations/2014_01_16_195548_create_users_table.php +++ b/database/migrations/2014_01_16_195548_create_users_table.php @@ -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(); diff --git a/resources/assets/js/functions.js b/resources/assets/js/functions.js index 1d9b65233..63930241c 100755 --- a/resources/assets/js/functions.js +++ b/resources/assets/js/functions.js @@ -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( - '' + v.fileName + ' (' + vortexStates[v.state] + ')
' - ); - }); - }) - .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() { diff --git a/resources/views/themes/Gentele/browse.tpl b/resources/views/themes/Gentele/browse.tpl index 7f0a7ce24..76462a5d3 100755 --- a/resources/views/themes/Gentele/browse.tpl +++ b/resources/views/themes/Gentele/browse.tpl @@ -188,22 +188,6 @@ data-bs-toggle="tooltip" data-bs-placement="top" title data-original-title="Send to my download basket"> - {if isset($sabintegrated) && $sabintegrated !=""} - - - - - {/if} - {if $weHasVortex} - - {/if} {/foreach} diff --git a/resources/views/themes/Gentele/movies.tpl b/resources/views/themes/Gentele/movies.tpl index 55e7d9fd3..48eae429a 100755 --- a/resources/views/themes/Gentele/movies.tpl +++ b/resources/views/themes/Gentele/movies.tpl @@ -171,24 +171,6 @@ data-bs-toggle="tooltip" data-bs-placement="top" title data-original-title="Send to my download basket"> - {if isset($sabintegrated) && $sabintegrated !=""} - - {/if} - {if !empty($cpurl) && !empty($cpapi)} - - - - {/if} {if !empty($mfailed[$m@index])} @@ -315,24 +297,6 @@ data-bs-toggle="tooltip" data-bs-placement="top" title data-original-title="Send to my download basket"> - {if isset($sabintegrated) && $sabintegrated !=""} - - {/if} - {if !empty($cpurl) && !empty($cpapi)} - - - - {/if} {if !empty($mfailed[$m@index])} diff --git a/resources/views/themes/Gentele/nzbvortex-ajax.tpl b/resources/views/themes/Gentele/nzbvortex-ajax.tpl deleted file mode 100755 index d4bbfab4d..000000000 --- a/resources/views/themes/Gentele/nzbvortex-ajax.tpl +++ /dev/null @@ -1,59 +0,0 @@ -{if $overview['nzbs']|@count gt 0} - {foreach from=$overview['nzbs'] item=nzb} -
- -
- {$nzb['uiTitle']} -
-
- {if $nzb['isPaused'] == 1} - - {else} - - {/if} -
-
-
-
-
- {$nzb['state']}{if $nzb['statusText'] neq ''} ({$nzb['statusText']|lower}){/if}: {$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} -
-
- {if $nzb['isPaused'] == 1} - - {else} - - {/if} - -
-
- - - - - -
-
-
-
-
- {/foreach} -{else} -
- Nothing in queue, go ahead and add something! -
-{/if} diff --git a/resources/views/themes/Gentele/nzbvortex.tpl b/resources/views/themes/Gentele/nzbvortex.tpl deleted file mode 100755 index c19edfda5..000000000 --- a/resources/views/themes/Gentele/nzbvortex.tpl +++ /dev/null @@ -1,40 +0,0 @@ -
-

NZBVortex > Queue

- -
-{if $weHasVortex} - -
-
-{literal} - -{/literal} -{else} -

Make sure you've entered API key and server URL under profile settings.

-{/if} diff --git a/resources/views/themes/Gentele/profile.tpl b/resources/views/themes/Gentele/profile.tpl index c0c127617..01dad2082 100755 --- a/resources/views/themes/Gentele/profile.tpl +++ b/resources/views/themes/Gentele/profile.tpl @@ -119,22 +119,6 @@ Downloads Total {$user.grabs} - {if $site->integrationtype == 2 && !$publicview} - - SABnzbd Integration: - - Url: {if $saburl == ''}N/A{else}{$saburl}{/if} -
- Key: {if $sabapikey == ''}N/A{else}{$sabapikey}{/if} -
- Type: {if $sabapikeytype == ''}N/A{else}{$sabapikeytype}{/if} -
- Priority: {if $sabpriority == ''}N/A{else}{$sabpriority}{/if} -
- Storage: {if $sabsetting == ''}N/A{else}{$sabsetting}{/if} - - - {/if} {if (isset($isadmin) && $isadmin === "true") || !$publicview} API/RSS Key diff --git a/resources/views/themes/Gentele/profileedit.tpl b/resources/views/themes/Gentele/profileedit.tpl index 014a261c2..e32935539 100755 --- a/resources/views/themes/Gentele/profileedit.tpl +++ b/resources/views/themes/Gentele/profileedit.tpl @@ -229,136 +229,6 @@ {/if} -
-
- 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. -
-
- {if {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} != 1} - - - - - - - - - - -
Queue - type - (NZBGet or SABnzbd) -
Select type - {html_options id="queuetypeids" name='queuetypeids' values=$queuetypeids output=$queuetypes selected=$user.queuetype} - 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. -
- {/if} - {if $user.queuetype == 1 && {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} == 2} - - - - - - - - - - - - - - - - - - - - - - - - - - -
- SABnzbd -
URL
API Key
API Key Type - {html_radios id="sabapikeytype" name='sabapikeytype' values=$sabapikeytype_ids output=$sabapikeytype_names selected=$sabapikeytype_selected separator='
'} -
- 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. -
-
Priority Level - {html_options id="sabpriority" class="form-inline" name='sabpriority' values=$sabpriority_ids output=$sabpriority_names selected=$sabpriority_selected} -
Set the priority level for NZBs that - are added to your queue -
-
Setting Storage - {html_radios id="sabsetting" name='sabsetting' values=$sabsetting_ids output=$sabsetting_names selected=$sabsetting_selected separator='  '}{if $sabsetting_selected == 2}  [ - Clear Cookies - ]{/if} -
Where to store the SAB setting.
• - Cookie will store the setting in your - browsers coookies and will only work when using your - current browser.
Site will store - the setting in your user account enabling it to work - no matter where you are logged in from.
Please Note: - You should only store your full SAB api key with - sites you trust. -
-
- {/if} - {if $user.queuetype == 2 && ({{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} == 0 || {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} == 2)} - - - - - - - - - - - - - - -
- NZBget -
URL
Username / Password -
- - / - -
-
- {/if} -
-
{{Form::submit('Save', ['class' => 'btn btn-success'])}} {{Form::close()}} diff --git a/resources/views/themes/Gentele/search.tpl b/resources/views/themes/Gentele/search.tpl index 0a1fdf5a7..a421ed55b 100755 --- a/resources/views/themes/Gentele/search.tpl +++ b/resources/views/themes/Gentele/search.tpl @@ -367,21 +367,6 @@ data-bs-toggle="tooltip" data-bs-placement="top" data-original-title="Send to my download basket"> - {if isset($sabintegrated) && $sabintegrated !=""} - - - - - {/if} - {if $weHasVortex} - - {/if} {/foreach} diff --git a/resources/views/themes/Gentele/viewanime.tpl b/resources/views/themes/Gentele/viewanime.tpl index aee7d2db9..f233d03c5 100755 --- a/resources/views/themes/Gentele/viewanime.tpl +++ b/resources/views/themes/Gentele/viewanime.tpl @@ -154,23 +154,6 @@ data-original-title="Send to my Download Basket"> - {if isset($sabintegrated) && $sabintegrated !=""} - - - - - {/if} - {if $weHasVortex} - - {/if} {/foreach} diff --git a/resources/views/themes/Gentele/viewmoviefull.tpl b/resources/views/themes/Gentele/viewmoviefull.tpl index 3fd102617..43f3b0431 100755 --- a/resources/views/themes/Gentele/viewmoviefull.tpl +++ b/resources/views/themes/Gentele/viewmoviefull.tpl @@ -169,23 +169,6 @@ data-bs-toggle="tooltip" data-bs-placement="top" title data-original-title="Send to my download basket"> - {if isset($sabintegrated) && $sabintegrated !=""} - - - - - {/if} - {if $weHasVortex} - - {/if} {/foreach} diff --git a/resources/views/themes/Gentele/viewnzb.tpl b/resources/views/themes/Gentele/viewnzb.tpl index ab9e9a072..c0c1a2928 100755 --- a/resources/views/themes/Gentele/viewnzb.tpl +++ b/resources/views/themes/Gentele/viewnzb.tpl @@ -249,26 +249,6 @@ id="guid{$release.guid}"> Send to Queue {/if} - {if !empty($movie.imdbid)} - {if !empty($cpurl) && !empty($cpapi)} - - {/if} - {/if} - {if $weHasVortex} - - {/if}
diff --git a/resources/views/themes/Gentele/viewqueue.tpl b/resources/views/themes/Gentele/viewqueue.tpl deleted file mode 100755 index c24fcfd7a..000000000 --- a/resources/views/themes/Gentele/viewqueue.tpl +++ /dev/null @@ -1,70 +0,0 @@ -
-
-

Download > Queue

- -
- {if $error == ''} - {if {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} > 0 || $user.queuetype == 2} -

- The following queue is pulled from - {$serverURL|escape:"htmlall"}. -
- {if {{App\Models\Settings::settingValue('apps.sabnzbplus.integrationtype')}} == 2 || $user.queuetype == 2}Edit your queue settings in - your profile - .{/if} -

-
- {if $user.queuetype == 2} - {literal} - - {/literal} - {else} - {literal} - - {/literal} - {/if} - - {else} -

The {$queueType} queue has been disabled by the administrator.

- {/if} - {else} -

{$error}

- {/if} -
diff --git a/resources/views/themes/Gentele/viewseries.tpl b/resources/views/themes/Gentele/viewseries.tpl index d4af37995..0056df243 100755 --- a/resources/views/themes/Gentele/viewseries.tpl +++ b/resources/views/themes/Gentele/viewseries.tpl @@ -227,24 +227,6 @@ data-bs-toggle="tooltip" data-bs-placement="top" title data-original-title="Send to my download basket"> - {if isset($sabintegrated) && $sabintegrated !=""} - - - - - {/if} - {if $weHasVortex} - - {/if} {/foreach} diff --git a/resources/views/themes/Gentele/viewxxxfull.tpl b/resources/views/themes/Gentele/viewxxxfull.tpl index 2f7504eb8..c4c1914d7 100755 --- a/resources/views/themes/Gentele/viewxxxfull.tpl +++ b/resources/views/themes/Gentele/viewxxxfull.tpl @@ -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"> - {if isset($sabintegrated) && $sabintegrated !=""} - - - - - {/if} - {if $weHasVortex} - - {/if} {/foreach} diff --git a/resources/views/themes/admin/site-edit.tpl b/resources/views/themes/admin/site-edit.tpl index c743001f6..7e8975789 100644 --- a/resources/views/themes/admin/site-edit.tpl +++ b/resources/views/themes/admin/site-edit.tpl @@ -271,23 +271,6 @@ - -
- Download Queue Integration Settings - - - - - - -
: - {html_radios id="sabintegrationtype" name='sabintegrationtype' values=$sabintegrationtype_ids output=$sabintegrationtype_names selected=$site->integrationtype separator='
'} -
Whether to allow integration with a SAB/NZBGet install or not
-
- -
- -
Usenet Settings diff --git a/routes/web.php b/routes/web.php index 4724eefee..af4762909 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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']);