Closed pascalberger closed 5 years ago
@Jericho Once we have defined how the new URL should look like this might be something which needs to be adopted in the AddinDiscoverer
I will be happy to update the discoverer, no problem.
Before I do so, I would like to make a suggestion: the current URL uses the SHA of the commit where the image was originally committed which is ugly, impossible to memorize and easy to mistype. Also, what if the Cake logo changes at some point in the future and the image is updated? All addins will still reference the old logo and we will have to convince 200+ addin authors to update the URL in their nuspec. jsDelivr works really well with github releases and allows to use either a specific release number in the URL or the word latest
which will automatically pick the image in the most recent release.
Therefore I propose that we should tag the graphics repo with a release, say 1.0.0
, and we recommend that addin authors use a URL similar to this: https://cdn.jsdelivr.net/gh/cake-contrib/graphics@latest/png/cake-contrib-medium.png
. When Cake goes through a rebranding at a future date, we simply need to instruct jsDelivr to flush their cache and the new version will automatically be served up by their CDN.
Makes sense?
The reason to have the commit ID in there is to allow possible restructuration in the repository (e.g. move file around). But using releases would work for me too. @gep13 What's your opinion on this?
@gep13 ?
@gep13 ?
@Jericho apologies, I missed this question...
So, there are two potential "problems" that these cached URL's are trying to solve. The first is that a file is moved around in a repository, essentially breaking the URL. And secondly the potential for future changes to the Cake Contrib Icon. Both of these, in terms of future plans that I am aware of are slim, however, I think there is a greater chance of the icon being changed, as opposed to the structure of the repository changing.
As such, I would be happy to continue with the latest
url.
Looks like jsDelivr allows omitting the latest
label and it will automatically serve the latest version of the file (I don't think that was possible back in October 2018. Probably a new feature they added in the interim). Therefore the new URL that will be enforced by the AddinDiscoverer will be: https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png
.
I found a very interesting comment that explains jsDelivr's caching policy. In summary, they cache files for 12 hours and they also include headers in their response that will cause browsers to cache the file for up to 7 days. This means that it could take anywhere from a few hours all the way to a whole week before a given user sees the new version of the cake-contrib logo when it's updated. I think this is fine, but I wanted to document it so we are all aware.
Also note that we could request access to their "purge api" if we want to clear their cache faster (see their readme for more details).
Cake.AddinDiscoverer version 3.11.0 has been released. As I mentioned earlier, the URL is now: https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png
.
@gep13 I've updated the PR to the JsDelivr link Jericho suggested. OK for you to merge like this?
@pascalberger your changes have been merged, thanks for your contribution 👍
RawGit will shutdown October 2019. We should start promote alternatives. This PR uses https://www.jsdelivr.com as an alternative
Fixes #59