Merge pull request #27 from abbodi1406/master

Add support for Canary
This commit is contained in:
abbodi1406 2023-03-14 18:29:56 +03:00 committed by GitHub
commit c7512dd40d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 12 deletions

View File

@ -39,14 +39,18 @@ function uupFetchUpd(
$flight = 'Active'; $flight = 'Active';
if($build == 'latest' || (!$build)) { if($build == 'latest' || (!$build)) {
$builds = array('17134.1'); $builds = array('22000.1');
$ids = uupListIds(); $ids = uupListIds();
if(isset($ids['error'])) { if(isset($ids['error'])) {
$ids['builds'] = array(); $ids['builds'] = array();
} }
$build = $ids['builds'][0]['build']; if(empty($ids['builds'])) {
$build = $builds[0];
} else {
$build = $ids['builds'][0]['build'];
}
unset($builds, $ids); unset($builds, $ids);
} }
@ -59,7 +63,7 @@ function uupFetchUpd(
return array('error' => 'UNKNOWN_ARCH'); return array('error' => 'UNKNOWN_ARCH');
} }
if(!($ring == 'DEV' || $ring == 'BETA' || $ring == 'RELEASEPREVIEW' || $ring == 'WIF' || $ring == 'WIS' || $ring == 'RP' || $ring == 'RETAIL' || $ring == 'MSIT')) { if(!($ring == 'CANARY' || $ring == 'DEV' || $ring == 'BETA' || $ring == 'RELEASEPREVIEW' || $ring == 'WIF' || $ring == 'WIS' || $ring == 'RP' || $ring == 'RETAIL' || $ring == 'MSIT')) {
return array('error' => 'UNKNOWN_RING'); return array('error' => 'UNKNOWN_RING');
} }

28
get.php
View File

