templateManager icon indicating copy to clipboard operation
templateManager copied to clipboard

Add how to correctly get cached purged version to template source (the .json)

Open LittleEndu opened this issue 2 years ago • 2 comments

There are many ways the script could do cache busting, but it seems sometimes it actually works against our best wishes. Real solution to this should be investigated, and if there's a way to fix it it should be added into the .json so that after loading it for the first time the script knows how to refresh it correctly.

This could also just include an incremental version number i.e filename part of the path is the cache bust not the uri query. For example templateManager is told to add https://littleendu.xyz/template.json as a source, and then in the .json templateManager would find "hey, we actually have updated this 45 times. You can find the templates in https://littleendu.xyz/template-v45.json and in the future, try https://littleendu.xyz/template-v46.json to see if we have an update"

LittleEndu avatar Dec 31 '23 14:12 LittleEndu

Regarding the version number in filename, I think the JSON should be able to specify whether this should be enabled or not (i.e. it's decided on the first time it gets the JSON)

Also, for our own templates (and HYTC): I should check what cache headers are being sent to the client — maybe I can make it not cache the JSON?

april83c avatar Dec 31 '23 14:12 april83c

I think the JSON should be able to specify whether this should be enabled or not

That's the title part of this issue 😛

Like a new key in the .json root named version residing here:

https://github.com/osuplace/templateManager/blob/d99ae00286f346f81af85d2857dfd42ee0d91a44/src/template.ts#L27-L34

LittleEndu avatar Dec 31 '23 14:12 LittleEndu