|
|
|
@ -131,7 +131,7 @@ exports.manga = async (req, res)=>
|
|
|
|
|
const sortedChapters = chaptersRead.sort((a, b) => a.chapterNum - b.chapterNum);
|
|
|
|
|
const sortedAndFilteredChapters = sortedChapters.filter(item=> item.lastImageRead && !item.completely);
|
|
|
|
|
const lastChapterWithReadImages=sortedAndFilteredChapters.shift();
|
|
|
|
|
const chapterNumToContinue = lastCompletelyRead?(lastCompletelyRead.chapterNum < lastChapterWithReadImages.chapterNum ? lastChapterWithReadImages.chapterNum:lastCompletelyRead.chapterNum):lastChapterWithReadImages.chapterNum;
|
|
|
|
|
const chapterNumToContinue = getChapterNumToContinue(lastCompletelyRead, lastChapterWithReadImages);
|
|
|
|
|
manga.List[chapterNumToContinue-1]['continue'] = true;
|
|
|
|
|
}
|
|
|
|
|
catch (error)
|
|
|
|
@ -139,8 +139,20 @@ exports.manga = async (req, res)=>
|
|
|
|
|
console.log('There was an error:', error);
|
|
|
|
|
}
|
|
|
|
|
res.render('mangaPage.ejs', {data:{...manga, scanlator}});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function getChapterNumToContinue(lastCompletelyRead, lastChapterWithReadImages)
|
|
|
|
|
{
|
|
|
|
|
if(lastCompletelyRead)
|
|
|
|
|
{
|
|
|
|
|
if(lastCompletelyRead.chapterNum < lastChapterWithReadImages.chapterNum)
|
|
|
|
|
{
|
|
|
|
|
return lastChapterWithReadImages.chapterNum;
|
|
|
|
|
}
|
|
|
|
|
return lastCompletelyRead.chapterNum+1;
|
|
|
|
|
}
|
|
|
|
|
return lastChapterWithReadImages.chapterNum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exports.chapter = async (req, res)=>
|
|
|
|
|
{
|
|
|
|
|
const {scanlator, title, chapter, link} = req.params;
|
|
|
|
|