Compare commits
5 Commits
543e4c52e4
...
7bdc01bdb9
Author | SHA1 | Date | |
---|---|---|---|
7bdc01bdb9 | |||
b13403cf59 | |||
5777ff09b6 | |||
954547ea84 | |||
db1e155c8d |
2
get.php
2
get.php
@ -77,7 +77,7 @@ function uupGetFiles(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($usePack) {
|
if($usePack) {
|
||||||
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
|
$genPack = uupApiGetPacks($updateId);
|
||||||
if(empty($genPack)) return array('error' => 'UNSUPPORTED_COMBINATION');
|
if(empty($genPack)) return array('error' => 'UNSUPPORTED_COMBINATION');
|
||||||
|
|
||||||
if(!isset($genPack[$usePack])) {
|
if(!isset($genPack[$usePack])) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Copyright 2022 UUP dump API authors
|
Copyright 2023 UUP dump API authors
|
||||||
|
|
||||||
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.
|
||||||
@ -17,60 +17,35 @@ limitations under the License.
|
|||||||
|
|
||||||
require_once dirname(__FILE__).'/shared/main.php';
|
require_once dirname(__FILE__).'/shared/main.php';
|
||||||
require_once dirname(__FILE__).'/shared/packs.php';
|
require_once dirname(__FILE__).'/shared/packs.php';
|
||||||
require_once dirname(__FILE__).'/updateinfo.php';
|
|
||||||
|
|
||||||
function uupListEditions($lang = 'en-us', $updateId = 0) {
|
function uupListEditions($lang = 'en-us', $updateId = 0) {
|
||||||
if($updateId) {
|
|
||||||
$info = uupUpdateInfo($updateId, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$lang) {
|
if(!$lang) {
|
||||||
return array('error' => 'UNSUPPORTED_LANG');
|
return array('error' => 'UNSUPPORTED_LANG');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($info['info'])) $info = $info['info'];
|
$lang = strtolower($lang);
|
||||||
|
$genPack = uupApiGetPacks($updateId);
|
||||||
|
$fancyEditionNames = uupGetInfoTexts()['fancyEditionNames'];
|
||||||
|
|
||||||
if(isset($info['build'])) {
|
if(!isset($genPack[$lang])) {
|
||||||
$build = explode('.', $info['build']);
|
return array('error' => 'UNSUPPORTED_LANG');
|
||||||
$build = $build[0];
|
|
||||||
} else {
|
|
||||||
$build = 15063;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($info['arch'])) {
|
$editionList = [];
|
||||||
$info['arch'] = null;
|
$editionListFancy = [];
|
||||||
}
|
|
||||||
|
|
||||||
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
|
|
||||||
$fancyTexts = uupGetInfoTexts();
|
|
||||||
$fancyEditionNames = $fancyTexts['fancyEditionNames'];
|
|
||||||
|
|
||||||
if($lang) {
|
|
||||||
$lang = strtolower($lang);
|
|
||||||
if(!isset($genPack[$lang])) {
|
|
||||||
return array('error' => 'UNSUPPORTED_LANG');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$editionList = array();
|
|
||||||
$editionListFancy = array();
|
|
||||||
foreach(array_keys($genPack[$lang]) as $edition) {
|
foreach(array_keys($genPack[$lang]) as $edition) {
|
||||||
if($edition == 'LXP') continue;
|
if(in_array($edition, ['LXP', 'FOD'])) continue;
|
||||||
if($edition == 'FOD') continue;
|
|
||||||
|
|
||||||
if(isset($fancyEditionNames[$edition])) {
|
$fancyName = isset($fancyEditionNames[$edition]) ? $fancyEditionNames[$edition] : $edition;
|
||||||
$fancyName = $fancyEditionNames[$edition];
|
|
||||||
} else {
|
|
||||||
$fancyName = $edition;
|
|
||||||
}
|
|
||||||
|
|
||||||
$editionList[] = $edition;
|
$editionList[] = $edition;
|
||||||
$editionListFancy[$edition] = $fancyName;
|
$editionListFancy[$edition] = $fancyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
'apiVersion' => uupApiVersion(),
|
'apiVersion' => uupApiVersion(),
|
||||||
'editionList' => $editionList,
|
'editionList' => $editionList,
|
||||||
'editionFancyNames' => $editionListFancy,
|
'editionFancyNames' => $editionListFancy,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Copyright 2022 UUP dump API authors
|
Copyright 2023 UUP dump API authors
|
||||||
|
|
||||||
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.
|
||||||
@ -19,63 +19,45 @@ require_once dirname(__FILE__).'/shared/main.php';
|
|||||||
require_once dirname(__FILE__).'/shared/packs.php';
|
require_once dirname(__FILE__).'/shared/packs.php';
|
||||||
require_once dirname(__FILE__).'/updateinfo.php';
|
require_once dirname(__FILE__).'/updateinfo.php';
|
||||||
|
|
||||||
function uupListLangs($updateId = 0) {
|
function uupListLangsInternal($updateId) {
|
||||||
if($updateId) {
|
$genPack = uupApiGetPacks($updateId);
|
||||||
$info = uupUpdateInfo($updateId, false, true);
|
$fancyLangNames = uupGetInfoTexts()['fancyLangNames'];
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($info['info'])) {
|
$langList = [];
|
||||||
$info = $info['info'];
|
$langListFancy = [];
|
||||||
unset($info['files']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($info['build'])) {
|
|
||||||
$build = explode('.', $info['build']);
|
|
||||||
$build = $build[0];
|
|
||||||
} else {
|
|
||||||
$build = 15063;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!isset($info['arch'])) {
|
|
||||||
$info['arch'] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
|
|
||||||
$fancyTexts = uupGetInfoTexts();
|
|
||||||
$fancyLangNames = $fancyTexts['fancyLangNames'];
|
|
||||||
|
|
||||||
$langList = array();
|
|
||||||
$langListFancy = array();
|
|
||||||
foreach($genPack as $key => $val) {
|
foreach($genPack as $key => $val) {
|
||||||
if(!count(array_diff(array_keys($val), array('LXP')))) {
|
if(!count(array_diff(array_keys($val), ['LXP', 'FOD']))) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(!count(array_diff(array_keys($val), array('FOD')))) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($fancyLangNames[$key])) {
|
$fancyName = isset($fancyLangNames[$key]) ? $fancyLangNames[$key] : $key;
|
||||||
$fancyName = $fancyLangNames[$key];
|
|
||||||
} else {
|
|
||||||
$fancyName = $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
$langList[] = $key;
|
$langList[] = $key;
|
||||||
$langListFancy[$key] = $fancyName;
|
$langListFancy[$key] = $fancyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($info)) {
|
return [
|
||||||
return array(
|
'langList' => $langList,
|
||||||
'apiVersion' => uupApiVersion(),
|
'langFancyNames' => $langListFancy,
|
||||||
'langList' => $langList,
|
];
|
||||||
'langFancyNames' => $langListFancy,
|
}
|
||||||
'updateInfo' => $info
|
|
||||||
);
|
function uupListLangs($updateId = 0, $returnInfo = true) {
|
||||||
} else {
|
if($returnInfo) {
|
||||||
return array(
|
$info = uupUpdateInfo($updateId, ignoreFiles: true);
|
||||||
'apiVersion' => uupApiVersion(),
|
$info = isset($info['info']) ? $info['info'] : false;
|
||||||
'langList' => $langList,
|
}
|
||||||
'langFancyNames' => $langListFancy
|
|
||||||
);
|
$langList = uupListLangsInternal($updateId);
|
||||||
}
|
|
||||||
|
$response = [
|
||||||
|
'apiVersion' => uupApiVersion(),
|
||||||
|
'langList' => $langList['langList'],
|
||||||
|
'langFancyNames' => $langList['langFancyNames'],
|
||||||
|
];
|
||||||
|
|
||||||
|
if($returnInfo) $response['updateInfo'] = $info;
|
||||||
|
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function uupApiVersion() {
|
function uupApiVersion() {
|
||||||
return '1.41.1';
|
return '1.42.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/auths.php';
|
require_once dirname(__FILE__).'/auths.php';
|
||||||
|
@ -202,7 +202,7 @@ function uupGetInfoTexts() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
|
function uupApiGetPacks($updateId) {
|
||||||
if(empty($updateId)) return [];
|
if(empty($updateId)) return [];
|
||||||
if(!file_exists('packs/'.$updateId.'.json.gz')) return [];
|
if(!file_exists('packs/'.$updateId.'.json.gz')) return [];
|
||||||
|
|
||||||
@ -212,3 +212,7 @@ function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
|
|||||||
$genPack = json_decode($genPack, 1);
|
$genPack = json_decode($genPack, 1);
|
||||||
return $genPack;
|
return $genPack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
|
||||||
|
return uupApiGetPacks($updateId);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user