Feature: add support for panoramax picturs for non-default keys (e.g. image:menu)

This commit is contained in:
Pieter Vander Vennet 2024-09-27 03:26:17 +02:00
parent 967f2f1617
commit 55cfd65f3b
5 changed files with 20 additions and 15 deletions

View file

@ -90,13 +90,14 @@ export default class AllImageProviders {
this._cache.set(cacheKey, source)
const allSources: Store<ProvidedImage[]>[] = []
for (const imageProvider of AllImageProviders.ImageAttributionSource) {
let prefixes = imageProvider.defaultKeyPrefixes
if (tagKey !== undefined) {
prefixes = tagKey
}
const singleSource = imageProvider.GetRelevantUrls(tags, {
prefixes: prefixes,
/*
By default, 'GetRelevantUrls' uses the defaultKeyPrefixes.
However, we override them if a custom image tag is set, e.g. 'image:menu'
*/
prefixes: tagKey ?? imageProvider.defaultKeyPrefixes,
})
allSources.push(singleSource)
singleSource.addCallbackAndRunD((_) => {