Disable some safety features in the development mode
This commit is contained in:
		
							
								
								
									
										12
									
								
								fetchupd.php
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								fetchupd.php
									
									
									
									
									
								
							| @@ -50,8 +50,12 @@ function uupApiPrivateGetLatestBuild() { | |||||||
|     return $build; |     return $build; | ||||||
| } | } | ||||||
|  |  | ||||||
| function uupApiPrivateGetAcceptableBranches() { | function uupApiPrivateIsAcceptableBranch($branch) { | ||||||
|     return [ |     if(!uupApiConfigIsTrue('production_mode')) { | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     $branches = [ | ||||||
|         'auto', |         'auto', | ||||||
|         'rs2_release', |         'rs2_release', | ||||||
|         'rs3_release', |         'rs3_release', | ||||||
| @@ -68,6 +72,8 @@ function uupApiPrivateGetAcceptableBranches() { | |||||||
|         'ge_release', |         'ge_release', | ||||||
|         'rs_prerelease', |         'rs_prerelease', | ||||||
|     ]; |     ]; | ||||||
|  |  | ||||||
|  |     return in_array($branch, $branches); | ||||||
| } | } | ||||||
|  |  | ||||||
| function uupApiPrivateNormalizeFetchParams($params) { | function uupApiPrivateNormalizeFetchParams($params) { | ||||||
| @@ -173,7 +179,7 @@ function uupFetchUpd2($params, $cacheRequests = 0) { | |||||||
|         return array('error' => 'ILLEGAL_MINOR'); |         return array('error' => 'ILLEGAL_MINOR'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if(!in_array($branch, uupApiPrivateGetAcceptableBranches())) |     if(!uupApiPrivateIsAcceptableBranch($branch)) | ||||||
|         $branch = 'auto'; |         $branch = 'auto'; | ||||||
|  |  | ||||||
|     if($ring == 'DEV') $ring = 'WIF'; |     if($ring == 'DEV') $ring = 'WIF'; | ||||||
|   | |||||||
| @@ -35,6 +35,10 @@ class UupDumpCache { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public function get() { |     public function get() { | ||||||
|  |         if(!uupApiConfigIsTrue('production_mode')) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         $cacheFile = $this->cacheFile; |         $cacheFile = $this->cacheFile; | ||||||
|  |  | ||||||
|         if(!file_exists($cacheFile)) { |         if(!file_exists($cacheFile)) { | ||||||
| @@ -58,6 +62,10 @@ class UupDumpCache { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public function put($content, $validity) { |     public function put($content, $validity) { | ||||||
|  |         if(!uupApiConfigIsTrue('production_mode')) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         $cacheFile = $this->cacheFile; |         $cacheFile = $this->cacheFile; | ||||||
|         $expires = $validity ? time() + $validity : false; |         $expires = $validity ? time() + $validity : false; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ limitations under the License. | |||||||
| */ | */ | ||||||
|  |  | ||||||
| function uupApiVersion() { | function uupApiVersion() { | ||||||
|     return '1.48.0'; |     return '1.49.0-dev'; | ||||||
| } | } | ||||||
|  |  | ||||||
| require_once dirname(__FILE__).'/auths.php'; | require_once dirname(__FILE__).'/auths.php'; | ||||||
|   | |||||||
| @@ -64,8 +64,12 @@ function sendWuPostRequestInternal($url, $postData, $saveCookie = true) { | |||||||
|     curl_setopt($req, CURLOPT_RETURNTRANSFER, 1); |     curl_setopt($req, CURLOPT_RETURNTRANSFER, 1); | ||||||
|     curl_setopt($req, CURLOPT_ENCODING, ''); |     curl_setopt($req, CURLOPT_ENCODING, ''); | ||||||
|     curl_setopt($req, CURLOPT_POSTFIELDS, $postData); |     curl_setopt($req, CURLOPT_POSTFIELDS, $postData); | ||||||
|  |  | ||||||
|  |     if(uupApiConfigIsTrue('production_mode')) {  | ||||||
|         curl_setopt($req, CURLOPT_CONNECTTIMEOUT, 5); |         curl_setopt($req, CURLOPT_CONNECTTIMEOUT, 5); | ||||||
|         curl_setopt($req, CURLOPT_TIMEOUT, 15); |         curl_setopt($req, CURLOPT_TIMEOUT, 15); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     curl_setopt($req, CURLOPT_SSL_VERIFYPEER, 0); |     curl_setopt($req, CURLOPT_SSL_VERIFYPEER, 0); | ||||||
|     curl_setopt($req, CURLOPT_HTTPHEADER, array( |     curl_setopt($req, CURLOPT_HTTPHEADER, array( | ||||||
|         'User-Agent: Windows-Update-Agent/10.0.10011.16384 Client-Protocol/2.50', |         'User-Agent: Windows-Update-Agent/10.0.10011.16384 Client-Protocol/2.50', | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user