mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-28 08:29:58 -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) {
|
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) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user