This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+81
View File
@@ -0,0 +1,81 @@
// Metro module 5907 (f5908).
import GameStore from "./GameStore";
import { Endpoints } from "../../Constants";
import { HTTP } from "../../_bundle/sendRequest";
import Dispatcher from "../../Dispatcher";
import { BatchInvocationManager } from "../../_bundle/Timeout";
import Module12 from "../../_bundle/Module12";
let c3699_8;
let c3700_0;
let env3699 = {};
const requestGames = async function requestGames(game_ids) {
let c25642_3 = 0;
let c29634_0, c29634_1;
L10: {
try {
c29634_0 = game_ids;
c29634_1 = void 0;
c25642_3 = 1;
c29634_1 = (await HTTP.get({
url: Endpoints.GAMES,
query: {
game_ids
},
rejectWithError: true
})).body;
Dispatcher.dispatch({
type: "GAME_FETCH_SUCCESS",
gameIds: c29634_0,
games: c29634_1
});
c25642_3 = 0;
} catch ($e) {
let r23 = $e;
if (c25642_3 !== 0) {
while (true) {
try {
c25642_3 = 0;
Dispatcher.dispatch({
type: "GAME_FETCH_FAILURE",
gameIds: c29634_0
});
break L10;
} catch ($e) {
r23 = $e;
if (c25642_3 === 0) {
break;
}
}
}
}
throw r23;
}
}
};
c3700_0 = void 0;
c3700_0 = async (c25644_0) => {
await Promise.all(Module12.chunk(c25644_0, 20).map(requestGames));
};
c3699_8 = new BatchInvocationManager(function() {
const apply = c3700_0.apply;
return c3700_0.apply(this, arguments);
}, {
predicate: (a0) => !GameStore.hasNoData(a0),
onQueued: (a0) => Dispatcher.dispatch({
type: "GAME_FETCH",
gameIds: a0
}),
onCancelled: (a0) => Dispatcher.dispatch({
type: "GAME_FETCH_CANCELLED",
gameIds: a0
})
});
export async function fetchGamesWithSupplementalData(c25643_0) {
L11: {
if (c25643_0.length !== 0) {
await c3699_8.queue(c25643_0);
break L11;
}
return void 0;
}
}
+163
View File
@@ -0,0 +1,163 @@
// Metro module 4211 (f4212).
import Record from "../../lib/Record";
import ApplicationRecord, { createExecutable } from "../../records/ApplicationRecord";
import { GameLinkTypes } from "../../flow/Server";
import getGameMediaRefURL from "./getGameMediaRefURL";
import { SUPPORTS_WEBP } from "../../utils/AvatarUtils";
import { isNotNullish } from "../../utils/GlobalUtils";
class GameRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.name = a0.name;
this.description = a0.description;
let aliases = a0.aliases;
if (aliases == null) {
aliases = [];
}
this.aliases = aliases;
let executables = a0.executables;
if (executables == null) {
executables = [];
}
this.executables = executables.map(createExecutable);
let overlay = a0.overlay;
if (overlay == null) {
overlay = false;
}
this.overlay = overlay;
let overlay_warn = a0.overlay_warn;
if (overlay_warn == null) {
overlay_warn = false;
}
this.overlayWarn = overlay_warn;
let overlay_compatibility_hook = a0.overlay_compatibility_hook;
if (overlay_compatibility_hook == null) {
overlay_compatibility_hook = false;
}
this.overlayCompatibilityHook = overlay_compatibility_hook;
let hook = a0.hook;
if (hook == null) {
hook = true;
}
this.hook = hook;
this.supportsOutOfProcessOverlay = ApplicationRecord.supportsOutOfProcessOverlay(a0.overlay_methods);
let third_party_skus = a0.third_party_skus;
if (third_party_skus == null) {
third_party_skus = [];
}
this.thirdPartySkus = third_party_skus;
let themes = a0.themes;
if (themes == null) {
themes = [];
}
this.themes = themes;
this.linkedApplications = a0.linked_applications;
let genres = a0.genres;
if (genres == null) {
genres = [];
}
this.genres = genres;
let platforms = a0.platforms;
if (platforms == null) {
platforms = [];
}
this.platforms = platforms;
let websites = a0.websites;
if (websites == null) {
websites = [];
}
this.websites = websites;
this.companies = a0.companies;
this.screenshotHashes = a0.screenshot_hashes;
this.screenshotUrls = a0.screenshot_urls;
this.trailers = a0.trailers;
this.l30Rank = a0.l30_rank;
this.summaryLocalized = a0.summary_localized;
this.media = a0.media;
this.firstReleaseDate = a0.first_release_date;
this.shopCollectionIds = a0.shop_collection_ids;
this.steamReleaseStatus = a0.steam_release_status;
const reviews = a0.reviews;
this.reviews = reviews?.steam == null ? reviews?.opencritic != null ? {
steam: reviews.steam != null ? {
rating: reviews.steam.rating,
ratingCount: reviews.steam.rating_count,
recentRating: reviews.steam.recent_rating,
recentRatingCount: reviews.steam.recent_rating_count,
localizedRating: reviews.steam.localized_rating,
localizedRatingCount: reviews.steam.localized_rating_count
} : void 0,
opencritic: reviews.opencritic != null ? {
topCriticRating: reviews.opencritic.top_critic_rating,
topCriticRatingCount: reviews.opencritic.top_critic_rating_count,
tier: reviews.opencritic.tier
} : void 0
} : void 0 : {
steam: reviews.steam != null ? {
rating: reviews.steam.rating,
ratingCount: reviews.steam.rating_count,
recentRating: reviews.steam.recent_rating,
recentRatingCount: reviews.steam.recent_rating_count,
localizedRating: reviews.steam.localized_rating,
localizedRatingCount: reviews.steam.localized_rating_count
} : void 0,
opencritic: reviews.opencritic != null ? {
topCriticRating: reviews.opencritic.top_critic_rating,
topCriticRatingCount: reviews.opencritic.top_critic_rating_count,
tier: reviews.opencritic.tier
} : void 0
};
this.opencriticUrl = a0.opencritic_url;
let game_flags = a0.game_flags;
if (game_flags == null) {
game_flags = 0;
}
this.gameFlags = game_flags;
this.contentClassification = a0.content_classification;
}
get applicationId() {
return this.id;
}
getOfficialApplicationId() {
const linkedApplications = this.linkedApplications;
return linkedApplications == null ? void 0 : linkedApplications.find((linkedApplication) => linkedApplication.type === GameLinkTypes.OFFICIAL)?.id;
}
getIconURL(a0, a1) {
return getGameMediaRefURL(this.id, this.media?.icon, {
size: a0,
format: a1
});
}
getBannerURL(a0) {
return getGameMediaRefURL(this.id, this.media?.banner, {
keepAspectRatio: true,
size: a0
});
}
getCoverURL(a0) {
return getGameMediaRefURL(this.id, this.media?.cover, {
keepAspectRatio: true,
format: SUPPORTS_WEBP ? "webp" : "png",
size: a0
});
}
getArtworkURLs() {
let r6 = this.media?.artwork;
if (r6 == null) {
r6 = [];
}
return r6.map((item) => getGameMediaRefURL(this.id, item, {
keepAspectRatio: true
})).filter(isNotNullish);
}
getCompanyByRole(c13990_0) {
const companies = this.companies;
let r7 = companies == null ? void 0 : companies.filter((company) => company.roles.includes(c13990_0));
if (r7 == null) {
r7 = [];
}
return r7;
}
}
export default GameRecord;
+82
View File
@@ -0,0 +1,82 @@
// Metro module 4210 (f4211).
import GameRecord from "./GameRecord";
import Module589 from "../../_bundle/Module589";
import URLUtils from "../../utils/URLUtils";
import Dispatcher from "../../Dispatcher";
let c2430_3 = new Map();
let c2430_4 = new Set();
let c2430_5 = new Set();
let c2430_6 = new Set();
class GameStore extends Module589.Store {
static displayName = "NewGameStore";
isFetching(a0) {
return c2430_4.has(a0);
}
didFetchingFail(a0) {
return c2430_5.has(a0);
}
getGame(a0) {
return c2430_3.get(a0);
}
hasNoData(a0) {
return c2430_6.has(a0);
}
getCoverImageUrl(a0, a1) {
const r10 = c2430_3.get(a0);
const r11 = r10 == null ? void 0 : r10.getCoverURL();
if (r11 == null) {
return null;
}
if (a1 == null) {
return r11;
}
const r19 = URLUtils.toURLSafe(r11);
let r20 = r11;
if (r19 != null) {
r19.searchParams.set("size", a1.size.toString());
r20 = r19.toString();
}
return r20;
}
}
const gameStore = new GameStore(Dispatcher, {
LOGOUT: function handleLogout() {
c2430_3 = new Map();
c2430_4 = new Set();
c2430_5 = new Set();
c2430_6 = new Set();
},
GAME_FETCH: function handleFetch(a0) {
a0.gameIds.forEach((gameId) => {
c2430_4.add(gameId);
c2430_5.delete(gameId);
});
},
GAME_FETCH_CANCELLED: function handleFetchCancelled(a0) {
a0.gameIds.forEach((gameId) => c2430_4.delete(gameId));
},
GAME_FETCH_SUCCESS: function handleFetchSuccess({ gameIds, games }) {
const set = new Set(gameIds);
let c13988_0 = set;
gameIds.forEach((gameId) => {
c2430_4.delete(gameId);
c2430_5.delete(gameId);
});
games.forEach((game) => {
c13988_0.delete(game.id);
c2430_3.set(game.id, new GameRecord(game));
});
set.forEach((item) => {
if (!c2430_3.has(item)) {
c2430_6.add(item);
}
});
},
GAME_FETCH_FAILURE: function handleFetchFailure(a0) {
a0.gameIds.forEach((gameId) => {
c2430_4.delete(gameId);
c2430_5.add(gameId);
});
}
});
export default gameStore;
@@ -0,0 +1,87 @@
// Metro module 6171 (f6172).
import GameAutocompleteStore from "./GameAutocompleteStore";
import { Endpoints } from "../../../Constants";
import { normalizeGameAutocompleteQuery } from "./GameAutocompleteUtils";
import Dispatcher from "../../../Dispatcher";
import { HTTP } from "../../../_bundle/sendRequest";
export async function fetchGameAutocomplete(c25741_0) {
let body, c25741_2, c25741_3, c25741_4;
let c25741_5 = 0;
const r11 = void 0;
L17: {
try {
let env29682;
c25741_3 = r11;
const r29 = env29682 = {};
c25741_2 = r29;
env29682[0] = void 0;
env29682[1] = void 0;
const query = normalizeGameAutocompleteQuery(c25741_0);
env29682[0] = query;
if (query == null) {
break L17;
}
if (GameAutocompleteStore.shouldSuppressFetch(query)) {
Dispatcher.dispatch({
type: "GAME_AUTOCOMPLETE_FETCH_SUCCESS",
query,
results: []
});
break L17;
}
Dispatcher.dispatch({
type: "GAME_AUTOCOMPLETE_FETCH",
query
});
c25741_5 = 1;
const body2 = (await HTTP.get({
url: Endpoints.GAMES_AUTOCOMPLETE,
query: {
q: query
},
rejectWithError: false
})).body;
body = body2;
if (body2 == null) {
body = [];
}
env29682[1] = body.map((item) => ({
id: String(item.id),
name: item.name,
icon: item.icon
}));
Dispatcher.dispatch({
type: "GAME_AUTOCOMPLETE_FETCH_SUCCESS",
query: env29682[0],
results: env29682[1]
});
c25741_5 = 0;
} catch ($e) {
const r27 = $e;
let r8 = r27;
c25741_4 = r27;
if (c25741_5 !== 0) {
while (true) {
try {
const r96 = c25741_4;
c25741_5 = 0;
env29682[2] = r96;
Dispatcher.dispatch({
type: "GAME_AUTOCOMPLETE_FETCH_FAILURE",
query: env29682[0]
});
throw env29682[2];
} catch (r92) {
r8 = r92;
c25741_4 = r92;
if (c25741_5 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
}
@@ -0,0 +1,74 @@
// Metro module 6160 (f6161).
import LRUCache from "../../../_bundle/LRUCache";
import Module589 from "../../../_bundle/Module589";
import { normalizeGameAutocompleteQuery, shouldSuppressAutocompleteFetch } from "./GameAutocompleteUtils";
import Dispatcher from "../../../Dispatcher";
let c3902_2 = new LRUCache({
max: 100
});
let c3902_3 = new Set();
let c3902_4 = new LRUCache({
max: 500
});
class GameAutocompleteStore extends Module589.Store {
static displayName = "GameAutocompleteStore";
getResults(a0) {
const r9 = normalizeGameAutocompleteQuery(a0);
return r9 == null ? void 0 : c3902_2.peek(r9);
}
getClosestResults(a0) {
const r15 = normalizeGameAutocompleteQuery(a0);
if (r15 != null) {
const r18 = c3902_2.peek(r15);
if (r18 != null) {
return r18;
}
let r0 = r15.length - 1;
while (1 <= r0) {
const r22 = c3902_2.peek(r15.slice(0, r0));
const r1 = r0;
if (r22 != null) {
return r22;
}
r0 = r1 - 1;
}
}
}
shouldSuppressFetch(a0) {
const r11 = normalizeGameAutocompleteQuery(a0);
let r12 = r11 != null;
if (r12) {
const r14 = c3902_2.has(r11);
r12 = (r14 ? !r14 : !c3902_3.has(r11)) && shouldSuppressAutocompleteFetch(r11, (a0) => c3902_2.peek(a0));
}
return r12;
}
isFetching(a0) {
const r8 = normalizeGameAutocompleteQuery(a0);
return r8 != null && c3902_3.has(r8);
}
getGameById(a0) {
return c3902_4.peek(a0);
}
}
const gameAutocompleteStore = new GameAutocompleteStore(Dispatcher, {
LOGOUT: function handleLogout() {
c3902_2.reset();
c3902_3 = new Set();
c3902_4.reset();
},
GAME_AUTOCOMPLETE_FETCH: function handleFetch(a0) {
c3902_3.add(a0.query);
},
GAME_AUTOCOMPLETE_FETCH_SUCCESS: function handleFetchSuccess({ query, results }) {
c3902_3.delete(query);
c3902_2.set(query, results);
for (const item of results) {
c3902_4.set(item.id, item);
}
},
GAME_AUTOCOMPLETE_FETCH_FAILURE: function handleFetchFailure(a0) {
c3902_3.delete(a0.query);
}
});
export default gameAutocompleteStore;
@@ -0,0 +1,26 @@
// Metro module 6161 (f6162).
import { GAME_WIDGET_BANNED_APPLICATION_IDS } from "../../../_bundle/Module5899";
export const GAME_AUTOCOMPLETE_MAX_QUERY_LENGTH = 100;
export const MIN_TRUSTED_EMPTY_PREFIX_LENGTH = 7;
export function shouldSuppressAutocompleteFetch(a0, a1) {
let r0 = a0.length - 1;
while (1 <= r0) {
const r12 = a1(a0.slice(0, r0));
const r1 = r0;
if (r12 != null) {
return !(r12.length > 0) && r1 >= 7;
}
r0 = r1 - 1;
}
return false;
}
export function normalizeGameAutocompleteQuery(a0) {
if (a0 == null) {
return null;
}
const r14 = a0.trim().toLowerCase().replaceAll("_", " ").slice(0, 100);
return r14.length > 0 ? r14 : null;
}
export function isGameAutocompleteResultAllowedInGameWidgets(a0) {
return !GAME_WIDGET_BANNED_APPLICATION_IDS.has(a0.id);
}
@@ -0,0 +1,25 @@
// Metro module 6169 (f6170).
import GameAutocompleteStore from "./GameAutocompleteStore";
import debounce from "../../../_bundle/debounce";
import { useGameAutocomplete, GAME_AUTOCOMPLETE_DEBOUNCE_MS, GAME_AUTOCOMPLETE_DEBOUNCE_MAX_WAIT_MS } from "./useGameAutocomplete";
import { normalizeGameAutocompleteQuery, isGameAutocompleteResultAllowedInGameWidgets } from "./GameAutocompleteUtils";
let c3910_3 = debounce((a0) => {
useGameAutocomplete.fetchMany([a0]);
}, GAME_AUTOCOMPLETE_DEBOUNCE_MS, {
leading: true,
maxWait: GAME_AUTOCOMPLETE_DEBOUNCE_MAX_WAIT_MS
});
export function queryGamesAutocomplete(a0) {
const r10 = normalizeGameAutocompleteQuery(a0);
const r2 = r10 == null;
let r11 = null;
if (!r2) {
c3910_3(r10);
let r16 = GameAutocompleteStore.getClosestResults(r10);
if (r16 == null) {
r16 = [];
}
r11 = r16.filter(isGameAutocompleteResultAllowedInGameWidgets);
}
return r11;
}
@@ -0,0 +1,80 @@
// Metro module 6170 (f6171).
import { useState, useRef, useEffect } from "react";
import GameAutocompleteStore from "./GameAutocompleteStore";
import { QueryIds } from "../../../Constants";
import { createFetchStore } from "../../../_bundle/Module589";
import { normalizeGameAutocompleteQuery } from "./GameAutocompleteUtils";
import { fetchGameAutocomplete } from "./GameAutocompleteActionCreators";
const fetchStore = createFetchStore(GameAutocompleteStore, {
getQueryId: (a0) => QueryIds.GAME_AUTOCOMPLETE(normalizeGameAutocompleteQuery(a0)),
get: (a0) => {
let r5 = GameAutocompleteStore.getResults(a0);
if (r5 == null) {
r5 = null;
}
return r5;
},
load: (a0) => fetchGameAutocomplete(a0),
getIsLoading: (a0) => GameAutocompleteStore.isFetching(a0),
retryConfig: {
retryableErrors: function isRetryableError({ status }) {
return status != null && (status === 429 || status >= 500 && status !== 503);
}
},
staleAfter: 3600,
failureStaleAfter: 60
});
export const GAME_AUTOCOMPLETE_DEBOUNCE_MS = 200;
export const GAME_AUTOCOMPLETE_DEBOUNCE_MAX_WAIT_MS = 500;
export { fetchStore as useGameAutocomplete };
export function useDebouncedGameAutocomplete(a0) {
const current = normalizeGameAutocompleteQuery(a0);
const [state, setState] = useState(current);
const ref = useRef(state);
const ref2 = useRef(0);
useEffect(() => {
if (current !== ref.current) {
if (current != null && ref.current != null) {
let c29681_0 = setTimeout(function emit() {
ref2.current = Date.now();
ref.current = current;
setState(current);
}, Math.min(200, Math.max(0, 500 - (Date.now() - ref2.current))));
return () => {
clearTimeout(c29681_0);
};
}
ref2.current = Date.now();
ref.current = current;
setState(current);
}
}, [current]);
const r31 = fetchStore(state);
let data = r31.data;
const error = r31.error;
let isLoading = r31.isLoading;
const [state2, setState2] = useState(null);
if (current == null) {
if (state2 != null) {
setState2(null);
}
} else if (data != null && data !== state2) {
setState2(data);
}
const r42 = current != null;
let results = null;
if (r42) {
if (data == null) {
data = state2;
}
results = data;
}
if (!isLoading) {
isLoading = state !== current;
}
return {
results,
isLoading,
error: state === current ? error : null
};
}
+33
View File
@@ -0,0 +1,33 @@
// Metro module 4219 (f4220).
import * as _StringUtils from "../../utils/StringUtils";
import AvatarUtils from "../../utils/AvatarUtils";
import { getSizedImageProxyURL } from "../image_proxy/ImageProxyUtils";
export default function getGameMediaRefURL(a0, a1, a2) {
if (a1 == null) {
return null;
}
const type = a1.type;
if (type === "hash") {
const isNullOrEmpty = _StringUtils.isNullOrEmpty(a1.value);
let r31 = null;
if (!isNullOrEmpty) {
let r40 = AvatarUtils.getGameAssetURL({
id: a0,
hash: a1.value,
...a2
});
if (r40 == null) {
r40 = null;
}
r31 = r40;
}
return r31;
}
if (type === "url") {
return getSizedImageProxyURL(a1.value, {
size: a2?.size,
keepAspectRatio: a2?.keepAspectRatio
});
}
return null;
};
+55
View File
@@ -0,0 +1,55 @@
// Metro module 5906 (f5907).
import { useEffect } from "react";
import GameStore from "../GameStore";
import { QueryIds } from "../../../Constants";
import * as _Module589 from "../../../_bundle/Module589";
import { createFetchStore } from "../../../_bundle/Module589";
import Durations from "../../../utils/Durations";
import { fetchGamesWithSupplementalData } from "../GameActionCreators";
let c3698_2, fetchStore;
const r27 = {
getQueryId: QueryIds.GAME,
failureStaleAfter: 15 * Durations.Seconds.SECOND,
get: (a0) => {
let NO_DATA;
const r1 = a0 == null;
let r2 = null;
if (!r1) {
if (GameStore.hasNoData(a0)) {
NO_DATA = _Module589.NO_DATA;
} else {
NO_DATA = GameStore.getGame(a0);
if (NO_DATA == null) {
NO_DATA = null;
}
}
r2 = NO_DATA;
}
return r2;
},
load: null,
getIsLoading: null,
getError: null
};
c3698_2 = async (c15261_0) => {
L11: {
if (c15261_0 != null) {
await fetchGamesWithSupplementalData([c15261_0]);
break L11;
}
return void 0;
}
};
r27.load = function() {
const apply = c3698_2.apply;
return c3698_2.apply(this, arguments);
};
r27.getIsLoading = (a0) => a0 != null && GameStore.isFetching(a0);
r27.getError = (a0) => a0 != null ? GameStore.didFetchingFail(a0) ? new Error("Failed to fetch game data") : null : null;
fetchStore = createFetchStore(GameStore, r27);
export { fetchStore as useGame };
export function useGames(a0) {
useEffect(() => {
fetchStore.fetchMany.apply(fetchStore, [...a0.map((item) => [item])]);
}, [a0]);
}
@@ -0,0 +1,20 @@
// Metro module 12063 (f12064).
import { useGame } from "./useGame";
import { intl, t } from "../../../intl/index.native";
export default function useGameNameAndCoverImage(a0, a1, a2) {
const game = useGame(a0);
const { data, isLoading } = game;
const coverImageUrl = data == null ? void 0 : data.getCoverURL(a2);
let gameName = data?.name;
if (gameName == null) {
gameName = a1;
}
if (gameName == null) {
gameName = intl.string(t.GIWFlF);
}
return {
coverImageUrl,
gameName,
isLoading
};
};
+25
View File
@@ -0,0 +1,25 @@
// Metro module 8479 (f8480).
import { useMemo } from "react";
import { useGetOrFetchApplication } from "../../applications/useGetOrFetchApplications";
import { useGame } from "./useGame";
export default function useResolveGame({ applicationId, gameId }) {
const getOrFetchApplication = useGetOrFetchApplication(gameId == null ? applicationId : void 0);
const memo = useMemo(() => {
let r1 = gameId;
if (gameId == null) {
r1 = getOrFetchApplication == null ? null : getOrFetchApplication.getCanonicalGameId();
}
return r1;
}, [gameId, getOrFetchApplication]);
const game = useGame(memo);
let data = game.data;
const isLoading = game.isLoading;
if (data == null) {
data = null;
}
return {
gameId: memo,
gameRecord: data,
isLoading: gameId == null && applicationId != null && getOrFetchApplication == null || isLoading
};
};