@ -48,7 +48,7 @@ function uupGetFiles(
} }
$edition = is_array($desiredEdition) ? implode('_', $desiredEdition) : $desiredEdition; $edition = is_array($desiredEdition) ? implode('_', $desiredEdition) : $desiredEdition;
$res = "api-get-${updateId}_${usePack}_${edition}_${requestType}"; $res = "api-get-{$updateId}_{$usePack}_{$edition}_{$requestType}";
$cache = new UupDumpCache($res); $cache = new UupDumpCache($res);
$fromCache = $cache->get(); $fromCache = $cache->get();
if($fromCache !== false) return $fromCache; if($fromCache !== false) return $fromCache;
@ -175,16 +175,34 @@ function uupGetFiles(
if(isset($filesInfoList[$val])) unset($filesInfoList[$val]); if(isset($filesInfoList[$val])) unset($filesInfoList[$val]);
} }
$baseless = preg_grep('/^baseless_|Windows(10|11)\.0-KB.*-EXPRESS|SSU-.*-EXPRESS/i', array_keys($filesInfoList)); $baseless = preg_grep('/^baseless_/i', array_keys($filesInfoList));
foreach($baseless as $val) { foreach($baseless as $val) {
if(isset($filesInfoList[$val])) unset($filesInfoList[$val]); if(isset($filesInfoList[$val])) unset($filesInfoList[$val]);
} }
$expresscab = preg_grep('/Windows(10|11)\.0-KB.*-EXPRESS|SSU-.*-EXPRESS/i', array_keys($filesInfoList));
$expresspsf = array();
foreach($expresscab as $val) {
$name = preg_replace('/-EXPRESS.cab$/i', '', $val);
$expresspsf[] = $name;
if(isset($filesInfoList[$val])) unset($filesInfoList[$val]);
}
unset($index, $name, $expresscab);
foreach($expresspsf as $val) {
if(isset($filesInfoList[$val.'.cab'])) {
if(isset($filesInfoList[$val.'.psf'])) unset($filesInfoList[$val.'.psf']);
}
}
unset($expresspsf);
$psf = array_keys($filesInfoList); $psf = array_keys($filesInfoList);
$psf = preg_grep('/\.psf$/i', $psf); $psf = preg_grep('/\.psf$/i', $psf);
$psfk = preg_grep('/Windows(10|11)\.0-KB.*/i', $psf); $psfk = preg_grep('/Windows(10|11)\.0-KB.*/i', $psf);
$psfk = preg_grep('/.*-EXPRESS/i', $psfk, PREG_GREP_INVERT); $psfk = preg_grep('/.*-EXPRESS/i', $psfk, PREG_GREP_INVERT);
if($build < 17763) $psfk = preg_grep('/Windows(10|11)\.0-KB.*_\d\.psf$/i', $psfk, PREG_GREP_INVERT);
foreach($psfk as $key => $val) { foreach($psfk as $key => $val) {
if(isset($psf[$key])) unset($psf[$key]); if(isset($psf[$key])) unset($psf[$key]);
} }
@ -227,7 +245,7 @@ function uupGetFiles(
switch($fileListSource) { switch($fileListSource) {
case 'UPDATEONLY': case 'UPDATEONLY':
$skipPackBuild = 1; $skipPackBuild = 1;
$removeFiles = preg_grep('/Windows(10|11)\.0-KB.*-EXPRESS|Windows(10|11)\.0-KB.*-baseless|SSU-.*-.{3,5}-EXPRESS/i', $filesInfoKeys); $removeFiles = preg_grep('/Windows(10|11)\.0-KB.*-baseless/i', $filesInfoKeys);
foreach($removeFiles as $val) { foreach($removeFiles as $val) {
if(isset($filesInfoList[$val])) unset($filesInfoList[$val]); if(isset($filesInfoList[$val])) unset($filesInfoList[$val]);
@ -273,7 +291,7 @@ function uupGetFiles(
unset($removeMSUs); unset($removeMSUs);
$filesInfoKeys = array_keys($filesInfoList); $filesInfoKeys = array_keys($filesInfoList);
$temp = preg_grep('/Windows(10|11)\.0-KB.*-EXPRESS|Windows(10|11)\.0-KB.*-baseless|SSU-.*-.{3,5}-EXPRESS/i', $filesInfoKeys, PREG_GREP_INVERT); $temp = preg_grep('/Windows(10|11)\.0-KB.*-baseless/i', $filesInfoKeys, PREG_GREP_INVERT);
if($appEdition) { if($appEdition) {
$temp = preg_grep('/.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp); $temp = preg_grep('/.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp);
} else if($build > 21380) { } else if($build > 21380) {
@ -361,7 +379,7 @@ function uupGetFiles(
} }
function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests, $type) { function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests, $type) {
$res = "api-get-online-${updateId}_rev.$rev"; $res = "api-get-online-{$updateId}_rev.$rev";
$cache = new UupDumpCache($res); $cache = new UupDumpCache($res);
$fromCache = $cache->get(); $fromCache = $cache->get();
$cached = ($fromCache !== false); $cached = ($fromCache !== false);

View File

@ -166,7 +166,7 @@ function uupListIds($search = null, $sortByDate = 0) {
$cache->put($builds, 60); $cache->put($builds, 60);
} }
if($search != null) { if(count($builds) && $search != null) {
if(!preg_match('/^regex:/', $search)) { if(!preg_match('/^regex:/', $search)) {
$searchSafe = preg_quote($search, '/'); $searchSafe = preg_quote($search, '/');

View File

@ -10,7 +10,7 @@ Parameters:
- **Supported values:** `amd64`, `x86`, `arm64`, `all` - **Supported values:** `amd64`, `x86`, `arm64`, `all`
- `ring` - Channel to use when fetching information (Previously called Ring) - `ring` - Channel to use when fetching information (Previously called Ring)
- **Supported values:** `Dev`, `Beta`, `ReleasePreview`, `Retail` - **Supported values:** `Canary`, `Dev`, `Beta`, `ReleasePreview`, `Retail`
- **Supported Ring values :** `WIF`, `WIS`, `RP` - **Supported Ring values :** `WIF`, `WIS`, `RP`
- `flight` - Content type to use when fetching information (Previously called Flight) - `flight` - Content type to use when fetching information (Previously called Flight)

View File

@ -16,7 +16,7 @@ limitations under the License.
*/ */
function uupApiVersion() { function uupApiVersion() {
return '1.39.3'; return '1.40.1';
} }
require_once dirname(__FILE__).'/auths.php'; require_once dirname(__FILE__).'/auths.php';

View File

@ -94,6 +94,11 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
$fltRing = 'Internal'; $fltRing = 'Internal';
} }
if($ring == 'CANARY') {
$fltBranch = 'CanaryChannel';
$ring = 'WIF';
}
$bldnum = explode('.', $build); $bldnum = explode('.', $build);
$bldnum = $bldnum[2]; $bldnum = $bldnum[2];
@ -107,14 +112,20 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
$attrib = array( $attrib = array(
'App=WU_OS', 'App=WU_OS',
'AppVer='.$build, 'AppVer='.$build,
'AttrDataVer=177', 'AttrDataVer=208',
'AllowInPlaceUpgrade=1', 'AllowInPlaceUpgrade=1',
'AllowUpgradesWithUnsupportedTPMOrCPU=1', 'AllowUpgradesWithUnsupportedTPMOrCPU=1',
'BlockFeatureUpdates='.$blockUpgrades, 'BlockFeatureUpdates='.$blockUpgrades,
'BranchReadinessLevel=CB', 'BranchReadinessLevel=CB',
'CurrentBranch='.$branch, 'CurrentBranch='.$branch,
'DataExpDateEpoch_CU23H2='.(time()+82800),
'DataExpDateEpoch_CU23H2Setup='.(time()+82800),
'DataExpDateEpoch_NI22H2='.(time()+82800),
'DataExpDateEpoch_NI22H2Setup='.(time()+82800),
'DataExpDateEpoch_CO21H2='.(time()+82800), 'DataExpDateEpoch_CO21H2='.(time()+82800),
'DataExpDateEpoch_CO21H2Setup='.(time()+82800), 'DataExpDateEpoch_CO21H2Setup='.(time()+82800),
'DataExpDateEpoch_23H2='.(time()+82800),
'DataExpDateEpoch_22H2='.(time()+82800),
'DataExpDateEpoch_21H2='.(time()+82800), 'DataExpDateEpoch_21H2='.(time()+82800),
'DataExpDateEpoch_21H1='.(time()+82800), 'DataExpDateEpoch_21H1='.(time()+82800),
'DataExpDateEpoch_20H1='.(time()+82800), 'DataExpDateEpoch_20H1='.(time()+82800),
@ -128,8 +139,14 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
//'FlightContent='.$fltContent, //'FlightContent='.$fltContent,
'FlightRing='.$fltRing, 'FlightRing='.$fltRing,
'Free=gt64', 'Free=gt64',
'GStatus_CU23H2=2',
'GStatus_CU23H2Setup=2',
'GStatus_NI22H2=2',
'GStatus_NI22H2Setup=2',
'GStatus_CO21H2=2', 'GStatus_CO21H2=2',
'GStatus_CO21H2Setup=2', 'GStatus_CO21H2Setup=2',
'GStatus_23H2=2',
'GStatus_22H2=2',
'GStatus_21H2=2', 'GStatus_21H2=2',
'GStatus_21H1=2', 'GStatus_21H1=2',
'GStatus_20H1=2', 'GStatus_20H1=2',
@ -151,6 +168,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
'OEMModel=Asus ROG Maximus Z690 Extreme', 'OEMModel=Asus ROG Maximus Z690 Extreme',
'OEMModelBaseBoard=ROG MAXIMUS Z690 EXTREME', 'OEMModelBaseBoard=ROG MAXIMUS Z690 EXTREME',
'OEMName_Uncleaned=ASUSTeK COMPUTER INC.', 'OEMName_Uncleaned=ASUSTeK COMPUTER INC.',
'OemPartnerRing=UPSFlighting',
'OSArchitecture='.$arch, 'OSArchitecture='.$arch,
'OSSkuId='.$sku, 'OSSkuId='.$sku,
'OSUILocale=en-US', 'OSUILocale=en-US',
@ -163,8 +181,14 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
'SdbVer_19H1=2000000000', 'SdbVer_19H1=2000000000',
'SecureBootCapable=1', 'SecureBootCapable=1',
'TelemetryLevel=3', 'TelemetryLevel=3',
'TimestampEpochString_CU23H2='.(time()-3600),
'TimestampEpochString_CU23H2Setup='.(time()-3600),
'TimestampEpochString_NI22H2='.(time()-3600),
'TimestampEpochString_NI22H2Setup='.(time()-3600),
'TimestampEpochString_CO21H2='.(time()-3600), 'TimestampEpochString_CO21H2='.(time()-3600),
'TimestampEpochString_CO21H2Setup='.(time()-3600), 'TimestampEpochString_CO21H2Setup='.(time()-3600),
'TimestampEpochString_23H2='.(time()-3600),
'TimestampEpochString_22H2='.(time()-3600),
'TimestampEpochString_21H2='.(time()-3600), 'TimestampEpochString_21H2='.(time()-3600),
'TimestampEpochString_21H1='.(time()-3600), 'TimestampEpochString_21H1='.(time()-3600),
'TimestampEpochString_20H1='.(time()-3600), 'TimestampEpochString_20H1='.(time()-3600),
@ -172,18 +196,27 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
'TPMVersion=2', 'TPMVersion=2',
'UpdateManagementGroup=2', 'UpdateManagementGroup=2',
'UpdateOfferedDays=0', 'UpdateOfferedDays=0',
'UpgEx_CU23H2=Green',
'UpgEx_NI22H2=Green', 'UpgEx_NI22H2=Green',
'UpgEx_CO21H2=Green', 'UpgEx_CO21H2=Green',
'UpgEx_23H2=Green',
'UpgEx_22H2=Green',
'UpgEx_21H2=Green', 'UpgEx_21H2=Green',
'UpgEx_21H1=Green', 'UpgEx_21H1=Green',
'UpgEx_20H1=Green', 'UpgEx_20H1=Green',
'UpgEx_19H1=Green', 'UpgEx_19H1=Green',
'UpgEx_RS5=Green', 'UpgEx_RS5=Green',
'UpgradeAccepted=1',
'UpgradeEligible=1', 'UpgradeEligible=1',
'UserInPlaceUpgrade=1',
'Version_RS5=2000000000', 'Version_RS5=2000000000',
'WuClientVer='.$build, 'WuClientVer='.$build,
); );
if(uupApiConfigIsTrue('fetch_sync_current_only')) {
$attrib[] = 'MediaBranch='.$branch;
}
if($ring == 'MSIT' && uupApiConfigIsTrue('allow_corpnet')) { if($ring == 'MSIT' && uupApiConfigIsTrue('allow_corpnet')) {
$attrib[] = 'DUInternal=1'; $attrib[] = 'DUInternal=1';
} }