forked from uup-dump/api
Deprecate old packs system and replace it with internal generated packs
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright 2018 UUP dump API authors
|
||||
Copyright 2019 UUP dump API authors
|
||||
|
||||
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,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
function uupApiVersion() {
|
||||
return '1.17.3';
|
||||
return '1.18.0';
|
||||
}
|
||||
|
||||
require_once dirname(__FILE__).'/auths.php';
|
||||
|
192
shared/packs.php
192
shared/packs.php
@ -15,7 +15,9 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
function uupGetPacks($build = 15063) {
|
||||
require_once dirname(__FILE__).'/../listid.php';
|
||||
|
||||
function uupGetInfoTexts() {
|
||||
$fancyLangNames = array(
|
||||
'ar-sa' => 'Arabic (Saudi Arabia)',
|
||||
'bg-bg' => 'Bulgarian',
|
||||
@ -61,7 +63,7 @@ function uupGetPacks($build = 15063) {
|
||||
$fancyEditionNames = array(
|
||||
'CLOUD' => 'Windows 10 S',
|
||||
'CLOUDN' => 'Windows 10 S N',
|
||||
'CLOUDE' => 'Windows 10 CloudE',
|
||||
'CLOUDE' => 'Windows 10 Lean',
|
||||
'CORE' => 'Windows 10 Home',
|
||||
'CORECOUNTRYSPECIFIC' => 'Windows 10 Home China',
|
||||
'COREN' => 'Windows 10 Home N',
|
||||
@ -165,33 +167,171 @@ function uupGetPacks($build = 15063) {
|
||||
'STARTERN',
|
||||
);
|
||||
|
||||
if($build < 17063) {
|
||||
require dirname(__FILE__).'/packs/legacy.php';
|
||||
} elseif ($build >= 17661) {
|
||||
require dirname(__FILE__).'/packs/17661.php';
|
||||
} elseif ($build >= 17655) {
|
||||
require dirname(__FILE__).'/packs/17655.php';
|
||||
} elseif ($build >= 17650) {
|
||||
require dirname(__FILE__).'/packs/17650.php';
|
||||
} elseif ($build >= 17634) {
|
||||
require dirname(__FILE__).'/packs/17634.php';
|
||||
} elseif ($build >= 17623) {
|
||||
require dirname(__FILE__).'/packs/17623.php';
|
||||
} elseif ($build >= 17093) {
|
||||
require dirname(__FILE__).'/packs/17093.php';
|
||||
} elseif ($build >= 17063) {
|
||||
require dirname(__FILE__).'/packs/17063.php';
|
||||
}
|
||||
|
||||
return array(
|
||||
'packs' => $packs,
|
||||
'packsForLangs' => $packsForLangs,
|
||||
'editionPacks' => $editionPacks,
|
||||
'fancyEditionNames' => $fancyEditionNames,
|
||||
'fancyLangNames' => $fancyLangNames,
|
||||
'allEditions' => $allEditions,
|
||||
'skipNeutral' => $skipNeutral,
|
||||
'skipLangPack' => $skipLangPack,
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
|
||||
$internalPacks = dirname(__FILE__).'/packs';
|
||||
|
||||
if(!file_exists($internalPacks.'/metadata.json')) {
|
||||
if(!uupCreateInternalPacksMetadata($internalPacks)) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($updateId)) {
|
||||
if(file_exists('packs/'.$updateId.'.json.gz')) {
|
||||
$genPack = @gzdecode(@file_get_contents('packs/'.$updateId.'.json.gz'));
|
||||
if(empty($genPack)) return array();
|
||||
|
||||
$genPack = json_decode($genPack, 1);
|
||||
return $genPack;
|
||||
}
|
||||
}
|
||||
|
||||
$metadata = @file_get_contents($internalPacks.'/metadata.json');
|
||||
if(empty($metadata)) {
|
||||
return array();
|
||||
} else {
|
||||
$metadata = json_decode($metadata, 1);
|
||||
}
|
||||
|
||||
$hashDetermined = 0;
|
||||
$useAllHashesForBuild = 0;
|
||||
|
||||
if($updateId) {
|
||||
if(isset($metadata['knownIds'][$updateId])) {
|
||||
$hash = $metadata['knownIds'][$updateId];
|
||||
$hashDetermined = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$hashDetermined) {
|
||||
foreach($metadata['knownBuilds'] as $buildNum => $val) {
|
||||
if($build < $buildNum) continue;
|
||||
$useBuild = $buildNum;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!isset($useBuild)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if(!$arch && !isset($metadata['knownBuilds'][$useBuild][$arch])) {
|
||||
$genPack = array();
|
||||
foreach($metadata['knownBuilds'][$useBuild] as $hash) {
|
||||
$temp = @gzdecode(@file_get_contents($internalPacks.'/'.$hash.'.json.gz'));
|
||||
if(!empty($temp)) {
|
||||
$temp = json_decode($temp, 1);
|
||||
$genPack = array_merge_recursive($genPack, $temp);
|
||||
unset($temp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$hash = $metadata['knownBuilds'][$useBuild][$arch];
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($genPack)) {
|
||||
$genPack = @gzdecode(@file_get_contents($internalPacks.'/'.$hash.'.json.gz'));
|
||||
if(!empty($genPack)) {
|
||||
$genPack = json_decode($genPack, 1);
|
||||
} else {
|
||||
$genPack = array();
|
||||
}
|
||||
}
|
||||
|
||||
return $genPack;
|
||||
}
|
||||
|
||||
//Function to regenerate internal packs. Should not be used when not needed.
|
||||
function uupCreateInternalPacksMetadata($internalPacks) {
|
||||
$metadataCreationAllowed = 0;
|
||||
if(!$metadataCreationAllowed) return false;
|
||||
|
||||
$builds = uupListIds();
|
||||
if(isset($ids['error'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$builds = $builds['builds'];
|
||||
|
||||
if(!file_exists('packs')) return false;
|
||||
|
||||
if(!file_exists($internalPacks)) {
|
||||
if(!mkdir($internalPacks)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
rmdir($internalPacks);
|
||||
mkdir($internalPacks);
|
||||
}
|
||||
|
||||
$files = scandir('packs');
|
||||
$files = preg_grep('/\.json.gz$/', $files);
|
||||
|
||||
$packs = array();
|
||||
foreach($builds as $build) {
|
||||
$uuid = $build['uuid'];
|
||||
$file = $uuid.'.json.gz';
|
||||
|
||||
if(!file_exists('packs/'.$file)) continue;
|
||||
|
||||
$genPack = @gzdecode(@file_get_contents('packs/'.$file));
|
||||
$hash = hash('sha1', $genPack);
|
||||
|
||||
if(!file_exists($internalPacks.'/'.$hash.'.json.gz')) {
|
||||
if(!copy('packs/'.$file, $internalPacks.'/'.$hash.'.json.gz')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$packs['knownIds'][$uuid] = $hash;
|
||||
|
||||
$buildNum = explode('.', $build['build']);
|
||||
$buildNum = $buildNum[0];
|
||||
|
||||
$packs['knownBuilds'][$buildNum][$build['arch']] = $hash;
|
||||
}
|
||||
|
||||
file_put_contents($internalPacks.'/metadata.json', json_encode($packs)."\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
//Emulation of legacy packs. Do not use in new scripts due to extremely slow process.
|
||||
function uupGetPacks($build = 15063) {
|
||||
$returnArray = uupGetInfoTexts();
|
||||
$genPack = uupGetGenPacks($build);
|
||||
|
||||
foreach($genPack as $lang => $editions) {
|
||||
$packsForLangs[$lang] = array_keys($editions);
|
||||
$packsForLangs[$lang][] = $lang;
|
||||
|
||||
foreach(array_keys($editions) as $edition) {
|
||||
foreach($editions[$edition] as $name) {
|
||||
$newName = preg_replace('/^cabs_|^metadataesd_|~31bf3856ad364e35/i', '', $name);
|
||||
$newName = preg_replace('/~~\.|~\./', '.', $newName);
|
||||
$newName = preg_replace('/~/', '-', $newName);
|
||||
$newName = strtolower($newName);
|
||||
$packs[$lang][$edition][] = $newName;
|
||||
}
|
||||
|
||||
$editionPacks[$edition] = $edition;
|
||||
$packs[$edition][$edition] = array();
|
||||
$skipNeutral[$edition] = 1;
|
||||
$skipLangPack[$edition] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$returnArray['packs'] = $packs;
|
||||
$returnArray['packsForLangs'] = $packsForLangs;
|
||||
$returnArray['editionPacks'] = $editionPacks;
|
||||
$returnArray['skipNeutral'] = $skipNeutral;
|
||||
$returnArray['skipLangPack'] = $skipLangPack;
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
BIN
shared/packs/1013af5eb771adf320b8834e305fcef90099cfd6.json.gz
Normal file
BIN
shared/packs/1013af5eb771adf320b8834e305fcef90099cfd6.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/1894fbf96c63b2d1bcc5a5509d0090fd943a8259.json.gz
Normal file
BIN
shared/packs/1894fbf96c63b2d1bcc5a5509d0090fd943a8259.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/1c8cfc71d7554c6743c38440ad3e5867e862f92d.json.gz
Normal file
BIN
shared/packs/1c8cfc71d7554c6743c38440ad3e5867e862f92d.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/1e8bc5333c92aa95421036b17b198679d2c88cf8.json.gz
Normal file
BIN
shared/packs/1e8bc5333c92aa95421036b17b198679d2c88cf8.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/22c7a1aca5e636221131e8ffbd95539d1be9076c.json.gz
Normal file
BIN
shared/packs/22c7a1aca5e636221131e8ffbd95539d1be9076c.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/2301e6f354ec0ef46adea9515efc656be62eef91.json.gz
Normal file
BIN
shared/packs/2301e6f354ec0ef46adea9515efc656be62eef91.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/2606035ed49bb6958a64b0c2f126cc5c2bd2f419.json.gz
Normal file
BIN
shared/packs/2606035ed49bb6958a64b0c2f126cc5c2bd2f419.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/281b00c4172534b9ce227206cdbfb582e91de781.json.gz
Normal file
BIN
shared/packs/281b00c4172534b9ce227206cdbfb582e91de781.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/329e33732b38a3456df0631792c635c521f60341.json.gz
Normal file
BIN
shared/packs/329e33732b38a3456df0631792c635c521f60341.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/36eaef4337fb96921641e3c7ad02f499a48e21ce.json.gz
Normal file
BIN
shared/packs/36eaef4337fb96921641e3c7ad02f499a48e21ce.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/414e4e971be210fb8b8c2c6132a65345bdfcbe13.json.gz
Normal file
BIN
shared/packs/414e4e971be210fb8b8c2c6132a65345bdfcbe13.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/45bae1ed29d95402343904764c812d2a2cf072f5.json.gz
Normal file
BIN
shared/packs/45bae1ed29d95402343904764c812d2a2cf072f5.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/4669e78cbbe2368da4a93649b1fe5d1da740448c.json.gz
Normal file
BIN
shared/packs/4669e78cbbe2368da4a93649b1fe5d1da740448c.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/487d7e8509f9e1f788706f9f8cf1ac0067941f51.json.gz
Normal file
BIN
shared/packs/487d7e8509f9e1f788706f9f8cf1ac0067941f51.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/4c4ed421587e0e3cbb3c983d32da9a252749d0b1.json.gz
Normal file
BIN
shared/packs/4c4ed421587e0e3cbb3c983d32da9a252749d0b1.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/4c82382299f3de54811c4361feaec9cb6dd289e5.json.gz
Normal file
BIN
shared/packs/4c82382299f3de54811c4361feaec9cb6dd289e5.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/5078d98787aeaf0f5cabaee9a04a737db8053a55.json.gz
Normal file
BIN
shared/packs/5078d98787aeaf0f5cabaee9a04a737db8053a55.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/5411cdcddfa53fc9cddfc2b4524409652e42ed8e.json.gz
Normal file
BIN
shared/packs/5411cdcddfa53fc9cddfc2b4524409652e42ed8e.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/554a82fd55becdef5a05cd1cdaf890f3d19811c9.json.gz
Normal file
BIN
shared/packs/554a82fd55becdef5a05cd1cdaf890f3d19811c9.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/6ef254a8640fddbe4667a05998b9ef697c4b9677.json.gz
Normal file
BIN
shared/packs/6ef254a8640fddbe4667a05998b9ef697c4b9677.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/70f857b669d2c4875fccc9bdeaa4324b7b03a9d8.json.gz
Normal file
BIN
shared/packs/70f857b669d2c4875fccc9bdeaa4324b7b03a9d8.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/71e5d7ba16acbc283438dc910a65c7ffff32b59d.json.gz
Normal file
BIN
shared/packs/71e5d7ba16acbc283438dc910a65c7ffff32b59d.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/7a93eee07bdd8b747563b8d8eac58af40d3c60a8.json.gz
Normal file
BIN
shared/packs/7a93eee07bdd8b747563b8d8eac58af40d3c60a8.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/7cadb2dcddcabfe113acc2628c01d248af5191db.json.gz
Normal file
BIN
shared/packs/7cadb2dcddcabfe113acc2628c01d248af5191db.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/7da7778df0327ca620b35deb1802db3091c37281.json.gz
Normal file
BIN
shared/packs/7da7778df0327ca620b35deb1802db3091c37281.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/8236e50d00b40cfa7fdca5ec3b60ec603e852a26.json.gz
Normal file
BIN
shared/packs/8236e50d00b40cfa7fdca5ec3b60ec603e852a26.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/8b4cfea710a659952c0820040afa12902e808472.json.gz
Normal file
BIN
shared/packs/8b4cfea710a659952c0820040afa12902e808472.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/8fe1efe00fd526287f03b27e1a9255a615cd8d9e.json.gz
Normal file
BIN
shared/packs/8fe1efe00fd526287f03b27e1a9255a615cd8d9e.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/94b32965851bb675b8765ceae4432bfe5986f137.json.gz
Normal file
BIN
shared/packs/94b32965851bb675b8765ceae4432bfe5986f137.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/9577e14b7d886c7b384d04b9f8bca6af7ef3e616.json.gz
Normal file
BIN
shared/packs/9577e14b7d886c7b384d04b9f8bca6af7ef3e616.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/aba27664fd4185b6e5332444629f56e0d40a913e.json.gz
Normal file
BIN
shared/packs/aba27664fd4185b6e5332444629f56e0d40a913e.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/acb1facaf6b1a1da2a3bfe0409402c22120b74a6.json.gz
Normal file
BIN
shared/packs/acb1facaf6b1a1da2a3bfe0409402c22120b74a6.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/b6a922fe2e7617fdc51a0edbe04ef6e777d8de97.json.gz
Normal file
BIN
shared/packs/b6a922fe2e7617fdc51a0edbe04ef6e777d8de97.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/baa7a98bc2ab32e72431724a102f0572501e6d45.json.gz
Normal file
BIN
shared/packs/baa7a98bc2ab32e72431724a102f0572501e6d45.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/c054f6ca03936fe8c9a24118309d1576b6cb9cc5.json.gz
Normal file
BIN
shared/packs/c054f6ca03936fe8c9a24118309d1576b6cb9cc5.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/c771f8b4535ea6e73c5d7406252d7306c0e11b56.json.gz
Normal file
BIN
shared/packs/c771f8b4535ea6e73c5d7406252d7306c0e11b56.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/c9b0e97f010deeb941d5f8680d8737404481c313.json.gz
Normal file
BIN
shared/packs/c9b0e97f010deeb941d5f8680d8737404481c313.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/cd0d4cc32346750408f7d4f5e78ec9a6e5b79a0d.json.gz
Normal file
BIN
shared/packs/cd0d4cc32346750408f7d4f5e78ec9a6e5b79a0d.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/ce78d1195e98375737eb4782e02f105eefc23ed2.json.gz
Normal file
BIN
shared/packs/ce78d1195e98375737eb4782e02f105eefc23ed2.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/d1c299c8d9f2b9880ec5c4558eeed7dae0f9c446.json.gz
Normal file
BIN
shared/packs/d1c299c8d9f2b9880ec5c4558eeed7dae0f9c446.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/e7318f499408c0d760c38ee43082c99bbd85dd77.json.gz
Normal file
BIN
shared/packs/e7318f499408c0d760c38ee43082c99bbd85dd77.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/e73a6ef69938d3fafe504e65f5c34e2e0c70cce5.json.gz
Normal file
BIN
shared/packs/e73a6ef69938d3fafe504e65f5c34e2e0c70cce5.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/ea56b32b2a8a0ff3f1e2ca1031ef91d11a46abac.json.gz
Normal file
BIN
shared/packs/ea56b32b2a8a0ff3f1e2ca1031ef91d11a46abac.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/f51f1e283d936febf92473aa78798eb6ce98a0b5.json.gz
Normal file
BIN
shared/packs/f51f1e283d936febf92473aa78798eb6ce98a0b5.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/f549c78f06373a8153f0774bdd547682fb0f5750.json.gz
Normal file
BIN
shared/packs/f549c78f06373a8153f0774bdd547682fb0f5750.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/f71509579ac540dc9a42e9d058362d81d619db11.json.gz
Normal file
BIN
shared/packs/f71509579ac540dc9a42e9d058362d81d619db11.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/f74878eb0d2dd018e5b94a55dc12d8724f0774ff.json.gz
Normal file
BIN
shared/packs/f74878eb0d2dd018e5b94a55dc12d8724f0774ff.json.gz
Normal file
Binary file not shown.
BIN
shared/packs/fcb830f7c6fa857f6b2569fcec83d465b5914d1a.json.gz
Normal file
BIN
shared/packs/fcb830f7c6fa857f6b2569fcec83d465b5914d1a.json.gz
Normal file
Binary file not shown.
1
shared/packs/metadata.json
Normal file
1
shared/packs/metadata.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user