mirror of
https://github.com/NoCrypt/migu.git
synced 2026-03-11 17:45:32 +00:00
feat: Stories You Missed
This commit is contained in:
parent
a62c635cd8
commit
0468f345dc
2 changed files with 19 additions and 1 deletions
|
|
@ -100,6 +100,24 @@ function createSections () {
|
|||
},
|
||||
hide: !Helper.isAuthorized() || Helper.isMalAuth() // disable this section when authenticated with MyAnimeList. API for userLists fail to return relations and likely will never be fixed on their end.
|
||||
},
|
||||
{
|
||||
title: 'Stories You Missed', variables : { sort: 'POPULARITY_DESC', userList: true, missedList: true, disableHide: true },
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
if (Helper.isMalAuth()) return {} // same as Sequels You Missed
|
||||
const res = Helper.userLists(variables).then(res => {
|
||||
const mediaList = res.data.MediaListCollection.lists.find(({ status }) => status === 'COMPLETED')?.entries
|
||||
const excludeIds = res.data.MediaListCollection.lists.reduce((filtered, { status, entries }) => { return (['CURRENT', 'REPEATING', 'COMPLETED', 'DROPPED', 'PAUSED'].includes(status)) ? filtered.concat(entries) : filtered}, []).map(({ media }) => media.id) || []
|
||||
if (!mediaList) return {}
|
||||
const ids = mediaList.flatMap(({ media }) => {
|
||||
return media.relations.edges.filter(edge => !['SEQUEL', 'CHARACTER', 'OTHER'].includes(edge.relationType))
|
||||
}).map(({ node }) => node.id)
|
||||
if (!ids.length) return {}
|
||||
return anilistClient.searchIDS({ page, perPage, id: ids, id_not: excludeIds, ...SectionsManager.sanitiseObject(variables), status: ['FINISHED', 'RELEASING'] })
|
||||
})
|
||||
return SectionsManager.wrapResponse(res, perPage)
|
||||
},
|
||||
hide: !Helper.isAuthorized() || Helper.isMalAuth()
|
||||
},
|
||||
{
|
||||
title: 'Continue Watching', variables: { sort: 'UPDATED_TIME_DESC', userList: true, continueWatching: true, disableHide: true },
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
for (const sectionTitle of settings.value.homeSections) manager.add(mappedSections[sectionTitle])
|
||||
|
||||
if (Helper.getUser()) {
|
||||
const userSections = ['Continue Watching', 'Sequels You Missed', 'Planning List', 'Completed List', 'Paused List', 'Dropped List', 'Watching List']
|
||||
const userSections = ['Continue Watching', 'Sequels You Missed', 'Stories You Missed', 'Planning List', 'Completed List', 'Paused List', 'Dropped List', 'Watching List']
|
||||
Helper.getClient().userLists.subscribe(value => {
|
||||
if (!value) return
|
||||
for (const section of manager.sections) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue