From 427a5355bc292da9ef0f9072d866f702552c5de4 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 24 Mar 2020 00:21:46 -0500 Subject: [PATCH] switched circle post loader to use fetch instead of xml http --- static-data/www/board/board.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/static-data/www/board/board.js b/static-data/www/board/board.js index 03f868c0..7cbe95ec 100755 --- a/static-data/www/board/board.js +++ b/static-data/www/board/board.js @@ -147,19 +147,26 @@ function getBlocks(){ } - var feedText = httpGet('/flow/getpostsbyboard/' + ch) // TODO switch to fetch - var blockList = feedText.split(',') + fetch('/flow/getpostsbyboard/' + ch, { + method: 'GET', + headers: { + "token": webpass + }}) + .then((resp) => resp.text()) + .then(function(feedText) { + var blockList = feedText.split(',') - for (i = 0; i < blockList.length; i++){ - blockList[i] = "0".repeat(64 - blockList[i].length) + blockList[i] // pad hash with zeroes + for (i = 0; i < blockList.length; i++){ + blockList[i] = "0".repeat(64 - blockList[i].length) + blockList[i] // pad hash with zeroes - if (! requested.includes(blockList[i])){ - if (blockList[i].length == 0) continue - else requested.push(blockList[i]) - loadMessage(blockList[i], blockList, i, ch); + if (! requested.includes(blockList[i])){ + if (blockList[i].length == 0) continue + else requested.push(blockList[i]) + loadMessage(blockList[i], blockList, i, ch); + } } - } - sortEntries() + sortEntries() + }) } function loadMessage(blockHash, blockList, count, channel){