6 Commits

Author SHA1 Message Date
22e344bdf2 Simplify latest build number retrieval function 2026-01-14 13:58:53 +01:00
0774988365 Fix Windows CPC OS names.
Doubled build number in the name is Microsoft's fault and I can't be bothered to make a hackfix that.
2026-01-14 13:51:59 +01:00
e7fddd4e43 Fix branch selection when the branch is not specified 2026-01-14 13:17:44 +01:00
2231d65edb Add automatic minor number detection 2026-01-14 13:03:27 +01:00
0da5532141 Add Windows 11 to update names 2025-11-21 18:23:07 +01:00
6b5a6885f8 Update for new naming scheme 2025-11-18 12:52:37 +01:00
2 changed files with 40 additions and 13 deletions

View File

@@ -34,20 +34,31 @@ function uupApiPrivateParseFlags($str) {
} }
function uupApiPrivateGetLatestBuild() { function uupApiPrivateGetLatestBuild() {
$builds = array('22000.1');
$ids = uupListIds(); $ids = uupListIds();
if(isset($ids['error'])) {
$ids['builds'] = array(); if(!isset($ids['builds']) || empty($ids['builds'])) {
return '26100.1';
} }
if(empty($ids['builds'])) { return $ids['builds'][0]['build'];
$build = $builds[0];
} else {
$build = $ids['builds'][0]['build'];
} }
return $build; function uupApiPrivateGetLatestPatch($build) {
$ids = uupListIds();
if(!isset($ids['builds']) || empty($ids['builds'])) {
return 0;
}
foreach($ids['builds'] as $val) {
$valBuild = explode('.', $val['build']);
if($valBuild[0] == $build && isset($valBuild[1])) {
return intval($valBuild[1]);
}
}
return 0;
} }
function uupApiPrivateIsAcceptableBranch($branch) { function uupApiPrivateIsAcceptableBranch($branch) {
@@ -83,7 +94,7 @@ function uupApiPrivateNormalizeFetchParams($params) {
'arch' => 'amd64', 'arch' => 'amd64',
'ring' => 'WIF', 'ring' => 'WIF',
'flight' => 'Active', 'flight' => 'Active',
'branch' => 'ge_release', 'branch' => 'auto',
'build' => 'latest', 'build' => 'latest',
'minor' => 0, 'minor' => 0,
'sku' => 48, 'sku' => 48,
@@ -154,9 +165,15 @@ function uupFetchUpd2($params, $cacheRequests = 0) {
} }
$build = explode('.', $build); $build = explode('.', $build);
if(isset($build[1])) $minor = intval($build[1]); if(isset($build[1])) $minor = $build[1];
$build = intval($build[0]); $build = intval($build[0]);
if($minor == 'latest') {
$minor = uupApiPrivateGetLatestPatch($build);
} else {
$minor = intval($minor);
}
if(!($arch == 'amd64' || $arch == 'x86' || $arch == 'arm64' || $arch == 'arm' || $arch == 'all')) { if(!($arch == 'amd64' || $arch == 'x86' || $arch == 'arm64' || $arch == 'arm' || $arch == 'all')) {
return array('error' => 'UNKNOWN_ARCH'); return array('error' => 'UNKNOWN_ARCH');
} }
@@ -329,8 +346,9 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$updateTitle = preg_replace('/ for .{3,5}-based/i', ' for', $updateTitle); $updateTitle = preg_replace('/ for .{3,5}-based/i', ' for', $updateTitle);
$isCumulativeUpdate = 0; $isCumulativeUpdate = 0;
if(preg_match('/\d{4}-\d{2}.+Update|Cumulative Update|Microsoft Edge|Windows Feature Experience Pack|Cumulative security Hotpatch/i', $updateTitle)) { if(preg_match('/\d{4}-\d{2}.+Update|(Cumulative|Security|Preview) Update|Microsoft Edge|Windows Feature Experience Pack|Cumulative security Hotpatch/i', $updateTitle)) {
$isCumulativeUpdate = 1; $isCumulativeUpdate = 1;
if($isNet) { if($isNet) {
$updateTitle = preg_replace("/3.5 and 4.8.1 |3.5 and 4.8 | for $foundArch| for x64| \(KB.*?\)/i", '', $updateTitle); $updateTitle = preg_replace("/3.5 and 4.8.1 |3.5 and 4.8 | for $foundArch| for x64| \(KB.*?\)/i", '', $updateTitle);
} else { } else {
@@ -345,6 +363,11 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$updateTitle = str_replace('Windows 11', 'Windows Server', $updateTitle); $updateTitle = str_replace('Windows 11', 'Windows Server', $updateTitle);
} }
if(preg_match('/Windows 1\d|Server|Azure Stack HCI|Windows CPC OS/i', $updateTitle) !== 1) {
$osName = $foundType != 'server' ? 'Windows 11' : 'Microsoft server operating system';
$updateTitle = str_replace('Update', "Update for $osName", $updateTitle);
}
if($sku == 406) if($sku == 406)
$updateTitle = str_replace('Microsoft server operating system', 'Azure Stack HCI', $updateTitle); $updateTitle = str_replace('Microsoft server operating system', 'Azure Stack HCI', $updateTitle);
@@ -354,7 +377,7 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
if($foundType == 'hololens' || $foundType == 'wcosdevice0') if($foundType == 'hololens' || $foundType == 'wcosdevice0')
$updateTitle = $updateTitle.' - '.$type; $updateTitle = $updateTitle.' - '.$type;
if(!preg_match("/$foundBuild/i", $updateTitle)) if(!str_contains($updateTitle, $foundBuild))
$updateTitle = $updateTitle.' ('.$foundBuild.')'; $updateTitle = $updateTitle.' ('.$foundBuild.')';
preg_match('/UpdateID=".*?"/', $updateInfo, $updateId); preg_match('/UpdateID=".*?"/', $updateInfo, $updateId);

View File

@@ -320,6 +320,10 @@ function branchFromBuild($build) {
$branch = 'ge_release'; $branch = 'ge_release';
break; break;
case 28000:
$branch = 'br_release';
break;
default: default:
$branch = 'rs_prerelease'; $branch = 'rs_prerelease';
break; break;