A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
TypeScript amazon-primeelectronepic-games-launcherepic-games-storeepic-storegaminggoggog-galaxyheroic-games-launcherlinuxplay-gamesprotonsteamwine
[Feat] Hide Steam soundtracks and Removed games from the library and search (#6140)
Drackrathccfaa009c7f6
diff --git a/public/locales/en/gamepage.json b/public/locales/en/gamepage.jsonindex b1f82b6c6..e0ef87ae3 100644--- a/public/locales/en/gamepage.json+++ b/public/locales/en/gamepage.json@@ -47,7 +47,7 @@"stopDeleteFiles": "Stop and delete files","stopKeepFiles": "Stop and keep files","title": "Stop installing?",- "titleQueued": "Remove from queue"+ "titleQueued": "Remove from queue"},"sync": {"force_download_warning": "Local saves will be erased. Do you want to proceed?",@@ -371,6 +371,7 @@"recommended": "Recommended"},"status": {+ "delisted": "Delisted","downloading": "Downloading","extracting": "Extracting","gameNotAvailable": "Game not available",@@ -390,10 +391,12 @@"processing": "Processing files, please wait","queued": "Queued","redist": "Installing Redistributables ({{redist}})",+ "removed": "Removed","reparing": "Repairing Game, please wait","syncingSaves": "Syncing Saves","this-game-uses-third-party": "This game uses third party launcher and it is not supported yet","totalDownloaded": "Total Downloaded",+ "unavailable": "Not available","uninstalling": "Uninstalling","updating": "Updating Game","winetricks": "Applying Winetricks fixes"@@ -412,6 +415,13 @@"title": "Steam account not logged in to Heroic"}},+ "store_status_warning": {+ "agree": "I Agree",+ "cancel": "Cancel",+ "delisted": "{{title}} has been delisted from Steam.\n\nIt should still run, but it may not get updates anymore.",+ "removed": "{{title}} has been removed from Steam.\n\nOnline features may not work, and the game itself may not run.",+ "title": "Attention"+ },"submenu": {"addShortcut": "Add shortcut","addToSteam": "Add to Steam",diff --git a/public/locales/en/translation.json b/public/locales/en/translation.jsonindex 322b016fb..60d547647 100644--- a/public/locales/en/translation.json+++ b/public/locales/en/translation.json@@ -1198,7 +1198,6 @@"backups-summary": "{{changed}} changed, {{deleted}} deleted","backupSaves": "Back up saves on every sync","backupSaves-description": "Store a backup of changed save files on every sync",- "backupSize": "{{size}} GB","before-launch-script-path": "Select a script to run before the game is launched","change-target-exe": "Select an alternative EXE to run","checkForUpdatesOnStartup": "Check for Heroic updates on startup",diff --git a/src/backend/storeManagers/steam/__tests__/library.test.ts b/src/backend/storeManagers/steam/__tests__/library.test.tsindex e8a61214f..c2339a0b3 100644--- a/src/backend/storeManagers/steam/__tests__/library.test.ts+++ b/src/backend/storeManagers/steam/__tests__/library.test.ts@@ -45,6 +45,7 @@ jest.mock('../utils', () => ({currentOsList: 'linux',describeError: String,installedPlatformFor: jest.fn(),+ isLibraryApp: (game: { type?: string | null }) => game.type !== 'Soundtrack',isSteamSupported: () => true,platformArgs: jest.fn(),steamCall: <T>(task: () => Promise<T>) => task(),@@ -192,6 +193,41 @@ describe('SteamLibraryManager.refresh', () => {expect(mockNotifyRecent).toHaveBeenCalled()})+ it('leaves soundtracks out of the library', async () => {+ mockLoggedIn.mockReturnValue(true)+ mockOnline.mockReturnValue(true)+ jest.mocked(runAurelia).mockResolvedValue([+ { app_id: 1501750, name: 'Lords of the Fallen', type: 'Game' },+ {+ app_id: 2387900,+ name: 'Lords of the Fallen Soundtrack',+ type: 'Soundtrack',+ is_installed: true,+ install_path: '/lib/steamapps/music/Lords of the Fallen - Soundtrack'+ }+ ])+ await new SteamLibraryManager().refresh()+ const [, games] = mockLibrarySet.mock.calls[0] as [string, GameInfo[]]+ expect(games.map((g) => g.app_name)).toEqual(['1501750'])+ })++ it('flags removed and delisted games', async () => {+ mockLoggedIn.mockReturnValue(true)+ mockOnline.mockReturnValue(true)+ jest.mocked(runAurelia).mockResolvedValue([+ { app_id: 227700, name: 'Firefall', type: 'Delisted' },+ { app_id: 12345, name: 'Gone Game', type: 'Removed' },+ { app_id: 1501750, name: 'Lords of the Fallen', type: 'Game' }+ ])+ await new SteamLibraryManager().refresh()+ const [, games] = mockLibrarySet.mock.calls[0] as [string, GameInfo[]]+ expect(games.map((g) => [g.app_name, g.storeStatus])).toEqual([+ ['227700', 'delisted'],+ ['12345', 'removed'],+ ['1501750', undefined]+ ])+ })+it('reports an error when the list is not an array', async () => {mockLoggedIn.mockReturnValue(true)mockOnline.mockReturnValue(true)diff --git a/src/backend/storeManagers/steam/__tests__/library_app.test.ts b/src/backend/storeManagers/steam/__tests__/library_app.test.tsnew file mode 100644index 000000000..c27d8c5c4--- /dev/null+++ b/src/backend/storeManagers/steam/__tests__/library_app.test.ts@@ -0,0 +1,40 @@+import { isLibraryApp } from '../utils'++jest.mock('backend/launcher', () => ({ callRunner: jest.fn() }))+jest.mock('backend/utils', () => ({+ getAureliaBin: jest.fn(() => ({ dir: '', bin: 'aurelia' }))+}))+jest.mock('backend/logger', () => ({+ logError: jest.fn(),+ logInfo: jest.fn(),+ logWarning: jest.fn(),+ LogPrefix: { Steam: 'Steam' }+}))+jest.mock('backend/constants/paths', () => ({ appFolder: '/tmp/heroic' }))+jest.mock('backend/ipc', () => ({ sendFrontendMessage: jest.fn() }))+jest.mock('backend/dialog/dialog', () => ({+ showDialogBoxModalAuto: jest.fn()+}))++describe('isLibraryApp', () => {+ it('hides soundtracks', () => {+ expect(isLibraryApp({ type: 'Soundtrack' })).toBe(false)+ })++ it('hides betas and playtests', () => {+ expect(isLibraryApp({ type: 'Beta' })).toBe(false)+ })++ it('keeps removed and delisted games', () => {+ expect(isLibraryApp({ type: 'Removed' })).toBe(true)+ expect(isLibraryApp({ type: 'Delisted' })).toBe(true)+ })++ it('keeps games and apps without a type', () => {+ expect(isLibraryApp({ type: 'Game' })).toBe(true)+ expect(isLibraryApp({ type: 'Advertising' })).toBe(true)+ // Aurelia before 0.3.3, or unknown+ expect(isLibraryApp({})).toBe(true)+ expect(isLibraryApp({ type: null })).toBe(true)+ })+})diff --git a/src/backend/storeManagers/steam/aurelia_types.ts b/src/backend/storeManagers/steam/aurelia_types.tsindex a40023d11..2d62e0efe 100644--- a/src/backend/storeManagers/steam/aurelia_types.ts+++ b/src/backend/storeManagers/steam/aurelia_types.ts@@ -57,6 +57,8 @@ export interface AureliaLibraryGame {platform?: string// Installed bytes, Aurelia 0.3+size_on_disk?: number | null+ // Store type, or "Removed"/"Delisted"+ type?: string | null}interface AureliaDlcEntry {diff --git a/src/backend/storeManagers/steam/library.ts b/src/backend/storeManagers/steam/library.tsindex 5396d419f..4919c0272 100644--- a/src/backend/storeManagers/steam/library.ts+++ b/src/backend/storeManagers/steam/library.ts@@ -38,6 +38,7 @@ import {currentOsList,describeError,installedPlatformFor,+ isLibraryApp,isSteamSupported,platformArgs,steamCall,@@ -147,6 +148,7 @@ export default class SteamLibraryManager implements LibraryManager {skipped++continue}+ if (!isLibraryApp(game)) continueconst appId = String(game.app_id)const info = this.steamToUnifiedInfo(game)@@ -156,6 +158,12 @@ export default class SteamLibraryManager implements LibraryManager {info.isFamilyShare = true}+ if (game.type === 'Removed') {+ info.storeStatus = 'removed'+ } else if (game.type === 'Delisted') {+ info.storeStatus = 'delisted'+ }+if (game.is_installed && game.install_path) {const installed = this.toInstalledInfo(appId, game)info.is_installed = true@@ -382,7 +390,7 @@ export default class SteamLibraryManager implements LibraryManager {'--check-updates'])const updates = games- .filter((game) => game.update_available)+ .filter((game) => isLibraryApp(game) && game.update_available).map((game) => String(game.app_id))if (updates.length) {logInfo(diff --git a/src/backend/storeManagers/steam/utils.ts b/src/backend/storeManagers/steam/utils.tsindex 64210d203..795f43637 100644--- a/src/backend/storeManagers/steam/utils.ts+++ b/src/backend/storeManagers/steam/utils.ts@@ -3,6 +3,7 @@ import { logError, logWarning, LogPrefix } from 'backend/logger'import { isFlatpak, isMac, isWindows } from 'backend/constants/environment'import type { InstallPlatform } from 'common/types'import type { SteamDataKind } from 'common/types/steam'+import type { AureliaLibraryGame } from './aurelia_types'import { sendFrontendMessage } from 'backend/ipc'import { showDialogBoxModalAuto } from 'backend/dialog/dialog'import { t } from 'i18next'@@ -89,6 +90,14 @@ export function platformArgs(platform: string): string[] {return mapped ? ['-p', mapped] : []}+/** Apps shown in the library and search. */+export function isLibraryApp(game: Pick<AureliaLibraryGame, 'type'>): boolean {+ // Soundtracks aren't games+ if (game.type === 'Soundtrack') return false+ // Betas may be unowned+ return game.type !== 'Beta'+}+/*** Normalises a chosen install path to the Steam **library root***/diff --git a/src/common/types.ts b/src/common/types.tsindex 33dca65d9..d7c9074f2 100644--- a/src/common/types.ts+++ b/src/common/types.ts@@ -255,6 +255,8 @@ export interface GameInfo {is_linux_native?: boolean// True for Steam games that come from a Steam Family member's libraryisFamilyShare?: boolean+ // Steam game pulled from the store+ storeStatus?: 'removed' | 'delisted'browserUrl?: stringdescription?: string//used for store release versions. if remote !== local, then updatediff --git a/src/frontend/App.tsx b/src/frontend/App.tsxindex 617cf43bb..fd633dffd 100644--- a/src/frontend/App.tsx+++ b/src/frontend/App.tsx@@ -20,6 +20,7 @@ import LogFileUploadDialog from './components/UI/LogFileUploadDialog'import UploadedLogFilesList from './screens/Settings/sections/LogSettings/components/UploadedLogFilesList'import { TourProvider } from './state/TourContext'import { InstallGameWrapper } from './screens/Library/components/InstallModal'+import StoreStatusWarning from './components/UI/StoreStatusWarning'import { SettingsModalWrapper } from './screens/Settings/components/SettingsModal'import AnalyticsDialog from './screens/Settings/components/AnalyticsDialog'import ConsoleComboListener from './screens/ConsoleMode/components/ConsoleComboListener'@@ -90,6 +91,7 @@ function Root() {console UI too, e.g. launch-option pickers and errors */}<DialogHandler /><InstallGameWrapper />+ <StoreStatusWarning /><SettingsModalWrapper /><ExternalLinkDialog /><LogFileUploadDialog />@@ -108,6 +110,7 @@ function Root() {<main className="content"><DialogHandler /><InstallGameWrapper />+ <StoreStatusWarning /><SettingsModalWrapper /><ExternalLinkDialog /><LogFileUploadDialog />diff --git a/src/frontend/components/UI/StoreStatusWarning/index.css b/src/frontend/components/UI/StoreStatusWarning/index.cssnew file mode 100644index 000000000..3e0761d1d--- /dev/null+++ b/src/frontend/components/UI/StoreStatusWarning/index.css@@ -0,0 +1,3 @@+.storeStatusWarning__text {+ white-space: pre-line;+}diff --git a/src/frontend/components/UI/StoreStatusWarning/index.tsx b/src/frontend/components/UI/StoreStatusWarning/index.tsxnew file mode 100644index 000000000..764e68b6f--- /dev/null+++ b/src/frontend/components/UI/StoreStatusWarning/index.tsx@@ -0,0 +1,60 @@+import { useTranslation } from 'react-i18next'+import Button from 'frontend/components/UI/Button'+import {+ Modal,+ ModalContent,+ ModalFooter,+ ModalHeader+} from 'frontend/components/UI/Modal'+import {+ closeStoreStatusWarning,+ useStoreStatusWarning+} from 'frontend/state/StoreStatusWarning'+import './index.css'++/**+ * Warning before using abandoned games+ */+export default function StoreStatusWarning() {+ const { t } = useTranslation('gamepage')+ const gameInfo = useStoreStatusWarning((state) => state.gameInfo)++ if (!gameInfo) return null++ const text =+ gameInfo.storeStatus === 'removed'+ ? t(+ 'store_status_warning.removed',+ '{{title}} has been removed from Steam.\n\nOnline features may not work, and the game itself may not run.',+ { title: gameInfo.title }+ )+ : t(+ 'store_status_warning.delisted',+ '{{title}} has been delisted from Steam.\n\nIt should still run, but it may not get updates anymore.',+ { title: gameInfo.title }+ )++ return (+ <Modal+ key={`${gameInfo.runner}_${gameInfo.app_name}`}+ size="sm"+ onClose={() => closeStoreStatusWarning(false)}+ >+ <ModalHeader>{t('store_status_warning.title', 'Attention')}</ModalHeader>+ <ModalContent>+ <p className="storeStatusWarning__text">{text}</p>+ </ModalContent>+ <ModalFooter>+ <Button+ variant="secondary"+ onClick={() => closeStoreStatusWarning(false)}+ >+ {t('store_status_warning.cancel', 'Cancel')}+ </Button>+ <Button variant="primary" onClick={() => closeStoreStatusWarning(true)}>+ {t('store_status_warning.agree', 'I Agree')}+ </Button>+ </ModalFooter>+ </Modal>+ )+}diff --git a/src/frontend/helpers/library.ts b/src/frontend/helpers/library.tsindex 38b08b36f..6e456a3d0 100644--- a/src/frontend/helpers/library.ts+++ b/src/frontend/helpers/library.ts@@ -11,6 +11,7 @@ import {import { TFunction } from 'i18next'import { getGameInfo } from './index'import { DialogModalOptions } from 'frontend/types'+import { confirmStoreStatus } from 'frontend/state/StoreStatusWarning'import { openStopInstallationDialog } from './stopInstallation'const storage: Storage = window.localStorage@@ -71,6 +72,8 @@ async function install({return}+ if (!(await confirmStoreStatus(gameInfo))) return+if (installPath !== 'default') {if (setInstallPath) setInstallPath(installPath)}@@ -148,6 +151,14 @@ const launch = async ({status: 'done' | 'error' | 'abort'error?: string}> => {+ // Only Steam reports store status+ if (+ runner === 'steam' &&+ !(await confirmStoreStatus(await getGameInfo(appName, runner)))+ ) {+ return { status: 'abort' }+ }+const proceedToLaunch = async () => {// First handle update dialog if neededif (hasUpdate) {diff --git a/src/frontend/screens/Library/components/GameCard/index.css b/src/frontend/screens/Library/components/GameCard/index.cssindex 1363a71c8..0828beb0e 100644--- a/src/frontend/screens/Library/components/GameCard/index.css+++ b/src/frontend/screens/Library/components/GameCard/index.css@@ -86,10 +86,32 @@text-overflow: ellipsis;}-.gameCard:has(> .gameCardStatus) .StoreBadge {+.gameCard:has(> .gameCardStatus:not(.gameCardStatus--store)) .StoreBadge {display: none;}+/* Make room for the store icon */+.gameCard > .gameCardStatus--store {+ transition: transform 180ms ease;+}++.gameCardWrapper:hover .gameCard > .gameCardStatus--store,+.gameCard:focus-within > .gameCardStatus--store {+ transform: translateX(calc(-32px - var(--space-xs-fixed)));+}++@media (hover: none) {+ .gameCard > .gameCardStatus--store {+ transform: translateX(calc(-32px - var(--space-xs-fixed)));+ }+}++@media (prefers-reduced-motion: reduce) {+ .gameCard > .gameCardStatus--store {+ transition: none;+ }+}+.gameCardStatus--pending::after {content: '...' / '';display: inline-block;@@ -134,11 +156,6 @@display: none;}-.gameCard.notAvailable > .gameCardStatus {- color: var(--text-log);- text-align: end;-}-.gameCard > a {overflow: hidden;}diff --git a/src/frontend/screens/Library/components/GameCard/index.tsx b/src/frontend/screens/Library/components/GameCard/index.tsxindex 133ed8ad4..c28af3b7b 100644--- a/src/frontend/screens/Library/components/GameCard/index.tsx+++ b/src/frontend/screens/Library/components/GameCard/index.tsx@@ -301,8 +301,16 @@ const GameCard = ({<GameActionButtoniconOnly={grid}action={notAvailable ? 'unavailable' : 'play'}- label={t('button.play', 'Play')}- title={`${t('label.playing.start')} (${title})`}+ label={+ notAvailable+ ? t('status.unavailable', 'Not available')+ : t('button.play', 'Play')+ }+ title={+ notAvailable+ ? t('status.unavailable', 'Not available')+ : `${t('label.playing.start')} (${title})`+ }disabled={disabled}onClick={() => handlePlay(runner)}/>@@ -517,7 +525,7 @@ const GameCard = ({data-app-name={appName}data-tour={dataTour}>- {haveStatus && (+ {haveStatus && !notAvailable ? (<Badgevariant="success"onOverlay@@ -527,6 +535,18 @@ const GameCard = ({>{label}</Badge>+ ) : (+ gameInfo.storeStatus && (+ <Badge+ variant="warning"+ onOverlay+ className="gameCardStatus gameCardStatus--store"+ >+ {gameInfo.storeStatus === 'removed'+ ? t('status.removed', 'Removed')+ : t('status.delisted', 'Delisted')}+ </Badge>+ ))}<Linkto={`/gamepage/${runner}/${appName}`}diff --git a/src/frontend/screens/Settings/sections/LogSettings/index.tsx b/src/frontend/screens/Settings/sections/LogSettings/index.tsxindex 282ff8194..75bf6484b 100644--- a/src/frontend/screens/Settings/sections/LogSettings/index.tsx+++ b/src/frontend/screens/Settings/sections/LogSettings/index.tsx@@ -246,7 +246,7 @@ export default function LogSettings() {baseFiles.push({ title: 'itch.io', args: { runner: 'itchio' } })}if (steam.enabled) {- baseFiles.push({ title: 'Aurelia', args: { runner: 'steam' } })+ baseFiles.push({ title: 'Steam/Aurelia', args: { runner: 'steam' } })}const logsForInstalledGames = installedGames.map((game) => ({title: game.overrides?.title || game.title,diff --git a/src/frontend/state/InstallGameModal.ts b/src/frontend/state/InstallGameModal.tsindex 16432cd89..4c00c6137 100644--- a/src/frontend/state/InstallGameModal.ts+++ b/src/frontend/state/InstallGameModal.ts@@ -1,5 +1,6 @@import { GameInfo, Runner } from 'common/types'import { create } from 'zustand'+import { confirmStoreStatus } from './StoreStatusWarning'interface InstallGameModalState {isOpen: boolean@@ -21,12 +22,14 @@ interface OpenInstallGameModalParams {gameInfo: GameInfo | nullaction?: 'install' | 'import'}-export const openInstallGameModal = ({+export const openInstallGameModal = async ({appName,runner,gameInfo,action = 'install'}: OpenInstallGameModalParams) => {+ // Imports skip the abandoned warning+ if (action === 'install' && !(await confirmStoreStatus(gameInfo))) returnuseInstallGameModal.setState({isOpen: true,appName,diff --git a/src/frontend/state/StoreStatusWarning.ts b/src/frontend/state/StoreStatusWarning.tsnew file mode 100644index 000000000..473f3e314--- /dev/null+++ b/src/frontend/state/StoreStatusWarning.ts@@ -0,0 +1,41 @@+import { GameInfo } from 'common/types'+import { create } from 'zustand'++interface StoreStatusWarningState {+ gameInfo: GameInfo | null+ resolve: ((proceed: boolean) => void) | null+}++export const useStoreStatusWarning = create<StoreStatusWarningState>()(() => ({+ gameInfo: null,+ resolve: null+}))++// Acknowledged games, this session+const acknowledged = new Set<string>()++/**+ * Warns once before using abandoned games+ */+export async function confirmStoreStatus(+ gameInfo: GameInfo | null | undefined+): Promise<boolean> {+ if (!gameInfo?.storeStatus) return true+ const key = `${gameInfo.runner}_${gameInfo.app_name}`+ if (acknowledged.has(key)) return true++ // Settle any already open warning+ useStoreStatusWarning.getState().resolve?.(false)++ const proceed = await new Promise<boolean>((resolve) =>+ useStoreStatusWarning.setState({ gameInfo, resolve })+ )+ if (proceed) acknowledged.add(key)+ return proceed+}++export function closeStoreStatusWarning(proceed: boolean) {+ const { resolve } = useStoreStatusWarning.getState()+ useStoreStatusWarning.setState({ gameInfo: null, resolve: null })+ resolve?.(proceed)+}diff --git a/src/frontend/state/__tests__/StoreStatusWarning.test.ts b/src/frontend/state/__tests__/StoreStatusWarning.test.tsnew file mode 100644index 000000000..9e3d69d89--- /dev/null+++ b/src/frontend/state/__tests__/StoreStatusWarning.test.ts@@ -0,0 +1,63 @@+import { GameInfo } from 'common/types'+import {+ closeStoreStatusWarning,+ confirmStoreStatus,+ useStoreStatusWarning+} from '../StoreStatusWarning'++const game = (+ app_name: string,+ storeStatus?: GameInfo['storeStatus']+): GameInfo =>+ ({ app_name, runner: 'steam', title: app_name, storeStatus }) as GameInfo++const shownGame = () => useStoreStatusWarning.getState().gameInfo?.app_name++describe('confirmStoreStatus', () => {+ afterEach(() => closeStoreStatusWarning(false))++ it('skips the warning for games still on the store', async () => {+ await expect(confirmStoreStatus(game('available'))).resolves.toBe(true)+ await expect(confirmStoreStatus(undefined)).resolves.toBe(true)+ expect(shownGame()).toBeUndefined()+ })++ it('proceeds on agree and remembers the game', async () => {+ const pending = confirmStoreStatus(game('agreed', 'removed'))+ expect(shownGame()).toBe('agreed')++ closeStoreStatusWarning(true)+ await expect(pending).resolves.toBe(true)+ expect(shownGame()).toBeUndefined()++ // Acknowledged once per session+ await expect(confirmStoreStatus(game('agreed', 'removed'))).resolves.toBe(+ true+ )+ expect(shownGame()).toBeUndefined()+ })++ it('stops on cancel and asks again next time', async () => {+ const pending = confirmStoreStatus(game('cancelled', 'delisted'))+ closeStoreStatusWarning(false)+ await expect(pending).resolves.toBe(false)++ void confirmStoreStatus(game('cancelled', 'delisted'))+ expect(shownGame()).toBe('cancelled')+ })++ it('cancels the open warning when another game asks', async () => {+ const first = confirmStoreStatus(game('first', 'removed'))+ const second = confirmStoreStatus(game('second', 'delisted'))++ await expect(first).resolves.toBe(false)+ expect(shownGame()).toBe('second')++ closeStoreStatusWarning(true)+ await expect(second).resolves.toBe(true)++ // First game was never acknowledged+ void confirmStoreStatus(game('first', 'removed'))+ expect(shownGame()).toBe('first')+ })+})