diff --git a/server/CHANGELOG.md b/server/CHANGELOG.md index 1abe4e276..9c609b391 100644 --- a/server/CHANGELOG.md +++ b/server/CHANGELOG.md @@ -15,7 +15,7 @@ not generally be shown to end users. # Changelog -# CURRENT +# 2.1.11 - [ENH] The LR2Hook now saves courses. - [ENH] The LR2Hook now saves gauge information. diff --git a/server/pnpm-lock.yaml b/server/pnpm-lock.yaml index cd98cfb98..f88a72a58 100644 --- a/server/pnpm-lock.yaml +++ b/server/pnpm-lock.yaml @@ -95,7 +95,7 @@ dependencies: fast-json-stable-hash: 1.0.3 fast-xml-parser: 4.0.2 helmet: 5.0.2 - html-entities: 2.3.2 + html-entities: 2.3.3 json5: 2.2.0 mkdirp: 1.0.4 mongodb: 3.6.3 @@ -3166,23 +3166,23 @@ packages: } dev: false - /css-select/4.2.1: + /css-select/4.3.0: resolution: { - integrity: sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==, + integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==, } dependencies: boolbase: 1.0.0 - css-what: 5.1.0 + css-what: 6.1.0 domhandler: 4.3.1 domutils: 2.8.0 nth-check: 2.0.1 dev: false - /css-what/5.1.0: + /css-what/6.1.0: resolution: { - integrity: sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==, + integrity: sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==, } engines: { node: ">= 6" } dev: false @@ -4574,10 +4574,10 @@ packages: engines: { node: ">=8" } dev: true - /html-entities/2.3.2: + /html-entities/2.3.3: resolution: { - integrity: sha512-c3Ab/url5ksaT0WyleslpBEthOzWhrjQbg75y7XUsfSzi3Dgzt0l8w5e7DylRn15MTlMMD58dTfzddNS2kcAjQ==, + integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==, } dev: false @@ -5760,7 +5760,7 @@ packages: integrity: sha512-ncg1033CaX9UexbyA7e1N0aAoAYRDiV8jkTvzEnfd1GDvzFdrsXLzR4p4ik8mwLgnaKP/jyUFWDy9q3jvRT2Jw==, } dependencies: - css-select: 4.2.1 + css-select: 4.3.0 he: 1.2.0 dev: false diff --git a/server/src/lib/constants/version.ts b/server/src/lib/constants/version.ts index 20a267eae..47e7356c9 100644 --- a/server/src/lib/constants/version.ts +++ b/server/src/lib/constants/version.ts @@ -3,8 +3,8 @@ // essentially share codebases. const MAJOR = 2; -const MINOR = 2; -const PATCH = 0; +const MINOR = 1; +const PATCH = 12; // As is with all front-facing zkldi projects, the version names for tachi-server // are from an album I like. In this case, the album is Portishead - Dummy. diff --git a/server/src/lib/score-import/framework/score-importing/score-import-main.ts b/server/src/lib/score-import/framework/score-importing/score-import-main.ts index b4edaa287..7513438c4 100644 --- a/server/src/lib/score-import/framework/score-importing/score-import-main.ts +++ b/server/src/lib/score-import/framework/score-importing/score-import-main.ts @@ -64,20 +64,20 @@ export default async function ScoreImportMain( logger = providedLogger; } + const hasNoOngoingImport = await CheckAndSetOngoingImportLock(user.id); + + if (hasNoOngoingImport) { + logger.info(`User ${userID} made an import while they had one ongoing.`); + // @danger + // Throwing away an import if the user already has one outgoing is *bad*, as in the case + // of degraded performance we might just start throwing scores away. + // Under normal circumstances, there is no scenario where a user would have two ongoing + // imports at the same time - even if they were using single-score imports on a 5 second + // chart, as each score import takes only around ~10-15milliseconds. + throw new ScoreImportFatalError(409, "This user already has an ongoing import."); + } + try { - const hasNoOngoingImport = await CheckAndSetOngoingImportLock(user.id); - - if (hasNoOngoingImport) { - logger.info(`User ${userID} made an import while they had one ongoing.`); - // @danger - // Throwing away an import if the user already has one outgoing is *bad*, as in the case - // of degraded performance we might just start throwing scores away. - // Under normal circumstances, there is no scenario where a user would have two ongoing - // imports at the same time - even if they were using single-score imports on a 5 second - // chart, as each score import takes only around ~10-15milliseconds. - throw new ScoreImportFatalError(409, "This user already has an ongoing import."); - } - const timeStarted = Date.now(); SetJobProgress(job, "Parsing score data."); diff --git a/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.test.ts b/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.test.ts index 0ada41108..f256c54e4 100644 --- a/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.test.ts +++ b/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.test.ts @@ -113,7 +113,8 @@ t.test("#ConvertVersion", (t) => { t.equal(ConvertVersion(3), "gw"); t.equal(ConvertVersion(4), "heaven"); t.equal(ConvertVersion(5), "vivid"); - t.throws(() => ConvertVersion(6)); + t.equal(ConvertVersion(6), "exceed"); + t.throws(() => ConvertVersion(7)); t.throws(() => ConvertVersion(0)); t.end(); diff --git a/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.ts b/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.ts index 82eae8615..1c9713be0 100644 --- a/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.ts +++ b/server/src/lib/score-import/import-types/common/api-kai/sdvx/converter.ts @@ -132,6 +132,8 @@ export function ConvertVersion(ver: number) { return "heaven"; case 5: return "vivid"; + case 6: + return "exceed"; } throw new InvalidScoreFailure(`Unknown Game Version ${ver}.`); diff --git a/server/src/scripts/sync-database.ts b/server/src/scripts/sync-database.ts index 61453742b..d2a206adf 100644 --- a/server/src/scripts/sync-database.ts +++ b/server/src/scripts/sync-database.ts @@ -171,6 +171,18 @@ const syncInstructions: SyncInstructions[] = [ } }, }, + { + pattern: /^songs-(b|p)ms/u, + handler: async (songs: SongDocument[], collection: ICollection, logger) => { + const r = await GenericUpsert(songs, collection, "id", logger, false); + + if (r.thingsChanged) { + await RecalcAllScores({ + songID: { $in: r.changedFields }, + }); + } + }, + }, { pattern: /^songs-/u, handler: async (songs: SongDocument[], collection: ICollection, logger) => {