tsitu / MH-Tools

Assortment of MouseHunt utilities
https://tsitu.github.io/MH-Tools/
Apache License 2.0
30 stars 35 forks source link

[READ WARNING BEFORE MERGING] Add bm-loader forward compatibility fix #263

Closed hymccord closed 1 year ago

hymccord commented 1 year ago

WARNING: We should definitely hold off until tsitu can confirm that the branch deployment is turned off

This should be accepted after my previous PR.(previous pr is merged now)

It will forward all old auto-loaders to the newest one by placing the new auto-loader code in the bm-menu location.

The gh-pages branch should never have to be touched again. Users should update their auto-loader but won't break if they don't.

hymccord commented 1 year ago

Note that this branch's target is gh-pages; where TravisCI used to force push the build outputs.

hymccord commented 1 year ago

Further explanation, from discord, of current events when Auto-Loader is used vs what will happen when this PR is merged.


Current events that happen when you click the "old" Auto-Loader bookmark.

  1. Click
  2. fetch SHA from github api
  3. fetch associated bm-menu.min.js from cdn.jsdelivr@SHA/bm-menu.min.js (not exact url but you get the gist)
  4. That script (bm-menu) is injected into the page and the menu loads. This menu version will use the stored SHA to load the other bookmarklets

After the PR, the "old" Auto-Loaders will do this

  1. Click
  2. same as previous 2. ^^^
  3. same as previous 3.
  4. The injected bm-menu is actually code from the new "bm-loader.js". This code is injected into the document.
  5. The just injected script fetches bm-menu from cdn.jsdelivr@master/bm-menu.min.js
  6. New bm-menu.min.js is injected into the page. This loads bookmarklets from jsdeliver but from the master branch