mirror of
https://github.com/ld3z/new-manga.git
synced 2026-11-09 19:33:44 -07:00
added timer data
This commit is contained in:
parent
16993baa78
commit
d71a1da5aa
1 changed files with 20 additions and 4 deletions
|
|
@ -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
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue