Skip to content

Conversation

@tobiashort
Copy link

@tobiashort tobiashort commented Dec 26, 2025

Added support for application/json content type.
Enabling interaction with APIs like https://api.github.com/repos/<user>/<repo>/releases/latest.

Testing the changes

  • I tested the changes in this PR: briefly

@ahesford
Copy link
Member

Until this is actually used somewhere and provides a tangible benefit, we should defer accepting additional types. In addition, the commit message should follow the conventions established in the repository history by listing the modified file and a more relevant description of the intent of the change:

common/xbps-src/shutils/update_check.sh: support JSON responses

Added support for application/json content type.
Enabling interaction with APIs like https://api.github.com/repos/<user>/<repo>/releases/latest.
@tobiashort
Copy link
Author

I fixed the commit message.

I added JSON support because scraping HTML is often unreliable when a site loads content dynamically. For example, on GitHub the assets on the Releases page are only loaded when scrolled into the viewport. Running

curl -s --follow "https://github.com/brave/brave-browser/releases/latest" | grep "brave-browser_1.85.118_amd64.deb"

does not match anything. In such cases it is easier to use the REST API, e.g. https://api.github.com/repos/brave/brave-browser/releases/latest. Therefore, I found it beneficial to also support application/json.

$ curl -s "https://api.github.com/repos/brave/brave-browser/releases/latest" | grep "brave-browser_1.85.118_amd64.deb"
      "name": "brave-browser_1.85.118_amd64.deb",
[...]

@ahesford
Copy link
Member

Finding a specific pattern is not a valid demonstration, because we generally care about finding the most recent release and not some specific version. However, it is true that that are occasions (fortunately, not that frequently) where particular update patterns or ignore rules reject all matches visible to the update checker.

My point about deferring this support is that it doesn't do us any good to accept JSON responses if none of the update checks are querying JSON endpoints. This should be part and parcel with an addition that takes advantage of the capability.

@tobiashort
Copy link
Author

Okay, I understand what you mean: Why add it when nobody needs it, at least currently. So close this PR if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants