mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-18 05:28:27 +03:00
Don't throw 409 if only one segment was successfully submitted
This commit is contained in:
@@ -324,17 +324,21 @@ async function checkEachSegmentValid(rawIP: IPAddress, paramUserID: UserID, user
|
||||
const duplicateCheck2Row = await db.prepare("get", `SELECT "UUID" FROM "sponsorTimes" WHERE "startTime" = ?
|
||||
and "endTime" = ? and "category" = ? and "actionType" = ? and "description" = ? and "videoID" = ? and "service" = ?`, [startTime, endTime, segments[i].category, segments[i].actionType, segments[i].description, videoID, service]);
|
||||
if (duplicateCheck2Row) {
|
||||
segments[i].ignoreSegment = true;
|
||||
|
||||
if (segments[i].actionType === ActionType.Full) {
|
||||
// Forward as vote
|
||||
await vote(rawIP, duplicateCheck2Row.UUID, paramUserID, 1);
|
||||
segments[i].ignoreSegment = true;
|
||||
continue;
|
||||
} else {
|
||||
return { pass: false, errorMessage: "Segment has already been submitted before.", errorCode: 409 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (segments.every((s) => s.ignoreSegment)) {
|
||||
return { pass: false, errorMessage: "Segment has already been submitted before.", errorCode: 409 };
|
||||
}
|
||||
|
||||
return CHECK_PASS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user