Save cache only after successful retrieval, better token generation
This commit is contained in:
		
							
								
								
									
										24
									
								
								get.php
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								get.php
									
									
									
									
									
								
							| @@ -273,19 +273,6 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests) { | ||||
|         $postData = composeFileGetRequest($updateId, uupDevice(), $info, $rev); | ||||
|         $out = sendWuPostRequest('https://fe3cr.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', $postData); | ||||
|         consoleLogger('Information has been successfully fetched.'); | ||||
|  | ||||
|         if($cacheRequests == 1) { | ||||
|             $cache = array( | ||||
|                 'expires' => time()+90, | ||||
|                 'content' => $out, | ||||
|                 'fetchTime' => $fetchTime, | ||||
|             ); | ||||
|  | ||||
|             if(!file_exists('cache')) mkdir('cache'); | ||||
|             @file_put_contents('cache/'.$cacheHash.'.json.gz', gzencode(json_encode($cache)."\n")); | ||||
|  | ||||
|             unset($cache); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     consoleLogger('Parsing information...'); | ||||
| @@ -365,6 +352,17 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests) { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     if($cacheRequests == 1) { | ||||
|         $cache = array( | ||||
|             'expires' => time()+90, | ||||
|             'content' => $out, | ||||
|             'fetchTime' => $fetchTime, | ||||
|         ); | ||||
|  | ||||
|         if(!file_exists('cache')) mkdir('cache'); | ||||
|         @file_put_contents('cache/'.$cacheHash.'.json.gz', gzencode(json_encode($cache)."\n")); | ||||
|     } | ||||
|  | ||||
|     return $files; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| /* | ||||
| Copyright 2018 UUP dump API authors | ||||
| Copyright 2019 whatever127 | ||||
|  | ||||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| you may not use this file except in compliance with the License. | ||||
| @@ -16,7 +16,11 @@ limitations under the License. | ||||
| */ | ||||
|  | ||||
| function uupDevice() { | ||||
|     $tValue = base64_encode(hex2bin(randStr(60))); | ||||
|     $tValueHeader = '13003002c377040014d5bcac7a66de0d50beddf9bba16c87edb9e019898000'; | ||||
|     $tValueRandom = randStr(1054); | ||||
|     $tValueEnd = 'b401'; | ||||
|  | ||||
|     $tValue = base64_encode(hex2bin($tValueHeader.$tValueRandom.$tValueEnd)); | ||||
|     $data = 't='.$tValue.'&p='; | ||||
|     return base64_encode(chunk_split($data, 1, "\0")); | ||||
| } | ||||
|   | ||||
| @@ -16,7 +16,7 @@ limitations under the License. | ||||
| */ | ||||
|  | ||||
| function uupApiVersion() { | ||||
|     return '1.25.1'; | ||||
|     return '1.26.0'; | ||||
| } | ||||
|  | ||||
| require_once dirname(__FILE__).'/auths.php'; | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								shared/packs/0fdb20000af32d84a1f7b12fe056c54f0b8c6c77.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/0fdb20000af32d84a1f7b12fe056c54f0b8c6c77.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/115da76cb9527e16fb30152c349f3fb2652dae1e.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/115da76cb9527e16fb30152c349f3fb2652dae1e.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/1e9cbc2bc1b80304838def973aa8246013bad742.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/1e9cbc2bc1b80304838def973aa8246013bad742.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/40334aa97d3ab195e20e6316f7ded55cc16f9101.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/40334aa97d3ab195e20e6316f7ded55cc16f9101.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/50149bf43d48bb17cbc89aadc3d33ef38fc3096c.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/50149bf43d48bb17cbc89aadc3d33ef38fc3096c.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/54d0b968f26a3c4b3105b265891f0a066e0b3dba.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/54d0b968f26a3c4b3105b265891f0a066e0b3dba.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/5708a637f155aa4a93be7b125054d81fb2d3dc16.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/5708a637f155aa4a93be7b125054d81fb2d3dc16.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/577fbb1d9a645d011e093f86eebbf6b922ba1d61.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/577fbb1d9a645d011e093f86eebbf6b922ba1d61.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/866257cc9e85c82c0228be8367667674a90ae7bd.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/866257cc9e85c82c0228be8367667674a90ae7bd.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/9745d38fcc6d72b60e298e73960229076f0ea285.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/9745d38fcc6d72b60e298e73960229076f0ea285.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/aa13844ea66c3ffa966e5cd01f044f2ad23829db.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/aa13844ea66c3ffa966e5cd01f044f2ad23829db.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/cb0e1019fe2b7db0595799751d17570ee761014c.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/cb0e1019fe2b7db0595799751d17570ee761014c.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/dc0952319efe3a561aca0c49b3c34dd32292262f.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/dc0952319efe3a561aca0c49b3c34dd32292262f.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/e79aabb86feb2dfe857341b5d8dfa6486f5e41f2.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/e79aabb86feb2dfe857341b5d8dfa6486f5e41f2.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/ee8548b4a59f8a8ed03d93d61632226e7032d070.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/ee8548b4a59f8a8ed03d93d61632226e7032d070.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user