From 1b0db41b84eb6e03cc1c472a9d63a7b0eca31e69 Mon Sep 17 00:00:00 2001 From: Ken Eucker Date: Fri, 10 Nov 2023 00:49:57 -0800 Subject: [PATCH 1/2] fix(imgur): now respecting payload.cached as to whether or not to pull from cache --- src/imgur/getGame.ts | 2 +- src/imgur/getPlayers.ts | 6 ++++-- src/imgur/getQueue.ts | 6 ++++-- src/imgur/getTags.ts | 6 ++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/imgur/getGame.ts b/src/imgur/getGame.ts index 4332ab7..3177ca6 100644 --- a/src/imgur/getGame.ts +++ b/src/imgur/getGame.ts @@ -20,7 +20,7 @@ export async function getGame( const cacheKey = `imgur::${cacheKeys.gameIdText}${ payload.slug ?? payload.name ?? 'biketag' }` - let game = getCacheIfExists(cacheKey, cache) + let game = payload.cached ? getCacheIfExists(cacheKey, cache) : null let error let success = true diff --git a/src/imgur/getPlayers.ts b/src/imgur/getPlayers.ts index e12c555..7004ec5 100644 --- a/src/imgur/getPlayers.ts +++ b/src/imgur/getPlayers.ts @@ -18,8 +18,10 @@ export async function getPlayers( if (client) { const { data: tags } = await this.getTags({ sort: 'relevance' }) - const albumInfo = await getGameAlbumFromCache(payload.hash, cache, () => - client.getAlbum(payload.hash) + const albumInfo = await getGameAlbumFromCache( + payload.hash, + payload.cached ? cache : undefined, + () => client.getAlbum(payload.hash) ) const playerImages = albumInfo.data?.images?.reduce((o, i) => { const player = getPlayerDataFromText(i.description) diff --git a/src/imgur/getQueue.ts b/src/imgur/getQueue.ts index 81bfe39..6f5eeba 100644 --- a/src/imgur/getQueue.ts +++ b/src/imgur/getQueue.ts @@ -18,8 +18,10 @@ export async function getQueue( payload.queuehash = game.data.queuehash } } - const albumInfo = await getGameAlbumFromCache(payload.queuehash, cache, () => - client.getAlbum(payload.queuehash) + const albumInfo = await getGameAlbumFromCache( + payload.queuehash, + payload.cached ? cache : undefined, + () => client.getAlbum(payload.queuehash) ) const images = getGroupedImagesByTagnumber(albumInfo?.data?.images, cache) diff --git a/src/imgur/getTags.ts b/src/imgur/getTags.ts index 045b644..cd13f18 100644 --- a/src/imgur/getTags.ts +++ b/src/imgur/getTags.ts @@ -20,8 +20,10 @@ export async function getTags( let error let success = true - const albumInfo = await getGameAlbumFromCache(payload.hash, cache, () => - client.getAlbum(payload.hash) + const albumInfo = await getGameAlbumFromCache( + payload.hash, + payload.cached ? cache : undefined, + () => client.getAlbum(payload.hash) ) if (payload.tagnumbers?.length) { From 5d3360d22874b27974f9a8dc1cec5e533bdba1c5 Mon Sep 17 00:00:00 2001 From: Ken Eucker Date: Fri, 10 Nov 2023 00:50:48 -0800 Subject: [PATCH 2/2] chore(package): version 3.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 239437f..c43e37e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "biketag", - "version": "3.1.2", + "version": "3.1.3", "description": "The Javascript client API for BikeTag Games", "main": "./biketag.node.js", "browser": "./biketag.js",