forked from uup-dump/api
		
	Add support for Canary
This commit is contained in:
		
							
								
								
									
										10
									
								
								fetchupd.php
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								fetchupd.php
									
									
									
									
									
								
							| @@ -39,14 +39,18 @@ function uupFetchUpd( | ||||
|     $flight = 'Active'; | ||||
|  | ||||
|     if($build == 'latest' || (!$build)) { | ||||
|         $builds = array('17134.1'); | ||||
|         $builds = array('22000.1'); | ||||
|  | ||||
|         $ids = uupListIds(); | ||||
|         if(isset($ids['error'])) { | ||||
|             $ids['builds'] = array(); | ||||
|         } | ||||
|  | ||||
|         $build = $ids['builds'][0]['build']; | ||||
|         if(empty($ids['builds'])) { | ||||
|             $build = $builds[0]; | ||||
|         } else { | ||||
|             $build = $ids['builds'][0]['build']; | ||||
|         } | ||||
|         unset($builds, $ids); | ||||
|     } | ||||
|  | ||||
| @@ -59,7 +63,7 @@ function uupFetchUpd( | ||||
|         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'); | ||||
|     } | ||||
|  | ||||
|   | ||||
							
								
								
									
										28
									
								
								get.php
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								get.php
									
									
									
									
									
								
							| @@ -48,7 +48,7 @@ function uupGetFiles( | ||||
|     } | ||||
|  | ||||
|     $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); | ||||
|     $fromCache = $cache->get(); | ||||
|     if($fromCache !== false) return $fromCache; | ||||
| @@ -175,16 +175,34 @@ function uupGetFiles( | ||||
|         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) { | ||||
|         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 = preg_grep('/\.psf$/i', $psf); | ||||
|  | ||||
|     $psfk = preg_grep('/Windows(10|11)\.0-KB.*/i', $psf); | ||||
|     $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) { | ||||
|         if(isset($psf[$key])) unset($psf[$key]); | ||||
|     } | ||||
| @@ -227,7 +245,7 @@ function uupGetFiles( | ||||
|     switch($fileListSource) { | ||||
|         case 'UPDATEONLY': | ||||
|             $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) { | ||||
|                 if(isset($filesInfoList[$val])) unset($filesInfoList[$val]); | ||||
| @@ -273,7 +291,7 @@ function uupGetFiles( | ||||
|         unset($removeMSUs); | ||||
|         $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) { | ||||
|             $temp = preg_grep('/.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp); | ||||
|         } else if($build > 21380) { | ||||
| @@ -361,7 +379,7 @@ function uupGetFiles( | ||||
| } | ||||
|  | ||||
| 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); | ||||
|     $fromCache = $cache->get(); | ||||
|     $cached = ($fromCache !== false); | ||||
|   | ||||
| @@ -166,7 +166,7 @@ function uupListIds($search = null, $sortByDate = 0) { | ||||
|         $cache->put($builds, 60); | ||||
|     } | ||||
|  | ||||
|     if($search != null) { | ||||
|     if(count($builds) && $search != null) { | ||||
|         if(!preg_match('/^regex:/', $search)) { | ||||
|             $searchSafe = preg_quote($search, '/'); | ||||
|  | ||||
|   | ||||
| @@ -10,7 +10,7 @@ Parameters: | ||||
|    - **Supported values:** `amd64`, `x86`, `arm64`, `all` | ||||
|  | ||||
|  - `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` | ||||
|  | ||||
|  - `flight` - Content type to use when fetching information (Previously called Flight) | ||||
|   | ||||
| @@ -16,7 +16,7 @@ limitations under the License. | ||||
| */ | ||||
|  | ||||
| function uupApiVersion() { | ||||
|     return '1.39.3'; | ||||
|     return '1.40.1'; | ||||
| } | ||||
|  | ||||
| require_once dirname(__FILE__).'/auths.php'; | ||||
|   | ||||
| @@ -94,6 +94,11 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) { | ||||
|         $fltRing = 'Internal'; | ||||
|     } | ||||
|  | ||||
|     if($ring == 'CANARY') { | ||||
|         $fltBranch = 'CanaryChannel'; | ||||
|         $ring = 'WIF'; | ||||
|     } | ||||
|  | ||||
|     $bldnum = explode('.', $build); | ||||
|     $bldnum = $bldnum[2]; | ||||
|  | ||||
| @@ -107,14 +112,20 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) { | ||||
|     $attrib = array( | ||||
|         'App=WU_OS', | ||||
|         'AppVer='.$build, | ||||
|         'AttrDataVer=177', | ||||
|         'AttrDataVer=208', | ||||
|         'AllowInPlaceUpgrade=1', | ||||
|         'AllowUpgradesWithUnsupportedTPMOrCPU=1', | ||||
|         'BlockFeatureUpdates='.$blockUpgrades, | ||||
|         'BranchReadinessLevel=CB', | ||||
|         'CurrentBranch='.$branch, | ||||
|         'DataExpDateEpoch_CU23H2='.(time()+82800), | ||||
|         'DataExpDateEpoch_CU23H2Setup='.(time()+82800), | ||||
|         'DataExpDateEpoch_NI22H2='.(time()+82800), | ||||
|         'DataExpDateEpoch_NI22H2Setup='.(time()+82800), | ||||
|         'DataExpDateEpoch_CO21H2='.(time()+82800), | ||||
|         'DataExpDateEpoch_CO21H2Setup='.(time()+82800), | ||||
|         'DataExpDateEpoch_23H2='.(time()+82800), | ||||
|         'DataExpDateEpoch_22H2='.(time()+82800), | ||||
|         'DataExpDateEpoch_21H2='.(time()+82800), | ||||
|         'DataExpDateEpoch_21H1='.(time()+82800), | ||||
|         'DataExpDateEpoch_20H1='.(time()+82800), | ||||
| @@ -128,8 +139,14 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) { | ||||
|         //'FlightContent='.$fltContent, | ||||
|         'FlightRing='.$fltRing, | ||||
|         'Free=gt64', | ||||
|         'GStatus_CU23H2=2', | ||||
|         'GStatus_CU23H2Setup=2', | ||||
|         'GStatus_NI22H2=2', | ||||
|         'GStatus_NI22H2Setup=2', | ||||
|         'GStatus_CO21H2=2', | ||||
|         'GStatus_CO21H2Setup=2', | ||||
|         'GStatus_23H2=2', | ||||
|         'GStatus_22H2=2', | ||||
|         'GStatus_21H2=2', | ||||
|         'GStatus_21H1=2', | ||||
|         'GStatus_20H1=2', | ||||
| @@ -151,6 +168,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) { | ||||
|         'OEMModel=Asus ROG Maximus Z690 Extreme', | ||||
|         'OEMModelBaseBoard=ROG MAXIMUS Z690 EXTREME', | ||||
|         'OEMName_Uncleaned=ASUSTeK COMPUTER INC.', | ||||
|         'OemPartnerRing=UPSFlighting', | ||||
|         'OSArchitecture='.$arch, | ||||
|         'OSSkuId='.$sku, | ||||
|         'OSUILocale=en-US', | ||||
| @@ -163,8 +181,14 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) { | ||||
|         'SdbVer_19H1=2000000000', | ||||
|         'SecureBootCapable=1', | ||||
|         'TelemetryLevel=3', | ||||
|         'TimestampEpochString_CU23H2='.(time()-3600), | ||||
|         'TimestampEpochString_CU23H2Setup='.(time()-3600), | ||||
|         'TimestampEpochString_NI22H2='.(time()-3600), | ||||
|         'TimestampEpochString_NI22H2Setup='.(time()-3600), | ||||
|         'TimestampEpochString_CO21H2='.(time()-3600), | ||||
|         'TimestampEpochString_CO21H2Setup='.(time()-3600), | ||||
|         'TimestampEpochString_23H2='.(time()-3600), | ||||
|         'TimestampEpochString_22H2='.(time()-3600), | ||||
|         'TimestampEpochString_21H2='.(time()-3600), | ||||
|         'TimestampEpochString_21H1='.(time()-3600), | ||||
|         'TimestampEpochString_20H1='.(time()-3600), | ||||
| @@ -172,18 +196,27 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) { | ||||
|         'TPMVersion=2', | ||||
|         'UpdateManagementGroup=2', | ||||
|         'UpdateOfferedDays=0', | ||||
|         'UpgEx_CU23H2=Green', | ||||
|         'UpgEx_NI22H2=Green', | ||||
|         'UpgEx_CO21H2=Green', | ||||
|         'UpgEx_23H2=Green', | ||||
|         'UpgEx_22H2=Green', | ||||
|         'UpgEx_21H2=Green', | ||||
|         'UpgEx_21H1=Green', | ||||
|         'UpgEx_20H1=Green', | ||||
|         'UpgEx_19H1=Green', | ||||
|         'UpgEx_RS5=Green', | ||||
|         'UpgradeAccepted=1', | ||||
|         'UpgradeEligible=1', | ||||
|         'UserInPlaceUpgrade=1', | ||||
|         'Version_RS5=2000000000', | ||||
|         'WuClientVer='.$build, | ||||
|     ); | ||||
|  | ||||
|     if(uupApiConfigIsTrue('fetch_sync_current_only')) { | ||||
|         $attrib[] = 'MediaBranch='.$branch; | ||||
|     } | ||||
|  | ||||
|     if($ring == 'MSIT' && uupApiConfigIsTrue('allow_corpnet')) { | ||||
|         $attrib[] = 'DUInternal=1'; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user