Skip to content

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.

614 B
Raw Blame
interface ThumbnailCandidate {
  src: string
  thumbnail?: string
}

/**
 * Picks what a carousel thumbnail should render.
 *
 * Stores are inconsistent about thumbnails: some send none, some send URLs
 * that no longer resolve. In both cases the full screenshot is a better
 * fallback than the launcher logo, so only a broken full screenshot ends up
 * in the placeholder.
 */
export function resolveThumbnailSource(
  image: ThumbnailCandidate,
  failedSources: ReadonlySet<string>
): string {
  if (image.thumbnail && !failedSources.has(image.thumbnail)) {
    return image.thumbnail
  }

  return image.src
}