causefx 8 anni fa
parent
commit
974aa53b45
2 ha cambiato i file con 38 aggiunte e 0 eliminazioni
  1. 5 0
      api/config/default.php
  2. 33 0
      api/functions/homepage-connect-functions.php

+ 5 - 0
api/config/default.php

@@ -36,8 +36,13 @@ return array(
     'nzbgetURL' => '',
     'nzbgetUsername' => '',
     'nzbgetPassword' => '',
+	'transmissionURL' => '',
+    'transmissionUsername' => '',
+    'transmissionPassword' => '',
     'homepageSabnzbdEnabled' => false,
     'homepageSabnzbdAuth' => '1',
+    'homepageTransmissionEnabled' => false,
+    'homepageTransmissionAuth' => '1',
     'homepageNzbgetEnabled' => false,
     'homepageNzbgetAuth' => '1',
     'homepagePlexEnabled' => false,

+ 33 - 0
api/functions/homepage-connect-functions.php

@@ -541,3 +541,36 @@ function nzbgetConnect() {
         return $api;
     }
 }
+function transmissionConnect() {
+    if($GLOBALS['homepageTransmissionEnabled'] && !empty($GLOBALS['transmissionURL']) && qualifyRequest($GLOBALS['homepageTransmissionAuth'])){
+        $url = $GLOBALS['transmissionURL'];
+        // Parse URL
+        //local address?
+    	if(substr($url, 0,1) == "/"){
+    		if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
+    			$protocol = "https://";
+    		} else {
+    			$protocol = "http://";
+    		}
+    		$url = $protocol.getServer().$url;
+    	}
+    	// Get Digest
+    	$digest = parse_url($url);
+    	// http/https
+    	if (!isset($digest['scheme'])) {
+    		if (isset($digest['port']) && in_array($digest['port'], array(80,8080,8096,32400,7878,8989,8182,8081,6789))) {
+    			$scheme = 'http';
+    		} else {
+    			$scheme = 'https';
+    		}
+    	} else {
+    		$scheme = $digest['scheme'];
+    	}
+    	// Host
+    	$host = (isset($digest['host'])?$digest['host']:'');
+    	// Port
+    	$port = (isset($digest['port'])?':'.$digest['port']:'');
+    	// Path
+    	$path = (isset($digest['path']) && $digest['path'] !== '/'?$digest['path']:'');
+    }
+}