Make sure that do not pass invaild value to client

This commit is contained in:
DitFranXX
2020-12-26 15:16:23 +09:00
parent 7ab416c917
commit f63ee8aae8
4 changed files with 16 additions and 7 deletions
+9 -1
View File
@@ -99,10 +99,18 @@ export const get_music_info: EPR = async (info, data, send) => {
}));
}
const music_list = async () => {
const music_list = await processData()
music_list.music_spec = music_list.music_spec.filter( (v) =>
parseInt(v["@attr"].index, 10) <= version.getMusicMaxIndex()
)
return music_list;
}
const versionObject = version.isFirstOrForte()
? {
permitted_list: forte_permitted_list,
music_list: await processData()
music_list: await music_list()
}
: {
permitted_list,
+2 -1
View File
@@ -51,7 +51,7 @@ const getPlayerData = async (refid: string, info: EamuseInfo, name?: string) =>
const brooch: any[] = [];
for (const b in p.brooches) {
if (parseInt(b, 10) > version.getBroochMaxIndex()) continue; // Forte Brooch is ~147.
if (parseInt(b, 10) > version.getBroochMaxIndex()) continue;
const bData = p.brooches[b];
brooch.push(K.ATTR({ index: b }, {
watch_count: K.ITEM('s32', bData.watch),
@@ -63,6 +63,7 @@ const getPlayerData = async (refid: string, info: EamuseInfo, name?: string) =>
// Unlock brooches
for (let i = 101; i <= 124; ++i) {
if (i > version.getBroochMaxIndex()) continue;
brooch.push(K.ATTR({ index: `${i}` }, {
'watch_count': K.ITEM('s32', 0),
'level': K.ITEM('s8', 1),