Consume new ghtutorial route when loading tutorials from github
This consumes the newly proposed /api/ghtutorial/ endpoint. Opening as a draft PR because this endpoint isn't actually released yet.
When loading a tutorial from github, this takes the response from /api/ghtutorial/ and uses it to populate all of the caches that we maintain in indexeddb. The rest of the markdown loading pipeline is unchanged, the requests it makes simply hit the cache instead of actually making requests to the backend.
This PR also makes it so that we now cache the latest versions of github repos inside indexeddb just like we do everything else. Unlike the other things we cache, the entries for latest versions expire after an hour. I might end up increasing this period, though, since that isn't very much time at all.
I also added a skipgithubcache=1 query parameter that bypasses all of our local github repo caches to make it easier for content creators to verify their changes.
also tacked on an unrelated change making it so that the saveblocks query param is now case insensitive and accepts saveasblocks since I always accidentally try that first.
updated with the changes I made to the API route. this now also works with tutorials in the docs folder of targets, uses etags, and proxies requests through the CDN.
here's an upload target you can use to test (micro:bit):
https://makecode.microbit.org/app/de79fa186a7b3225ed5aeb161ea70ec7796af70e-ac898cc414
and here's a URL that includes a docs tutorial that has a GitHub dependency:
https://makecode.microbit.org/app/de79fa186a7b3225ed5aeb161ea70ec7796af70e-ac898cc414?nocdn=1#tutorial:/projects/micro-coin
the ?nocdn=1 is a new query param i added to bypass the CDN. required for this example because the CDN hits our production backend which does not have the new API deployed yet. I recommend opening the tutorial link in an incognito window to make sure you aren't hitting any local caches
@microsoft/makecode-engineers this is now ready for review! here is an updated upload target:
https://makecode.microbit.org/app/36c4b10f729c193f650f763ba2e37a23adefdd90-bcbbdbd05c