mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
fix: move cache-busting to server side
This commit is contained in:
@ -1283,8 +1283,6 @@ async function drawSpritesList(character, labels, sprites) {
|
|||||||
* @returns {Promise<string>} Rendered list item template
|
* @returns {Promise<string>} Rendered list item template
|
||||||
*/
|
*/
|
||||||
async function getListItem(item, imageSrc, textClass, isCustom) {
|
async function getListItem(item, imageSrc, textClass, isCustom) {
|
||||||
const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
||||||
imageSrc = isFirefox ? `${imageSrc}?t=${Date.now()}` : imageSrc;
|
|
||||||
return renderExtensionTemplateAsync(MODULE_NAME, 'list-item', { item, imageSrc, textClass, isCustom });
|
return renderExtensionTemplateAsync(MODULE_NAME, 'list-item', { item, imageSrc, textClass, isCustom });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,9 +124,10 @@ router.get('/get', jsonParser, function (request, response) {
|
|||||||
})
|
})
|
||||||
.map((file) => {
|
.map((file) => {
|
||||||
const pathToSprite = path.join(spritesPath, file);
|
const pathToSprite = path.join(spritesPath, file);
|
||||||
|
const mtime = fs.statSync(pathToSprite).mtime?.toISOString().replace(/[^0-9]/g, '').slice(0, 14);
|
||||||
return {
|
return {
|
||||||
label: path.parse(pathToSprite).name.toLowerCase(),
|
label: path.parse(pathToSprite).name.toLowerCase(),
|
||||||
path: `/characters/${name}/${file}`,
|
path: `/characters/${name}/${file}` + (mtime ? `?t=${mtime}` : ''),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user