Shields: F-Droid badge not working?

Created on 16 Sep 2018  Â·  10Comments  Â·  Source: badges/shields

Hi,
I'm trying to add a badge for my github project published on f-droid.
URL is: https://img.shields.io/f-droid/v/com.github.catfriend1.syncthingandroid.svg
So far I'm just seeing "app not found", but that's not true.
See here, it's on the repository:
https://f-droid.org/packages/com.github.catfriend1.syncthingandroid/
Please help me on this.
Thanks in advance
Catfriend1

bug needs-upstream-help service-badge

Most helpful comment

All 10 comments

Hello @Catfriend1,

Our current implementation uses _.txt_ metadata files (see this code line). Unfortunately your app seems to be one of the rare ones having a _.yml_ metadata file, therefore the badge is not working properly.

Pinging @niccokunzmann as he may be able to assist you further or give us some additional information. 😉

Cheers,

Pyves

Hi, thanks for your quick answer. I recently applied to fdroid with a packaging request so its very young on the fdroid. I've first made my request with a txt file but maintainers informed me about yml is better and should be done so I suspect fdroid will soon switch from txt to yml.

@Catfriend1 It should be easy to add the badge for the .yml files, too. yml can be converted to JSON and from there, we can get all the necessary information.

This line constructs the URL:
https://github.com/badges/shields/blob/master/services/f-droid/f-droid.service.js#L11

const url = `https://gitlab.com/fdroid/fdroiddata/raw/master/metadata/${appId}.txt`

You can see what to change...

These lines parse the URL:

  // we assume the layout as provided here:
  // https://gitlab.com/fdroid/fdroiddata/raw/master/metadata/axp.tool.apkextractor.txt
  const positionOfCurrentVersionAtEndOfTheFile = metadata.lastIndexOf(
    'Current Version:'
  ) // credits: https://stackoverflow.com/a/11134049
  const lastVersion = metadata.substring(
    positionOfCurrentVersionAtEndOfTheFile
  )
  const match = lastVersion.match(/^Current Version:\s*(.*?)\s*$/m)

With yml this would be about two lines: 1) parse to json 2) get the attribute

I see two ways to go forward which I ask @PyvesB to give input about:

  1. Query .txt and if not present, query .yml - this would leave the badge svg url intact
  2. create one badge for txt and one for .yml

Thanks @niccokunzmann for your suggestion, looks good to me. I hope it can get implemented.

By the way: We have the tutorial in the docs folder on setup and
implementation of a badge. If you find anything you like to change
there, you are welcome to contribute. It is quite new.

On 09/17/2018 08:58 AM, Catfriend1 wrote:
>

Thanks @niccokunzmann https://github.com/niccokunzmann for your
suggestion, looks good to me. I hope it can get implemented.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/badges/shields/issues/2083#issuecomment-421908310,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAieIMvzcDi6LKwepDsu-m1O5QuuIv6eks5ub0gSgaJpZM4Wqxme.

As far as I can tell from reading this GitLab issue, YAML indeed seems to be the preferred format now, but there aren't any plans of converting all the existing files, is that correct? If so, it's an annoying inconsistency.

@niccokunzmann I'm not convinced with option 2., as the two badges would basically be the same, just with a very slightly different processing underneath the hood. Also, if you're not the one who created the metadata, you would have to look it up in GitLab to figure out what the format is, which is not ideal and even confusing.

In my opinion, we should probably go with option 1., but voice our concern over on the F-Droid repository - for instance ask them if a conversion of all files to YAML could be performed, because the current inconsistency makes using the metadata unreliable for third-party applications.

Honestly I don't know the exact plans how the fdroid will do the switchover as I'm just releasing my app there

the best will be an API from F-droid, but for now, a query is the option https://github.com/badges/shields/pull/2377, the migration to .yml for all apps is far away because is a big migration and can have side effects

Thanks, it works now like expected:-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kerolloz picture kerolloz  Â·  3Comments

Turnerj picture Turnerj  Â·  3Comments

lukeeey picture lukeeey  Â·  3Comments

najeeb-ur-rehman picture najeeb-ur-rehman  Â·  3Comments

korenyoni picture korenyoni  Â·  3Comments