Browse Source

test rTorrent password and username

causefx 7 years ago
parent
commit
e22dc9fd80
2 changed files with 4 additions and 4 deletions
  1. 4 2
      api/functions/homepage-connect-functions.php
  2. 0 2
      js/functions.js

+ 4 - 2
api/functions/homepage-connect-functions.php

@@ -789,7 +789,8 @@ function rTorrentConnect()
 		try {
 		try {
 			$torrents = array();
 			$torrents = array();
 			$digest = qualifyURL($GLOBALS['rTorrentURL'], true);
 			$digest = qualifyURL($GLOBALS['rTorrentURL'], true);
-			$url = $digest['scheme'] . '://' . $digest['host'] . $digest['port'] . $digest['path'] . '/RPC2';
+			$passwordInclude = ($GLOBALS['rTorrentUsername'] != '' && $GLOBALS['rTorrentPassword'] != '') ? $GLOBALS['rTorrentUsername'] . ':' . decrypt($GLOBALS['rTorrentPassword']) . "@" : '';
+			$url = $digest['scheme'] . '://' . $passwordInclude . $digest['host'] . $digest['port'] . $digest['path'] . '/RPC2';
 			$options = (localURL($url)) ? array('verify' => false) : array();
 			$options = (localURL($url)) ? array('verify' => false) : array();
 			$data = xmlrpc_encode_request("d.multicall2", array(
 			$data = xmlrpc_encode_request("d.multicall2", array(
 				"",
 				"",
@@ -2139,7 +2140,8 @@ function testAPIConnection($array)
 			if (!empty($GLOBALS['rTorrentURL'])) {
 			if (!empty($GLOBALS['rTorrentURL'])) {
 				try {
 				try {
 					$digest = qualifyURL($GLOBALS['rTorrentURL'], true);
 					$digest = qualifyURL($GLOBALS['rTorrentURL'], true);
-					$url = $digest['scheme'] . '://' . $digest['host'] . $digest['port'] . $digest['path'] . '/RPC2';
+					$passwordInclude = ($GLOBALS['rTorrentUsername'] != '' && $GLOBALS['rTorrentPassword'] != '') ? $GLOBALS['rTorrentUsername'] . ':' . decrypt($GLOBALS['rTorrentPassword']) . "@" : '';
+					$url = $digest['scheme'] . '://' . $passwordInclude . $digest['host'] . $digest['port'] . $digest['path'] . '/RPC2';
 					$options = (localURL($url)) ? array('verify' => false) : array();
 					$options = (localURL($url)) ? array('verify' => false) : array();
 					$data = xmlrpc_encode_request("system.listMethods", null);
 					$data = xmlrpc_encode_request("system.listMethods", null);
 					$response = Requests::post($url, array(), $data, $options);
 					$response = Requests::post($url, array(), $data, $options);

+ 0 - 2
js/functions.js

@@ -4174,8 +4174,6 @@ function buildDownloaderItem(array, source, type='none'){
                     if(array == 0){
                     if(array == 0){
                         return '<tr><td class="max-texts" lang="en">Nothing in queue</td></tr>';
                         return '<tr><td class="max-texts" lang="en">Nothing in queue</td></tr>';
                     }
                     }
-                    console.log(array);
-
                     $.each(array, function(i,v) {
                     $.each(array, function(i,v) {
                         var percent = Math.floor((v.downloaded / v.size) * 100);
                         var percent = Math.floor((v.downloaded / v.size) * 100);
                         var size = v.size != -1 ? humanFileSize(v.size,false) : "?";
                         var size = v.size != -1 ? humanFileSize(v.size,false) : "?";