fix: task for anilist-updates not encoding body in base 64
This commit is contained in:
@@ -132,6 +132,7 @@ app.openapi(route, async (c) => {
|
||||
watchStatus,
|
||||
titleId,
|
||||
isRetrying: true,
|
||||
nameSuffix: "watch-status",
|
||||
},
|
||||
{ req: c.req, scheduleConfig: { delay: { minute: 1 } } },
|
||||
);
|
||||
|
||||
@@ -2,6 +2,10 @@ export function buildNewEpisodeTaskId(aniListId: number) {
|
||||
return `${aniListId}`;
|
||||
}
|
||||
|
||||
export function buildAnilistRetryTaskId(deviceId: string, titleId: number) {
|
||||
return `${deviceId}-${titleId}`;
|
||||
export function buildAnilistRetryTaskId(
|
||||
deviceId: string,
|
||||
titleId: number,
|
||||
nameSuffix: string,
|
||||
) {
|
||||
return `${deviceId}-${titleId}-${nameSuffix}`;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ type QueueBody = {
|
||||
watchStatus: WatchStatus | null;
|
||||
titleId: number;
|
||||
isRetrying: true;
|
||||
nameSuffix: string;
|
||||
};
|
||||
"new-episode": { aniListId: number; episodeNumber: number };
|
||||
};
|
||||
@@ -178,8 +179,9 @@ function buildTask(
|
||||
},
|
||||
};
|
||||
case "anilist-updates":
|
||||
const { deviceId, titleId } = body as QueueBody[typeof queueName];
|
||||
taskId = buildAnilistRetryTaskId(deviceId, titleId);
|
||||
const { deviceId, titleId, nameSuffix } =
|
||||
body as QueueBody[typeof queueName];
|
||||
taskId = buildAnilistRetryTaskId(deviceId, titleId, nameSuffix);
|
||||
|
||||
return {
|
||||
name: `projects/${projectId}/locations/northamerica-northeast1/queues/${queueName}/tasks/${taskId}`,
|
||||
@@ -187,7 +189,9 @@ function buildTask(
|
||||
httpRequest: {
|
||||
url: `${domain}/watch-status`,
|
||||
httpMethod: "POST",
|
||||
body: JSON.stringify(body),
|
||||
body: Buffer.from(
|
||||
JSON.stringify({ ...body, nameSuffix: undefined }),
|
||||
).toString("base64"),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Anilist-Token": headers?.["X-Anilist-Token"],
|
||||
|
||||
Reference in New Issue
Block a user