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')
allItems.forEach((filename: string) => {
if (filename === 'order.json') {
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 {
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') {
let downloadObject: any
switch (currentItem.__type__) {

2
webui

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