tweaselORG / appstraction

An abstraction layer for common instrumentation functions (e.g. installing and starting apps, setting preferences, etc.) on Android and iOS.
MIT License
6 stars 1 forks source link

Automatic WireGuard download on Android fails due to F-Droid API quirk #58

Closed baltpeter closed 1 year ago

baltpeter commented 1 year ago

Currently, the automatic WireGuard download on Android fails. The downloaded APK file is actually an HTML file of a 404 page.

Here's what fdroidMeta from the F-Droid API looks like:

{
    "packageName": "com.wireguard.android",
    "suggestedVersionCode": 498,
    "packages": [
        { "versionName": "1.0.20230330", "versionCode": 496 },
        { "versionName": "1.0.20220516", "versionCode": 492 },
        { "versionName": "1.0.20211029", "versionCode": 491 }
    ]
}

From that, we build the following apkUrl based on the suggestedVersionCode: https://f-droid.org/repo/com.wireguard.android_498.apk

I had assumed that you were supposed to download the version according to the suggestedVersionCode (silly me :D), but it looks like that doesn't necessarily have to exist…

The F-Droid website currently list 496 as the newest available version, and the download for that works. So, I guess it's possible that suggestedVersionCode is incremented before that version is actually uploaded.

I guess we have to change our algorithm to:

  1. Check whether suggestedVersionCode is present in packages. If yes, download that.
  2. If not, download the highest versionCode from packages.
zner0L commented 1 year ago

That sounds very much like a bug in F-Droid, though. Maybe you should also file a bug there?