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 <TonyRL@users.noreply.github.com>

Co-authored-by: Tony <TonyRL@users.noreply.github.com>
This commit is contained in:
Chih-Hsuan Yen 2022-02-06 02:18:54 +08:00 committed by GitHub
parent 5326d9f751
commit d08f662103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -443,7 +443,7 @@ Sources
### 漫画更新
<Route author="btdwv" path="/copymanga/comic/:id/:chapterCnt?" example="/copymanga/comic/zaiyishijiemigongkaihougong/5" :paramsDesc="['漫画ID','返回章节的数量默认为0返回所有章节']" radar="1" rssbud="1"/>
<Route author="btdwv marvolo666 yan12125" path="/copymanga/comic/:id/:chapterCnt?" example="/copymanga/comic/zaiyishijiemigongkaihougong/5" :paramsDesc="['漫画ID','返回章节的数量默认为0返回所有章节']" radar="1" rssbud="1"/>
## 漫画 DB

View File

@ -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),
};
};