Open IzzySoft opened 8 years ago
For minimal overhead, we can use something like this to verify availibility (not available version):
[wget --method=HEAD -O - $url
rc=$?
if [[ $rc -eq 8 ]] … # app unavailable
elif [[ $rc -eq 0 ] ... # app available
else ... # unknown status (some error running `wget`)
This works for Playstore and Xposed, but e.g. not for F-Droid (which always replies with a "200 OK" and neither gives any indicator in the HTTP headers of its server-response). F-Droid would require getting the full page and parse it for the package name, which is not present if the app is not available (unless it's accidentally a substring of something else (to avoid that, we can simply prefix the package name by "/repo/", counting on the download link).
However, those "network checks" must be optional (i.e. user must opt-in by setting the corresponding variable(s)). Corresponding to the APP_MARKET_URL
we could introduce a APP_MARKET_CHECK
variable pointing out the check method to use on the URL defined by the former (empty for no check, HEAD
for the first method above, or a string to parse GET
for – which could be /repo/%s
for F-Droid with the %s
then being replaced by the package name).
As getting the latest version from all possible markets would go a bit beyond Adebar itself, we could at least give the user an option to provide an own script for this purpose – as done with APPNAME_CMD
already, say APPVER_CMD
– passing it the package name and installer name as parameters.
As I'm still unsure if this feature is really wanted, I'm waiting for "thumbs up" on the initial post to indicate interest :innocent:
Update: wget --method=HEAD --server-response https://f-droid.org/packages/<package_name>/
dutifully reports HTTP/1.1 404 Not Found
if an app does not exist and HTTP/1.1 200 OK
if it's there. So the following command should return 0
if an app is unavailable at F-Droid, and >0
(=1
) otherwise:
wget --method=HEAD --server-response https://f-droid.org/packages/<package_name>/ 2>&1 |grep HTTP |grep "200 OK" |wc -l
For performance, apart from making the checks optional, it should by default also be restricted to the site the install source indicates (i.e. when it was installed from F-Droid, only check F-Droid) – maybe with an option to check "alternative sources" if an app is no longer available at its original source.
For "latest version available" it gets more tricky – as without involving other dependencies, this would require "scraping" the corresponding web pages. This might be overkill, though, as updates are usually dealt with on-device, using the corresponding apps (Playstore/Yalp/Aurora, F-Droid etc).
When creating the documentation for user-installed apps, we should point out whether they are still available at their source (see: How to get notified about removed apps from play store?).
At least for Playstore, this can be done by a simple HTTP request (which returns a 404 when the app became unavailable). If possible, we could even include more details (optional/configurable), such as last version available (as opposed to the version currently installed).