Update store.js

This commit is contained in:
freearhey 2023-09-18 19:21:55 +03:00
parent 2a19808b5a
commit c13dda8473

View file

@ -50,7 +50,8 @@ export async function fetchChannels() {
return { type, ...api.subdivisions[code] } return { type, ...api.subdivisions[code] }
} }
}) })
c.is = c.closed || c.replaced_by ? 'closed' : 'active' c.is_closed = !!c.closed || !!c.replaced_by
c.is_blocked = !!api.blocklist[c.id]
c.streams = c._streams.length c.streams = c._streams.length
c.guides = c._guides.length c.guides = c._guides.length
@ -76,7 +77,9 @@ export async function fetchChannels() {
'replaced_by', 'replaced_by',
'streams', 'streams',
'guides', 'guides',
'is' 'is_nsfw',
'is_closed',
'is_blocked'
] ]
}) })
} }
@ -143,6 +146,12 @@ async function loadAPI() {
.then(data => _.groupBy(data, 'channel')) .then(data => _.groupBy(data, 'channel'))
.catch(console.error) .catch(console.error)
api.blocklist = await fetch('https://iptv-org.github.io/api/blocklist.json')
.then(r => r.json())
.then(data => (data.length ? data : []))
.then(data => _.groupBy(data, 'channel'))
.catch(console.error)
api.guides = {} api.guides = {}
// api.guides = await fetch('https://iptv-org.github.io/api/guides.json') // api.guides = await fetch('https://iptv-org.github.io/api/guides.json')
// .then(r => r.json()) // .then(r => r.json())