fix: make sure chapter start is > 0

This commit is contained in:
ThaUnknown 2023-05-01 13:19:56 +02:00
parent 5a687c0cd5
commit 94b280377d
3 changed files with 14 additions and 19 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "3.10.0",
"version": "3.10.1",
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"description": "Stream anime torrents, real-time with no waiting for downloads.",
"main": "src/index.js",

View file

@ -683,7 +683,8 @@
if (!chapters?.length) return []
const sanitised = []
let sum = 0
for (const { start, end, text } of chapters) {
for (let { start, end, text } of chapters) {
if (start < 0) start = 0
if (!sanitised.length && start !== 0) {
const size = start / 10 / safeduration
sum += size

View file

@ -72,24 +72,18 @@
return (typeof v === 'string' ? v : v.toString()).padStart(l, '0')
}
export function getRSSContent (url) {
return url && fetch(url)
.then(res => {
if (res.ok) {
return res.text().then(xmlTxt => {
return DOMPARSER(xmlTxt, 'text/xml')
})
}
throw new Error(res.statusText)
})
.catch(error => {
addToast({
text: 'Failed fetching RSS!<br>' + error,
title: 'Search Failed',
type: 'danger'
})
console.error(error)
export async function getRSSContent (url) {
if (!url) return null
const res = await fetch(url)
if (!res.ok) {
addToast({
text: 'Failed fetching RSS!<br>' + res.statusText,
title: 'Search Failed',
type: 'danger'
})
console.error('Failed to fetch rss', res.statusText)
}
return DOMPARSER(await res.text(), 'text/xml')
}
const rssmap = {
SubsPlease: 'https://nyaa.si/?page=rss&c=0_0&f=0&u=subsplease&q=',