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