mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
126 stars 41 forks source link

Add a "latest URL" property to add-on API #1768

Open tofumatt opened 6 years ago

tofumatt commented 6 years ago

The old add-ons site used a "latest" redirect link for Add-on XPIs while the new site uses the direct file link in current_version. See: https://github.com/mozilla/addons/issues/2035

It would be nice if we exposed the link to the "latest" URLs so we can use that instead; this will help developers have a nicer link to copy as mentioned in the above issue.

I know the URL is easy to construct, but I'd like the API to be the source-of-truth for this.

┆Issue is synchronized with this Jira Task

diox commented 6 years ago

We do have URLs in place but I avoided exposing this in the API until now because of the platforms mess. When the add-on file is available for all platforms it's easy, but when it's not it becomes quite messy, especially if the platforms change from version to version.

tofumatt commented 6 years ago

Ah, so in the past the latest link would be weird for add-on files with particular files per platform? I guess that’s just been a known bug on addons-server then, right?

diox commented 6 years ago

It depends on what plaforms are set for the add-on. If no platform is included in the URL, we default to look for files available for all platforms. If there is none, we return a 404. It's not technically a bug, it's just that we can't automatically guess a platform if it's not available for all.

(The way to specify the platform in the URL is super weird - it looks like /downloads/latest/blah/platform:{platform_id}/filename.xpi)

eviljeff commented 6 years ago

We could have the property be a dict of <platform>: <url> and then frontend would have to expose the correct one. When it's all it could either be a flat url or "all": <url> (do we expose an ALL platform identifier in the API?). Or alternatively not do any of this and look forward to when we can drop files per platform 😉

mkaply commented 6 years ago

How often are there platform specific extensions anymore with WebExtensions?

diox commented 6 years ago

There are still android-specific or desktop-specific add-ons, and we are still supporting legacy add-ons as long as Firefox 52 ESR is supported.

Ultimately as @eviljeff points out above we are going to remove the files per platform thing at some point, but right now we can't.

diox commented 6 years ago

Note that we recently removed the ability to choose a platform in https://github.com/mozilla/addons/issues/5743 , but we haven't got rid of platforms completely so this is still blocked.

diox commented 3 years ago

Doing https://github.com/mozilla/addons/issues/8174 will unblock this.

diox commented 1 month ago

This exists for the latest publicly listed version of an add-on, but is not currently documented/exposed in the API. The URL is https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/, or in Django reverse('downloads.latest', args=(pk_or_slug_or_guid))