ensure posts are posts and not other blocks

This commit is contained in:
Kevin Froman 2020-10-07 23:18:54 +00:00
parent ecba9555d9
commit 7056475e17
2 changed files with 6 additions and 2 deletions

View File

@ -139,7 +139,11 @@ async function findMessages(){
document.getElementById('memUsage').innerText = getReadableFileSizeString(current + ((basicTextEncoder.encode(data)).length + block.length))
}
try{
let metadata = JSON.parse(d.split("\n")[0])
var metadata = JSON.parse(d.split("\n")[0])
// Make sure the block is an actual post so nodes can't send us stuff unrelated to dapp
if (JSON.parse(metadata['meta'])['type'] !== 'kic'){
throw new Error("Not correct block type: " + block)
}
}
catch(e){
console.debug(e)

View File

@ -15,7 +15,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
importScripts("onionr-jspow/index.js")
importScripts("jspow/index.js")
importScripts("sha3.js")
self.addEventListener('message', function(e) {