microsoft / azure-devops-extension-sdk

Client SDK for developing Azure DevOps extensions
MIT License
122 stars 38 forks source link

Can we get a method for retrieving the current extensions public base path/uri? #107

Open gburning opened 1 month ago

gburning commented 1 month ago

For the extension I'm building I need to figure out the base url it is served from when statically hosted through your CDN(s).

According to the documentation it should be https://{publisher}.gallerycdn.vsassets.io but there are 2 problems:

  1. This is only the origin, not the full path. In my case the full base URL looks like (obfuscated) https://{publisher}.gallerycdn.vsassets.io/extensions/{publisher}/{ext-id}/{ext-version}/{unknown-number}/.
  2. The host isn't always consistent. I seem to have published extensions that are served from https://{publisher}.gallery.vsassets.io. This is also indicated by the change history of your documentation.

I could try and figure out what the unknown number is (timestamp of some kind?) and build the base path myself but I would be much more comfortable if I had a method of extracting this information via the SDK/some kind of method exposed on the host. Is this possible?

Thank you in advance!

gburning commented 1 month ago

Realized that this is actually included in the API (baseUri on returned InstalledExtension object). Still think this would be valuable for the SDK itself to export but I understand if this is not a priority.

gburning commented 1 month ago

One thing of note is that neither baseUri nor fallbackUri include a trailing slash at the end, which they arguably should.