From d08f662103693d7502d8fcc85e66f756e3fc56ef Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen Date: Sun, 6 Feb 2022 02:18:54 +0800 Subject: [PATCH] fix(route): fixes "this route is empty" for copymanga (#8960) * fix(route): fixes "this route is empty" for copymanga This fix mirrors manhuagui logic updated in [1] - returns all items when chapterCnt is 0 or not specified. [1] https://github.com/DIYgod/RSSHub/pull/8670 * Add myself to `author` in docs/ This helps refactoring routes to v2. See https://github.com/DIYgod/RSSHub/pull/8960#issuecomment-1030617999 * Add more authors Ref: #8670 Co-authored-by: Tony Co-authored-by: Tony --- docs/anime.md | 2 +- lib/routes/copymanga/comic.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/anime.md b/docs/anime.md index 600602f9e9..c798e97354 100644 --- a/docs/anime.md +++ b/docs/anime.md @@ -443,7 +443,7 @@ Sources ### 漫画更新 - + ## 漫画 DB diff --git a/lib/routes/copymanga/comic.js b/lib/routes/copymanga/comic.js index 22b7a663af..c42a368b73 100644 --- a/lib/routes/copymanga/comic.js +++ b/lib/routes/copymanga/comic.js @@ -59,10 +59,16 @@ module.exports = async (ctx) => { `.trim(), }); + let itemsLen = chapterArray.length; + + if (chapterCnt > 0) { + itemsLen = chapterCnt; + } + ctx.state.data = { title: `拷贝漫画 - ${bookTitle}`, link: `https://copymanga.com/comic/${id}`, description: bookIntro, - item: chapterArray.map(genResult).slice(0, chapterCnt), + item: chapterArray.map(genResult).slice(0, itemsLen), }; };