mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-09 15:19:50 +03:00
fix: only attempt bms chart insertion if chart has md5
fuck this shit so much.
This commit is contained in:
@@ -71,16 +71,21 @@ async function HandleOrphanChartProcess(
|
||||
context.chart.mode === "BEAT_7K" ? "7K" : "14K"
|
||||
);
|
||||
|
||||
chart = await HandleOrphanQueue(
|
||||
gptString,
|
||||
"bms",
|
||||
chartDoc,
|
||||
songDoc,
|
||||
criteria,
|
||||
ServerConfig.BEATORAJA_QUEUE_SIZE,
|
||||
context.userID,
|
||||
chartName
|
||||
);
|
||||
// only try and insert this in the tachi DB if it has a valid MD5.
|
||||
// beatoraja makes it **perfectly valid** for MD5 to be an empty string
|
||||
// if it doesn't feel like md5ing the chart (for whatever reason)
|
||||
if (chartDoc.data.hashMD5.length === "d0f497c0f955e7edfb0278f446cdb6f8".length) {
|
||||
chart = await HandleOrphanQueue(
|
||||
gptString,
|
||||
"bms",
|
||||
chartDoc,
|
||||
songDoc,
|
||||
criteria,
|
||||
ServerConfig.BEATORAJA_QUEUE_SIZE,
|
||||
context.userID,
|
||||
chartName
|
||||
);
|
||||
}
|
||||
} else {
|
||||
const playtype = data.deviceType === "BM_CONTROLLER" ? "Controller" : "Keyboard";
|
||||
|
||||
@@ -93,16 +98,21 @@ async function HandleOrphanChartProcess(
|
||||
|
||||
const { chartDoc, songDoc } = ConvertBeatorajaChartToTachi(context.chart, playtype);
|
||||
|
||||
chart = await HandleOrphanQueue(
|
||||
gptString,
|
||||
"pms",
|
||||
chartDoc,
|
||||
songDoc,
|
||||
criteria,
|
||||
ServerConfig.BEATORAJA_QUEUE_SIZE,
|
||||
context.userID,
|
||||
chartName
|
||||
);
|
||||
// only try and insert this in the tachi DB if it has a valid MD5.
|
||||
// beatoraja makes it **perfectly valid** for MD5 to be an empty string
|
||||
// if it doesn't feel like md5ing the chart (for whatever reason)
|
||||
if (chartDoc.data.hashMD5.length === "d0f497c0f955e7edfb0278f446cdb6f8".length) {
|
||||
chart = await HandleOrphanQueue(
|
||||
gptString,
|
||||
"pms",
|
||||
chartDoc,
|
||||
songDoc,
|
||||
criteria,
|
||||
ServerConfig.BEATORAJA_QUEUE_SIZE,
|
||||
context.userID,
|
||||
chartName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// If chart wasn't unorphaned as a result of this request
|
||||
|
||||
@@ -7,7 +7,9 @@ import type { KtLogger } from "lib/logger/logger";
|
||||
import type { integer } from "tachi-common";
|
||||
|
||||
const PR_BEATORAJA_SCORE = {
|
||||
sha256: "string",
|
||||
// sha256 **MUST** be a 64 char hex string.
|
||||
sha256: p.regex(/^[0-9a-f]{64}$/u),
|
||||
|
||||
exscore: p.isPositiveInteger,
|
||||
passnotes: p.isPositiveInteger,
|
||||
gauge: p.or(p.isBetween(0, 100), p.is(-1)),
|
||||
@@ -47,8 +49,15 @@ const PR_BEATORAJA_SCORE = {
|
||||
};
|
||||
|
||||
const PR_BEATORAJA_CHART = {
|
||||
// IMPORTANT!!! MD5 IS **NOT GUARANTEED TO BE CORRECT AT ALL.
|
||||
// IT IS PERFECTLY LEGAL FOR RAJA TO GIVE YOU **ANYTHING** IN THIS FIELD.
|
||||
// YOU SHOULD ONLY USE IT IF YOU CHECK IT AND IT LOOKS LIKE A VALID MD5.
|
||||
// THIS MAY BE THE EMPTY STRING, THE STRING "null", etc.
|
||||
md5: "string",
|
||||
sha256: "string",
|
||||
|
||||
// sha256 **MUST** be a 64 char hex string.
|
||||
sha256: p.regex(/^[0-9a-f]{64}$/u),
|
||||
|
||||
title: "string",
|
||||
subtitle: "string",
|
||||
genre: "string",
|
||||
|
||||
Reference in New Issue
Block a user