Skip to content

Commit 2ed23d7

Browse files
committed
Fix duplicate chapter issue
Fix #521
1 parent 66c2be6 commit 2ed23d7

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/routes/postSkipSegments.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,8 @@ export async function postSkipSegments(req: Request, res: Response): Promise<Res
555555
//this can just be a hash of the data
556556
//it's better than generating an actual UUID like what was used before
557557
//also better for duplication checking
558-
const UUID = getSubmissionUUID(videoID, segmentInfo.category, segmentInfo.actionType, userID, parseFloat(segmentInfo.segment[0]), parseFloat(segmentInfo.segment[1]), service);
558+
const UUID = getSubmissionUUID(videoID, segmentInfo.category, segmentInfo.actionType,
559+
segmentInfo.description, userID, parseFloat(segmentInfo.segment[0]), parseFloat(segmentInfo.segment[1]), service);
559560
const hashedVideoID = getHash(videoID, 1);
560561

561562
const startingLocked = isVIP ? 1 : 0;

src/utils/getSubmissionUUID.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ export function getSubmissionUUID(
77
videoID: VideoID,
88
category: Category,
99
actionType: ActionType,
10+
description: string,
1011
userID: UserID,
1112
startTime: number,
1213
endTime: number,
1314
service: Service
1415
) : HashedValue {
15-
return `${getHash(`${videoID}${startTime}${endTime}${userID}${category}${actionType}${service}`, 1)}6` as HashedValue;
16+
return `${getHash(`${videoID}${startTime}${endTime}${userID}${description}${category}${actionType}${service}`, 1)}7` as HashedValue;
1617
}

test/cases/getSubmissionUUID.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { UserID } from "../../src/types/user.model";
66
describe("getSubmissionUUID", () => {
77
it("Should return the hashed value", () => {
88
assert.strictEqual(
9-
getSubmissionUUID("video001" as VideoID, "sponsor" as Category, "skip" as ActionType, "testuser001" as UserID, 13.33337, 42.000001, Service.YouTube),
10-
"2a473bca993dd84d8c2f6a4785989b20948dfe0c12c00f6f143bbda9ed561dca6");
9+
getSubmissionUUID("video001" as VideoID, "sponsor" as Category, "skip" as ActionType, "", "testuser001" as UserID, 13.33337, 42.000001, Service.YouTube),
10+
"2a473bca993dd84d8c2f6a4785989b20948dfe0c12c00f6f143bbda9ed561dca7");
1111
});
1212
});

0 commit comments

Comments
 (0)