mirror of
https://github.com/PretendoNetwork/account.git
synced 2026-09-11 21:06:42 -05:00
Removed unsafe .get() calls from Mongoose documents
This commit is contained in:
@@ -100,13 +100,13 @@ async function NASCMiddleware(request: express.Request, response: express.Respon
|
||||
});
|
||||
|
||||
if (device) {
|
||||
if (device.get('access_level') < 0) {
|
||||
if (device.access_level < 0) {
|
||||
response.status(200).send(nascError('102').toString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid) {
|
||||
const linkedPIDs = device.get('linked_pids');
|
||||
const linkedPIDs: number[] = device.linked_pids;
|
||||
|
||||
if (!linkedPIDs.includes(pid)) {
|
||||
response.status(200).send(nascError('102').toString());
|
||||
|
||||
@@ -192,7 +192,7 @@ PNIDSchema.method('updateMii', async function updateMii({ name, primary, data }:
|
||||
});
|
||||
|
||||
PNIDSchema.method('generateMiiImages', async function generateMiiImages(): Promise<void> {
|
||||
const miiData: string = this.get('mii.data');
|
||||
const miiData: string = this.mii.data;
|
||||
const mii: Mii = new Mii(Buffer.from(miiData, 'base64'));
|
||||
const miiStudioUrl: string = mii.studioUrl({
|
||||
type: 'face',
|
||||
@@ -203,7 +203,7 @@ PNIDSchema.method('generateMiiImages', async function generateMiiImages(): Promi
|
||||
const pngData: ImageData = await imagePixels(miiStudioNormalFaceImageData);
|
||||
const tga: Buffer = TGA.createTgaBuffer(pngData.width, pngData.height, Uint8Array.from(pngData.data), false);
|
||||
|
||||
const userMiiKey: string = `mii/${this.get('pid')}`;
|
||||
const userMiiKey: string = `mii/${this.pid}`;
|
||||
|
||||
await uploadCDNAsset('pn-cdn', `${userMiiKey}/standard.tga`, tga, 'public-read');
|
||||
await uploadCDNAsset('pn-cdn', `${userMiiKey}/normal_face.png`, miiStudioNormalFaceImageData, 'public-read');
|
||||
|
||||
Reference in New Issue
Block a user