Skip to content

Commit

Permalink
Update: API v3, only return the requested OS
Browse files Browse the repository at this point in the history
Reduces response length by mot including unnecessary data
  • Loading branch information
AniLeo committed Sep 22, 2024
1 parent a53cd6e commit 76a9eb6
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions update.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,29 @@ function check_for_updates( string $api,
return $results;
}

// For the v3 API, we only return the requested OSes
$results['latest_build']['pr'] = $latest->pr;
$results['latest_build']['datetime'] = $latest->merge;
$results['latest_build']['version'] = $latest->version;
$results['latest_build']['windows']['download'] = $latest->get_url_windows();
$results['latest_build']['windows']['size'] = $latest->size_win;
$results['latest_build']['windows']['checksum'] = $latest->checksum_win;
$results['latest_build']['linux']['download'] = $latest->get_url_linux();
$results['latest_build']['linux']['size'] = $latest->size_linux;
$results['latest_build']['linux']['checksum'] = $latest->checksum_linux;
$results['latest_build']['mac']['download'] = $latest->get_url_mac();
$results['latest_build']['mac']['size'] = $latest->size_mac;
$results['latest_build']['mac']['checksum'] = $latest->checksum_mac;

if (substr($api, 1, 1) < 3 || (substr($api, 1, 1) >= 3 && $os_type === "windows"))
{
$results['latest_build']['windows']['download'] = $latest->get_url_windows();
$results['latest_build']['windows']['size'] = $latest->size_win;
$results['latest_build']['windows']['checksum'] = $latest->checksum_win;
}
if (substr($api, 1, 1) < 3 || (substr($api, 1, 1) >= 3 && $os_type === "linux"))
{
$results['latest_build']['linux']['download'] = $latest->get_url_linux();
$results['latest_build']['linux']['size'] = $latest->size_linux;
$results['latest_build']['linux']['checksum'] = $latest->checksum_linux;
}
if (substr($api, 1, 1) < 3 || (substr($api, 1, 1) >= 3 && $os_type === "macos"))
{
$results['latest_build']['mac']['download'] = $latest->get_url_mac();
$results['latest_build']['mac']['size'] = $latest->size_mac;
$results['latest_build']['mac']['checksum'] = $latest->checksum_mac;
}

if (!is_null($commit))
{
Expand Down

0 comments on commit 76a9eb6

Please sign in to comment.