flatpak-external-data-checker icon indicating copy to clipboard operation
flatpak-external-data-checker copied to clipboard

Support `url-template` for JSON checker

Open JakobDev opened this issue 2 years ago • 1 comments

The JSON checker currently needs to query the download URL from the JSON file. But sometimes the API just contains the version and not the URL. There are also cases, in which this would be easier to for people who are not so familiar with jq. So it would be nice, to have url-template like Anitya for this case. It could be used like this:

"x-checker-data": {
    "type": "json",
    "url": "https://api.github.com/repos/stedolan/jq/releases/latest",
    "version-query": ".tag_name | sub(\"^jq-\"; \"\")",
    "url-template": "https://github.com/stedolan/jq/releases/download/jq-$version/jq-$version.tar.gz"
}

I know, the GitHub API has the direct download link. This is just a example.

JakobDev avatar Jan 06 '23 07:01 JakobDev

You can use jq syntax for that already. Just remember that every -query is a jq expression, not a regular string, so getting escaping right may be tricky. Something like this should work:

"url-query": "\"http://example.com/tarball-\\($version).tar.gz\""

gasinvein avatar Jan 06 '23 16:01 gasinvein