Skip to content

Commit

Permalink
feature: Rust library first available complete
Browse files Browse the repository at this point in the history
  • Loading branch information
colin969 committed Feb 17, 2024
1 parent f9d90cf commit dbc291a
Show file tree
Hide file tree
Showing 31 changed files with 1,108 additions and 1,395 deletions.
2 changes: 1 addition & 1 deletion extensions/core-curation
Submodule core-curation updated 2 files
+12,341 −12,341 package-lock.json
+1 −1 src/extension.ts
4 changes: 2 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"enablePlaytimeTrackingDesc": "Allow tracking last played date, total playtime and play count for games.",
"enablePlaytimeTrackingExtreme": "Track Extreme Games Playtime",
"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",
"clearPlaytimeTracking": "Clear Playtime Data",
"clearPlaytimeTrackingDesc": "Clears last played, total playtime and play count for every game. Irreversible.",
"clearData": "Clear Data",
Expand All @@ -41,8 +43,6 @@
"fallbackLanguageDesc": "Which language to use in place of an incomplete current language.",
"auto": "Auto ({0})",
"none": "None",
"precacheDatabase": "Precache Database",
"precacheDatabaseDesc": "Caches some database tables to memory on boot. Improves responsiveness on slower drives at the expense of additional memory usage and boot time. Requires launcher restart to apply change.",
"contentFiltersHeader": "Content Filters",
"flashpointHeader": "Flashpoint",
"flashpointPath": "Flashpoint Path",
Expand Down
60 changes: 60 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flashpoint-launcher",
"version": "12.2.1",
"version": "13.0.0",
"description": "A desktop application used to browse, manage and play games from Flashpoint Archive",
"main": "build/main/index.js",
"config": {
Expand All @@ -13,7 +13,7 @@
"build": "gulp build",
"watch": "gulp watch",
"pack": "gulp pack",
"snapshot": "cross-env-shell PACK_PLATFORM=win32 PACK_ARCH=ia32 NODE_ENV=production \"npm run build && npm run pack\"",
"snapshot": "cross-env-shell PACK_PLATFORM=win32 PACK_ARCH=x64 NODE_ENV=production \"npm run build && npm run pack\"",
"test": "jest",
"lint": "eslint ./src/**/*.{ts,tsx} ./gulpfile.js",
"nexusPack": "gulp nexusPack",
Expand All @@ -39,6 +39,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.3.0",
"@types/react-virtualized": "^9.21.21",
"axios": "1.3.4",
"connected-react-router": "6.9.2",
Expand Down
2 changes: 0 additions & 2 deletions src/back/SocketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ export class SocketServer {
return;
}

console.log(parsed_data);

const [msg, msg_error] = validate_socket_message<any>(parsed_data);

if (!msg || msg_error) {
Expand Down
36 changes: 20 additions & 16 deletions src/back/curate/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,17 @@ async function getPlatformsFromStr(platformsStr: string): Promise<Platform[]> {
for (let index = 0; index < splitPlatforms.length; index++) {
const platformName = splitPlatforms[index];
const trimmedName = platformName.trim();
let platform = await fpDatabase.findPlatform(trimmedName);
if (!platform) {
if (trimmedName !== '' && trimmedName !== '[object Object]') {
let platform = await fpDatabase.findPlatform(trimmedName);
if (!platform) {
// Tag doesn't exist, make a new one
platform = await fpDatabase.createPlatform(trimmedName);
}
if (platform !== null) {
platform = await fpDatabase.createPlatform(trimmedName);
}
if (platform !== null) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (platforms.findIndex(t => t.id === platform!.id) === -1) {
platforms.push(platform);
if (platforms.findIndex(t => t.id === platform!.id) === -1) {
platforms.push(platform);
}
}
}
}
Expand All @@ -199,15 +201,17 @@ async function getTagsFromStr(tagsStr: string, tagCategoriesStr: string): Promis
const tagName = splitTags[index];
const trimmedName = tagName.trim();
const category = splitCategories.length > index ? splitCategories[index].trim() : undefined;
let tag = await fpDatabase.findTag(trimmedName);
if (!tag) {
// Tag doesn't exist, make a new one
tag = await fpDatabase.createTag(trimmedName, category);
}
if (tag !== null) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (tags.findIndex(t => t.id === tag!.id) === -1) {
tags.push(tag);
if (trimmedName !== '' && trimmedName !== '[object Object]') {
let tag = await fpDatabase.findTag(trimmedName);
if (!tag) {
// Tag doesn't exist, make a new one
tag = await fpDatabase.createTag(trimmedName, category);
}
if (tag !== null) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (tags.findIndex(t => t.id === tag!.id) === -1) {
tags.push(tag);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/back/curate/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ function convertEditToCurationMetaFile(curation: LoadedCuration): CurationMetaFi
parsed['Release Date'] = curation.game.releaseDate;
parsed['Version'] = curation.game.version;
parsed['Languages'] = curation.game.language;
parsed['Tags'] = curation.game.tags ? curation.game.tags.join('; ') : '';
parsed['Tags'] = curation.game.tags ? curation.game.tags.map(t => t.name).join('; ') : '';
parsed['Tag Categories'] = tagCategories.join('; ');
parsed['Source'] = curation.game.source;
parsed['Primary Platform'] = curation.game.primaryPlatform;
parsed['Platforms'] = curation.game.platforms ? curation.game.platforms.join('; ') : '';
parsed['Platforms'] = curation.game.platforms ? curation.game.platforms.map(p => p.name).join('; ') : '';
parsed['Status'] = curation.game.status;
parsed['Application Path'] = curation.game.applicationPath;
parsed['Launch Command'] = curation.game.launchCommand;
Expand Down
28 changes: 19 additions & 9 deletions src/back/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,15 +687,25 @@ async function initialize() {
}

const databasePath = path.resolve(state.config.flashpointPath, 'Data', 'flashpoint.sqlite');
fpDatabase.loadDatabase(databasePath);
const tagFilterSearch = parseUserSearchInput('');
tagFilterSearch.limit = 9999999999;
tagFilterSearch.filter.exactBlacklist.tags = state.preferences.tagFilters
.filter(t => t.enabled || (t.extreme && !state.preferences.browsePageShowExtreme))
.map(t => t.tags)
.reduce((prev, cur) => prev.concat(cur), []);
// Let the tag filter index generate
await fpDatabase.newTagFilterIndex(tagFilterSearch);
try {
fpDatabase.loadDatabase(databasePath);
} catch (e) {
state.socketServer.broadcast(BackOut.OPEN_ALERT, 'Failed to open database: ' + e);
}
if (state.preferences.enableTagFilterIndex) {
const tagFilterSearch = parseUserSearchInput('');
tagFilterSearch.limit = 9999999999;
tagFilterSearch.filter.exactBlacklist.tags = state.preferences.tagFilters
.filter(t => t.enabled || (t.extreme && !state.preferences.browsePageShowExtreme))
.map(t => t.tags)
.reduce((prev, cur) => prev.concat(cur), []);
// Let the tag filter index generate
try {
await fpDatabase.newTagFilterIndex(tagFilterSearch);
} catch (e) {
state.socketServer.broadcast(BackOut.OPEN_ALERT, 'Failed to generate tag filter index: ' + e);
}
}

// Populate unique values
state.suggestions = {
Expand Down
Loading

0 comments on commit dbc291a

Please sign in to comment.