@@ -962,7 +962,7 @@ export const getActiveQueueForGame = async (
962962 : 0
963963
964964 const approvingAmbassadorIsApproved = ! ! approvingAmbassador ?. length
965- const imageSource = game . awsRegion ? 'aws' : 'imgur'
965+ const imageSource = getImageSource ( game )
966966
967967 log ( 'Evaluating active queue for game' , { game : game . name , autoPostSetting, imageSource } , 'info' )
968968
@@ -1323,7 +1323,7 @@ export const sendBikeTagPostNotificationToBlueSky = async (
13231323 const timestamp = getTagDateISOFromTimezone ( currentTag . foundTime , game . region . tz )
13241324 const link = `${ host } /${ winningTagnumber } `
13251325 const gameLinkFacet = getStartAndEndBytesOfStringWithinString ( heading , game . name )
1326- const imageSource = game . awsRegion ? 'aws' : 'imgur'
1326+ const imageSource = getImageSource ( game )
13271327 const imageUrl = getImageSized ( imageSource , winningTag . mysteryImageUrl , 'm' )
13281328
13291329 try {
@@ -1404,7 +1404,7 @@ export const sendBikeTagPostNotificationToWebhook = (
14041404 const mysteryAltText = `BikeTag #${ winningTagnumber } by ${ winningTag . mysteryPlayer } `
14051405 const foundAltText = `BikeTag #${ currentNumber } found by ${ currentTag . foundPlayer } `
14061406 const timestamp = getTagDateISOFromTimezone ( currentTag . foundTime , game . region . tz )
1407- const imageSource = game . awsRegion ? 'aws' : 'imgur'
1407+ const imageSource = getImageSource ( game )
14081408 const mysteryImageUrl = getImageSized ( imageSource , winningTag . mysteryImageUrl , 'l' )
14091409 const foundImageUrl = getImageSized ( imageSource , currentTag . foundImageUrl , 'l' )
14101410
@@ -1635,7 +1635,7 @@ export const setNewBikeTagPost = async (
16351635) : Promise < BackgroundProcessResults > => {
16361636 adminBiketag =
16371637 adminBiketag ?? new BikeTagClient ( getBikeTagClientOpts ( undefined , true , true , game ) )
1638- const imageSource = game . awsRegion ? 'aws' : 'imgur'
1638+ const imageSource = getImageSource ( game )
16391639 previousBikeTag =
16401640 previousBikeTag ?? ( ( await adminBiketag . getTag ( undefined , { source : imageSource } ) ) . data as Tag )
16411641 let errors = false
@@ -1932,3 +1932,12 @@ export const getEnvironmentVariable = (key: string) => {
19321932 return decompress ( process . env [ key ] , { inputEncoding : 'Base64' } )
19331933 }
19341934}
1935+
1936+ export const getImageSource = ( game : Game ) : 'aws' | 'imgur' => {
1937+ if ( game . awsRegion && game . settings [ 'data::aws' ] === 'true' ) {
1938+ return 'aws'
1939+ } else if ( game . mainhash ?. length ) {
1940+ return 'imgur'
1941+ }
1942+ return 'imgur'
1943+ }
0 commit comments