diff --git a/extensions/core-curation b/extensions/core-curation index d644aa0e3..ee2894c71 160000 --- a/extensions/core-curation +++ b/extensions/core-curation @@ -1 +1 @@ -Subproject commit d644aa0e3e36b233442de642bdd02e8fa34fd52a +Subproject commit ee2894c71aafaaa4b5b5ebd5494407bc4c391400 diff --git a/lang/en.json b/lang/en.json index 519d2eb40..ae6e0db90 100644 --- a/lang/en.json +++ b/lang/en.json @@ -34,6 +34,8 @@ "enablePlaytimeTrackingExtremeDesc": "Allow tracking last played date, total playtime and play count for Extreme games.", "enableTagFilterIndex": "Tag Filter Index", "enableTagFilterIndexDesc": "Enable use of the Tag Filter Index to speed up lots of queries", + "enableVerboseLogging": "Verbose Logging", + "enableVerboseLoggingDesc": "Enables verbose logging for external libraries.", "clearPlaytimeTracking": "Clear Playtime Data", "clearPlaytimeTrackingDesc": "Clears last played, total playtime and play count for every game. Irreversible.", "clearData": "Clear Data", diff --git a/package-lock.json b/package-lock.json index 9a4d8e13e..4dbb4f592 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@fortawesome/fontawesome-svg-core": "1.2.36", "@fortawesome/free-solid-svg-icons": "5.15.4", "@fortawesome/react-fontawesome": "0.1.18", - "@fparchive/flashpoint-archive": "0.5.0", + "@fparchive/flashpoint-archive": "0.6.2", "@types/react-virtualized": "^9.21.21", "axios": "1.3.4", "connected-react-router": "6.9.2", @@ -867,24 +867,24 @@ } }, "node_modules/@fparchive/flashpoint-archive": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive/-/flashpoint-archive-0.5.0.tgz", - "integrity": "sha512-SThyebOqG1X7FS/pkD4pg3UUznZL3+cBBKZ3O3YLaSokS12vMs+shYC9yIon9wN756Gtn57/nNk+Ip88IoW6Xg==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive/-/flashpoint-archive-0.6.2.tgz", + "integrity": "sha512-03MpHqXSpZYgrv3OkYPVrkSDYLPV9gT/2PwdDOazdSbMulcbyZIE2OuQKQgyoUpGT2MXiCs2SMMBrVyIX/SJQg==", "engines": { "node": ">= 10" }, "optionalDependencies": { - "@fparchive/flashpoint-archive-darwin-arm64": "0.5.0", - "@fparchive/flashpoint-archive-darwin-x64": "0.5.0", - "@fparchive/flashpoint-archive-linux-x64-gnu": "0.5.0", - "@fparchive/flashpoint-archive-win32-ia32-msvc": "0.5.0", - "@fparchive/flashpoint-archive-win32-x64-msvc": "0.5.0" + "@fparchive/flashpoint-archive-darwin-arm64": "0.6.2", + "@fparchive/flashpoint-archive-darwin-x64": "0.6.2", + "@fparchive/flashpoint-archive-linux-x64-gnu": "0.6.2", + "@fparchive/flashpoint-archive-win32-ia32-msvc": "0.6.2", + "@fparchive/flashpoint-archive-win32-x64-msvc": "0.6.2" } }, "node_modules/@fparchive/flashpoint-archive-darwin-arm64": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-darwin-arm64/-/flashpoint-archive-darwin-arm64-0.5.0.tgz", - "integrity": "sha512-qBgioxpbw4eCtyvXM1WXhjETdIQWWFcx7PE75KDQyqbnldicd78ZcCwbm5yKk5SDurGqu6DM6jceF69cbU7yKQ==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-darwin-arm64/-/flashpoint-archive-darwin-arm64-0.6.2.tgz", + "integrity": "sha512-fZt3+1j5AMu6wBZSySusmm+byIN+/Gx8QurcDKVzRjqn5+6NRox5gOUJwNkUzvPbwQtGkuetAkH7Ie6phUHl7Q==", "cpu": [ "arm64" ], @@ -897,9 +897,9 @@ } }, "node_modules/@fparchive/flashpoint-archive-darwin-x64": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-darwin-x64/-/flashpoint-archive-darwin-x64-0.5.0.tgz", - "integrity": "sha512-G2IWe7SQi2j05Qa2frZphvxAc1SLa43iO24Zr0QujGEI7sYKXC7RxRHLN1iEUAsJwmrLT8unPbu/c6nMkil3xw==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-darwin-x64/-/flashpoint-archive-darwin-x64-0.6.2.tgz", + "integrity": "sha512-eydbqAQGkDY62cxl7YJACTIUizr6aLYZ/Ka61HBT2p3z/oh12A1Zv1Wc5Ufmkxgelpdp4F48HOtSIsI9Fj82uQ==", "cpu": [ "x64" ], @@ -912,9 +912,9 @@ } }, "node_modules/@fparchive/flashpoint-archive-linux-x64-gnu": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-linux-x64-gnu/-/flashpoint-archive-linux-x64-gnu-0.5.0.tgz", - "integrity": "sha512-XQJUiY96hyC8LsOHsqKBFrNxQKL+xzYPi6MystUXG+Jp4/g0NCp07kFZ9vjmePwSAjLLEfdK6/DCscvgxkoL0A==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-linux-x64-gnu/-/flashpoint-archive-linux-x64-gnu-0.6.2.tgz", + "integrity": "sha512-QM5sXTWUc5lZW00odsa+kspZ5J2OMbRqq9DJf+gbwGqYD1HzvtD29jHnObCmoDCRXQKozM44AauZ6yD3zz/pag==", "cpu": [ "x64" ], @@ -927,9 +927,9 @@ } }, "node_modules/@fparchive/flashpoint-archive-win32-ia32-msvc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-win32-ia32-msvc/-/flashpoint-archive-win32-ia32-msvc-0.5.0.tgz", - "integrity": "sha512-mnZ2UFN361DHuVrNUJ2XPrfTgwsj4/UQDLHXm6olTc0/UsYqygXeAteXXl15xgiHIESbelNQyEdX760wcO1fdQ==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-win32-ia32-msvc/-/flashpoint-archive-win32-ia32-msvc-0.6.2.tgz", + "integrity": "sha512-vFndYzM1ml1DHBmgHfBu6AOOoumzXr1nOOlNJ3Zvs3N/7x8Wy4yuaOg9aBU4QzCW60KSY1sPqU8ktD04+VKbFA==", "cpu": [ "ia32" ], @@ -942,9 +942,9 @@ } }, "node_modules/@fparchive/flashpoint-archive-win32-x64-msvc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-win32-x64-msvc/-/flashpoint-archive-win32-x64-msvc-0.5.0.tgz", - "integrity": "sha512-hFyROa1sl3VtC5qbTBtj8UfeTl6h3xKTeLMj4mmZl1KZheIMc4/ilHpvxIZyDLBkIv4ARG3kOzIMYVKmcXK56g==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@fparchive/flashpoint-archive-win32-x64-msvc/-/flashpoint-archive-win32-x64-msvc-0.6.2.tgz", + "integrity": "sha512-KT+ej4RG2g7BDrw8gQG1dBXxfesFqHfQ122zSlNHwSx4IAe3K0NMXHQld5LI+mWnkhEf0YhbmloDSMuVHwUCQA==", "cpu": [ "x64" ], diff --git a/package.json b/package.json index 37b78f8b9..7182dc73f 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@fortawesome/fontawesome-svg-core": "1.2.36", "@fortawesome/free-solid-svg-icons": "5.15.4", "@fortawesome/react-fontawesome": "0.1.18", - "@fparchive/flashpoint-archive": "0.5.0", + "@fparchive/flashpoint-archive": "0.6.2", "@types/react-virtualized": "^9.21.21", "axios": "1.3.4", "connected-react-router": "6.9.2", diff --git a/src/back/index.ts b/src/back/index.ts index 58f83a4eb..0aed84780 100644 --- a/src/back/index.ts +++ b/src/back/index.ts @@ -33,7 +33,7 @@ import { CURATIONS_FOLDER_WORKING, CURATION_META_FILENAMES } from '@shared/constants'; import axios from 'axios'; -import { FlashpointArchive, parseUserSearchInput } from '@fparchive/flashpoint-archive'; +import { FlashpointArchive, enableDebug, parseUserSearchInput } from '@fparchive/flashpoint-archive'; import { Game, GameData, Playlist, PlaylistGame } from 'flashpoint-launcher'; import { Tail } from 'tail'; import { ConfigFile } from './ConfigFile'; @@ -686,6 +686,10 @@ async function initialize() { // Non-fatal, don't quit. } + if (state.preferences.enableVerboseLogging) { + enableDebug(); + } + const databasePath = path.resolve(state.config.flashpointPath, 'Data', 'flashpoint.sqlite'); try { fpDatabase.loadDatabase(databasePath); diff --git a/src/back/responses.ts b/src/back/responses.ts index f09ab4962..3d2f99546 100644 --- a/src/back/responses.ts +++ b/src/back/responses.ts @@ -49,7 +49,7 @@ import { fpDatabase, loadCurationArchive, onDidUninstallGameData, onWillUninstal import { importGames, importPlatforms, importTagCategories, importTags } from './metadataImport'; import { addPlaylistGame, deletePlaylist, deletePlaylistGame, duplicatePlaylist, filterPlaylists, getPlaylistGame, importPlaylist, savePlaylistGame, updatePlaylist } from './playlist'; import { copyFolder, genContentTree } from './rust'; -import { getMetaUpdateInfo, syncGames, syncPlatforms, syncTags } from './sync'; +import { getMetaUpdateInfo, syncGames, syncPlatforms, syncRedirects, syncTags } from './sync'; import { BackState, MetadataRaw, TagsFile } from './types'; import { pathToBluezip } from './util/Bluezip'; import { pathTo7zBack } from './util/SevenZip'; @@ -374,6 +374,7 @@ export function registerRequestCallbacks(state: BackState, init: () => Promise Promise { + const gamesUrl = `${source.baseUrl}/api/game-redirects`; + const res = await axios.get(gamesUrl) + .catch((err) => { + throw 'Failed to search game redirects'; + }); + + const data = res.data.map((d: any) => { return { + sourceId: d.source_id, + destId: d.id + };}) as any as Array; + console.log('applying redirects'); + await fpDatabase.updateApplyRedirects(data); +} + export async function getMetaUpdateInfo(source: GameMetadataSource, accurate?: boolean, fromScratch?: boolean): Promise { // Add 1 second to update time to prevent rounding down errors const d = new Date(source.games.latestUpdateTime); diff --git a/src/renderer/components/pages/ConfigPage.tsx b/src/renderer/components/pages/ConfigPage.tsx index 6dc83d692..d8e02f26f 100644 --- a/src/renderer/components/pages/ConfigPage.tsx +++ b/src/renderer/components/pages/ConfigPage.tsx @@ -287,6 +287,12 @@ export class ConfigPage extends React.Component + {/* Verbose Logging */} + @@ -806,6 +812,10 @@ export class ConfigPage extends React.Component { + updatePreferencesData({ enableVerboseLogging: isChecked }); + }; + onSearchLimitChange = (event: React.ChangeEvent): void => { updatePreferencesData({ searchLimit: num(event.target.value) }); }; diff --git a/src/shared/lang.ts b/src/shared/lang.ts index ca39f4312..ac92d2c2c 100644 --- a/src/shared/lang.ts +++ b/src/shared/lang.ts @@ -37,6 +37,8 @@ const langTemplate = { 'enablePlaytimeTrackingDesc', 'enableTagFilterIndex', 'enableTagFilterIndexDesc', + 'enableVerboseLogging', + 'enableVerboseLoggingDesc', 'enablePlaytimeTrackingExtreme', 'enablePlaytimeTrackingExtremeDesc', 'clearPlaytimeTracking', diff --git a/src/shared/preferences/util.ts b/src/shared/preferences/util.ts index 60e00d0a7..5bb54d1be 100644 --- a/src/shared/preferences/util.ts +++ b/src/shared/preferences/util.ts @@ -147,6 +147,7 @@ export const defaultPreferencesData: Readonly = Object.freez enablePlaytimeTracking: true, enablePlaytimeTrackingExtreme: true, enableTagFilterIndex: true, + enableVerboseLogging: false, }); /** @@ -221,6 +222,7 @@ export function overwritePreferenceData( parser.prop('enablePlaytimeTracking', v => source.enablePlaytimeTracking = !!v, true); parser.prop('enablePlaytimeTrackingExtreme', v => source.enablePlaytimeTrackingExtreme = !!v, true); parser.prop('enableTagFilterIndex', v => source.enableTagFilterIndex = !!v, true); + parser.prop('enableVerboseLogging', v => source.enableVerboseLogging = !!v, true); // Migrate onDemandBaseUrl from the older FP url if (source.onDemandBaseUrl == 'https://infinity.unstable.life/Flashpoint/Data/Images/') { diff --git a/tests/unit/back/configuration.test.ts b/tests/unit/back/configuration.test.ts index 2f35559df..4244ed365 100644 --- a/tests/unit/back/configuration.test.ts +++ b/tests/unit/back/configuration.test.ts @@ -178,6 +178,7 @@ describe('Configuration Files', () => { 'enablePlaytimeTracking': false, 'enablePlaytimeTrackingExtreme': false, 'enableTagFilterIndex': false, + 'enableVerboseLogging': true, }; const newData = deepCopy(defaultPreferencesData); overwritePreferenceData(newData, data); diff --git a/typings/flashpoint-launcher.d.ts b/typings/flashpoint-launcher.d.ts index 0167d4e94..5674cf14d 100644 --- a/typings/flashpoint-launcher.d.ts +++ b/typings/flashpoint-launcher.d.ts @@ -1048,6 +1048,8 @@ declare module 'flashpoint-launcher' { enablePlaytimeTrackingExtreme: boolean; /** Enable tag filter indexing */ enableTagFilterIndex: boolean; + /** Use verbose logging for the rust library */ + enableVerboseLogging: boolean; }; type GameDataSource = {