daemon: fix some bugs in the frontend js

This commit is contained in:
Will Greenberg
2024-10-08 13:35:43 -07:00
committed by Cooper Quintin
parent 16f705f29c
commit f3e4091e1d

View File

@@ -43,17 +43,15 @@ async function updateAnalysisStatus(qmdlManifest) {
} }
function parseNewlineDelimitedJSON(inputStr) { function parseNewlineDelimitedJSON(inputStr) {
if(! inputStr.includes("{")) {
inputStr = atob(inputStr).replaceAll("}{", "}\n{")
}
const lines = inputStr.split('\n'); const lines = inputStr.split('\n');
const result = []; const result = [];
let currentLine = ''; let currentLine = '';
while (lines.length > 0) { while (lines.length > 0) {
currentLine = lines.shift(); currentLine += lines.shift();
try { try {
const entry = JSON.parse(currentLine); const entry = JSON.parse(currentLine);
result.push(entry); result.push(entry);
currentLine = '';
// if this chunk wasn't valid JSON, there was an escaped newline in the // if this chunk wasn't valid JSON, there was an escaped newline in the
// JSON line, so simply continue to the next one // JSON line, so simply continue to the next one
} catch (e) {} } catch (e) {}