diff --git a/server/package.json b/server/package.json index 336af2f46..7b1720345 100644 --- a/server/package.json +++ b/server/package.json @@ -78,7 +78,7 @@ "redis": "3.1.2", "rimraf": "3.0.2", "safe-json-stringify": "1.2.0", - "tachi-common": "0.2.39", + "tachi-common": "0.2.41", "ts-node": "10.0.0", "typescript": "4.3.4", "winston": "3.3.3", diff --git a/server/pnpm-lock.yaml b/server/pnpm-lock.yaml index 2bbbfbc17..3509b8b34 100644 --- a/server/pnpm-lock.yaml +++ b/server/pnpm-lock.yaml @@ -60,7 +60,7 @@ specifiers: rimraf: 3.0.2 safe-json-stringify: 1.2.0 supertest: 6.1.3 - tachi-common: 0.2.39 + tachi-common: 0.2.41 tap: 15.0.9 ts-node: 10.0.0 tsconfig-paths: 3.10.1 @@ -102,7 +102,7 @@ dependencies: redis: 3.1.2 rimraf: 3.0.2 safe-json-stringify: 1.2.0 - tachi-common: 0.2.39 + tachi-common: 0.2.41 ts-node: 10.0.0_83f53b0a0c5616d3fa00ed4e30b9ce1b typescript: 4.3.4 winston: 3.3.3 @@ -4161,8 +4161,8 @@ packages: strip-ansi: 6.0.0 dev: true - /tachi-common/0.2.39: - resolution: {integrity: sha512-XHG/zr08J/kZgziO3XsbugVGEqRc7TPQmrEyzqgzGbstTyENTtkmY2JqpcDeFPEWjltoSk/RTCADxxg5AVsU7Q==} + /tachi-common/0.2.41: + resolution: {integrity: sha512-1m9MBc3YbVpD2zdZ7yUIgAJjWw0H+0H2YGsnPfisKwBkQlzLQTynBdGJiAIsGt4QRxZlYbSnrQEY1+BU1lEzmA==} dependencies: monk: 7.3.4 transitivePeerDependencies: diff --git a/server/src/lib/score-import/framework/goals/goals.ts b/server/src/lib/score-import/framework/goals/goals.ts index 08f2c2d14..3ba453b25 100644 --- a/server/src/lib/score-import/framework/goals/goals.ts +++ b/server/src/lib/score-import/framework/goals/goals.ts @@ -118,6 +118,8 @@ export async function ProcessGoal( goalID: goal.goalID, old: oldData, new: newData, + game: goal.game, + playtype: goal.playtype, }, }); } diff --git a/server/src/lib/score-import/framework/milestones/milestones.ts b/server/src/lib/score-import/framework/milestones/milestones.ts index ada8b96e6..8b98a1178 100644 --- a/server/src/lib/score-import/framework/milestones/milestones.ts +++ b/server/src/lib/score-import/framework/milestones/milestones.ts @@ -136,6 +136,8 @@ export async function UpdateUsersMilestones( content: { userID, ...milestoneInfo, + game, + playtype: milestone.playtype, }, }); } diff --git a/server/src/server/router/api/v1/clients/router.ts b/server/src/server/router/api/v1/clients/router.ts index 76e2b2e81..26e1d5fa9 100644 --- a/server/src/server/router/api/v1/clients/router.ts +++ b/server/src/server/router/api/v1/clients/router.ts @@ -175,6 +175,9 @@ router.get("/:clientID", GetClientFromID, (req, res) => { * * @param name - Change the name of this client. * @param webhookUri - Change a bound webhookUri for this client. + * @param redirectUri - Change a bound redirectUri for this client. + * @param apiKeyFormat - Change the APIKeyFormat for this client. + * @param apiKeyFilename - Change the APIKeyFilename for this client. * * @name PATCH /api/v1/clients/:clientID */ @@ -184,6 +187,18 @@ router.patch( RequireOwnershipOfClient, prValidate({ name: p.optional(p.isBoundedString(3, 80)), + apiKeyFormat: optNull((self) => { + if (typeof self !== "string") { + return "Expected a string."; + } + + if (!self.includes("%%TACHI_KEY%%")) { + return "Must contain a %%TACHI_KEY%% placeholder."; + } + + return true; + }), + apiKeyFilename: p.optional(p.isBoundedString(3, 80)), webhookUri: optNull((self) => { if (typeof self !== "string") { return "Expected a string."; diff --git a/server/src/utils/class.ts b/server/src/utils/class.ts index d1bf93ba4..1b857235f 100644 --- a/server/src/utils/class.ts +++ b/server/src/utils/class.ts @@ -72,7 +72,7 @@ export async function UpdateClassIfGreater( if (isGreater === null) { EmitWebhookEvent({ type: "class-update/v1", - content: { userID, new: classVal, old: null, set: classSet }, + content: { userID, new: classVal, old: null, set: classSet, game, playtype }, }); return null; @@ -84,6 +84,8 @@ export async function UpdateClassIfGreater( new: classVal, old: userGameStats!.classes[classSet]!, set: classSet, + game, + playtype, }, });