flatpak-external-data-checker
flatpak-external-data-checker copied to clipboard
Support `url-template` for JSON checker
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.
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\""