fixed parse errors when loading the queue

This commit is contained in:
RemixDev 2022-01-06 16:42:32 +01:00
parent a5c188f60c
commit cbe3604142
3 changed files with 15 additions and 4 deletions

2
server/dist/app.js vendored

File diff suppressed because one or more lines are too long

View file

@ -270,9 +270,20 @@ export function restoreQueueFromDisk() {
const allItems: string[] = fs.readdirSync(configFolder + 'queue') const allItems: string[] = fs.readdirSync(configFolder + 'queue')
allItems.forEach((filename: string) => { allItems.forEach((filename: string) => {
if (filename === 'order.json') { if (filename === 'order.json') {
queueOrder = JSON.parse(fs.readFileSync(configFolder + `queue${sep}order.json`).toString()) try {
queueOrder = JSON.parse(fs.readFileSync(configFolder + `queue${sep}order.json`).toString())
} catch {
queueOrder = []
fs.writeFileSync(configFolder + `queue${sep}order.json`, JSON.stringify(queueOrder))
}
} else { } else {
const currentItem: any = JSON.parse(fs.readFileSync(configFolder + `queue${sep}${filename}`).toString()) let currentItem: any
try {
currentItem = JSON.parse(fs.readFileSync(configFolder + `queue${sep}${filename}`).toString())
} catch {
fs.unlinkSync(configFolder + `queue${sep}${filename}`)
return
}
if (currentItem.status === 'inQueue') { if (currentItem.status === 'inQueue') {
let downloadObject: any let downloadObject: any
switch (currentItem.__type__) { switch (currentItem.__type__) {

2
webui

@ -1 +1 @@
Subproject commit 202a0b1320672f18393f97d4f44c617654bc31a7 Subproject commit 457320b99539f4593e07b8a16e504447aff13061