forked from uup-dump/api
Save cache only after successful retrieval, better token generation
This commit is contained in:
@@ -273,19 +273,6 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests) {
|
|||||||
$postData = composeFileGetRequest($updateId, uupDevice(), $info, $rev);
|
$postData = composeFileGetRequest($updateId, uupDevice(), $info, $rev);
|
||||||
$out = sendWuPostRequest('https://fe3cr.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', $postData);
|
$out = sendWuPostRequest('https://fe3cr.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', $postData);
|
||||||
consoleLogger('Information has been successfully fetched.');
|
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...');
|
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;
|
return $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Copyright 2018 UUP dump API authors
|
Copyright 2019 whatever127
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -16,7 +16,11 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function uupDevice() {
|
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=';
|
$data = 't='.$tValue.'&p=';
|
||||||
return base64_encode(chunk_split($data, 1, "\0"));
|
return base64_encode(chunk_split($data, 1, "\0"));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function uupApiVersion() {
|
function uupApiVersion() {
|
||||||
return '1.25.1';
|
return '1.26.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/auths.php';
|
require_once dirname(__FILE__).'/auths.php';
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user