mirror of
https://github.com/ld3z/new-manga.git
synced 2026-11-09 20:43:45 -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);
|
console.log('Processing chapters for comic:', comicTitle);
|
||||||
|
|
||||||
|
const now = new Date();
|
||||||
|
|
||||||
const chapters = data.chapters
|
const chapters = data.chapters
|
||||||
.filter(chapter => {
|
.filter(chapter => {
|
||||||
|
// Basic validation
|
||||||
const isValid = chapter &&
|
const isValid = chapter &&
|
||||||
chapter.chap &&
|
chapter.chap &&
|
||||||
chapter.hid &&
|
chapter.hid;
|
||||||
(chapter.publish_at || chapter.created_at || chapter.updated_at);
|
|
||||||
return isValid;
|
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 => ({
|
.map(chapter => ({
|
||||||
id: chapter.hid,
|
id: chapter.hid,
|
||||||
|
|
@ -193,7 +209,7 @@ export async function getChaptersByHid(
|
||||||
md_comics: {
|
md_comics: {
|
||||||
title: comicTitle,
|
title: comicTitle,
|
||||||
slug: slug,
|
slug: slug,
|
||||||
md_covers: covers // Add covers to the response
|
md_covers: covers
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue