From f3249e31f3f7c9b709f203d2a01a38892d771996 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Thu, 11 Apr 2024 16:17:29 +0300 Subject: recursion setting for crawling a zblock --- src/js/arching-kaos-tools.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/js/arching-kaos-tools.js b/src/js/arching-kaos-tools.js index 9ad399e..af62072 100644 --- a/src/js/arching-kaos-tools.js +++ b/src/js/arching-kaos-tools.js @@ -68,7 +68,8 @@ function renderZblockAndProceed(json, params){ } progressPlaceholder.max++; progressPlaceholder.value++; - if (recursive) seekBlock(json.block,zblockIPFSHash,group,json); + //if (recursive) seekBlock(json.block,zblockIPFSHash,group,json); + seekBlock(json.block,zblockIPFSHash,group,json,recursive); } function mixtapeSorting(a,b){ @@ -76,7 +77,7 @@ function mixtapeSorting(a,b){ } function blockRenderAndProceed(json, params){ - const [group, zblockIPFSHash, blockIPFSHash, zblockObject] = params; + const [group, zblockIPFSHash, blockIPFSHash, zblockObject, recursive] = params; /* Could be json object with * - action * - data @@ -141,7 +142,7 @@ function blockRenderAndProceed(json, params){ resolveReferences(references); } else { console.log("deep in :" +group); - seekZblock(json.previous, [group]); + if (recursive) seekZblock(json.previous, [group]); } } @@ -190,15 +191,20 @@ function checkIfGenesis(zblockIPFSHash){ } } -function seekBlock(blockIPFSHash, zblockIPFSHash, group, zblockObject){ +function seekBlock(blockIPFSHash, zblockIPFSHash, group, zblockObject, recursive){ console.log(blockIPFSHash); console.log(zblockIPFSHash); console.log(group); console.log(zblockObject); + console.log(recursive); archingKaosLog("Seeking block "+blockIPFSHash+"..."); detailsPlace = document.querySelector('#zb-'+zblockIPFSHash); progressPlaceholder.max++; - archingKaosFetchJSON(getIPFSURL(blockIPFSHash), blockRenderAndProceed, [group, zblockIPFSHash, blockIPFSHash, zblockObject]); + archingKaosFetchJSON( + getIPFSURL(blockIPFSHash), + blockRenderAndProceed, + [group, zblockIPFSHash, blockIPFSHash, zblockObject, recursive] + ); } function getNicknameAssossiatedWithGPG(gpgIPFSHash){ @@ -254,9 +260,9 @@ function seekZblock(zblockIPFSHash, params){ renderGroupOnDataSection(group); renderZblockUnderGroup(zblockIPFSHash, group); archingKaosLog("Seeking ZBLOCK " + zblockIPFSHash + "..."); - if (recursive !== true || recursive !== false){ - recursive = true; - } +// if (recursive !== true || recursive !== false){ +// recursive = true; +// } archingKaosFetchJSON(getIPFSURL(zblockIPFSHash), renderZblockAndProceed, [zblockIPFSHash, group, recursive]); } -- cgit v1.2.3