fix(api): address issues caused by 3p tools

and flag accounts that use them
This commit is contained in:
SabreCat
2023-04-18 15:43:35 -05:00
parent c8adf20804
commit 86efb02358
5 changed files with 30 additions and 14 deletions

View File

@@ -22,6 +22,7 @@ import {
} from '../../libs/email';
import * as inboxLib from '../../libs/inbox';
import * as userLib from '../../libs/user';
import { OFFICIAL_PLATFORMS } from '../../../common/script/constants';
const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL');
const DELETE_CONFIRMATION = 'DELETE';
@@ -494,6 +495,9 @@ api.buy = {
let quantity = 1;
if (req.body.quantity) quantity = req.body.quantity;
req.quantity = quantity;
if (OFFICIAL_PLATFORMS.indexOf(req.headers['x-client']) === -1) {
res.analytics = undefined;
}
const buyRes = await common.ops.buy(user, req, res.analytics);
await user.save();
@@ -584,6 +588,9 @@ api.buyArmoire = {
const { user } = res.locals;
req.type = 'armoire';
req.params.key = 'armoire';
if (OFFICIAL_PLATFORMS.indexOf(req.headers['x-client']) === -1) {
res.analytics = undefined;
}
const buyArmoireResponse = await common.ops.buy(user, req, res.analytics);
await user.save();
res.respond(200, ...buyArmoireResponse);