added timer data

This commit is contained in:
ld3zian 2025-01-25 20:25:17 -07:00
parent 16993baa78
commit d71a1da5aa

View file

@ -177,13 +177,29 @@ export async function getChaptersByHid(
console.log('Processing chapters for comic:', comicTitle);
const now = new Date();
const chapters = data.chapters
.filter(chapter => {
// Basic validation
const isValid = chapter &&
chapter.chap &&
chapter.hid &&
(chapter.publish_at || chapter.created_at || chapter.updated_at);
return isValid;
chapter.hid;
if (!isValid) return false;
// Check publish time
if (chapter.publish_at) {
const publishTime = new Date(chapter.publish_at);
if (publishTime > now) {
console.log(`Chapter ${chapter.chap} will be published at ${publishTime}`);
return false;
}
}
// Use the earliest available timestamp
const hasValidTimestamp = chapter.publish_at || chapter.created_at || chapter.updated_at;
return Boolean(hasValidTimestamp);
})
.map(chapter => ({
id: chapter.hid,
@ -193,7 +209,7 @@ export async function getChaptersByHid(
md_comics: {
title: comicTitle,
slug: slug,
md_covers: covers // Add covers to the response
md_covers: covers
}
}));