mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-26 15:39:59 -07:00
daemon: fix some bugs in the frontend js
This commit is contained in:
committed by
Cooper Quintin
parent
16f705f29c
commit
f3e4091e1d
@@ -43,17 +43,15 @@ async function updateAnalysisStatus(qmdlManifest) {
|
||||
}
|
||||
|
||||
function parseNewlineDelimitedJSON(inputStr) {
|
||||
if(! inputStr.includes("{")) {
|
||||
inputStr = atob(inputStr).replaceAll("}{", "}\n{")
|
||||
}
|
||||
const lines = inputStr.split('\n');
|
||||
const result = [];
|
||||
let currentLine = '';
|
||||
while (lines.length > 0) {
|
||||
currentLine = lines.shift();
|
||||
currentLine += lines.shift();
|
||||
try {
|
||||
const entry = JSON.parse(currentLine);
|
||||
result.push(entry);
|
||||
currentLine = '';
|
||||
// if this chunk wasn't valid JSON, there was an escaped newline in the
|
||||
// JSON line, so simply continue to the next one
|
||||
} catch (e) {}
|
||||
|
||||
Reference in New Issue
Block a user