From e7c96d4048d8b36e7699d0786e51110981f05863 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 22 Dec 2024 07:41:37 +0200 Subject: Kinda stable --- src/js/arching-kaos-file-system.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/js/arching-kaos-file-system.js') diff --git a/src/js/arching-kaos-file-system.js b/src/js/arching-kaos-file-system.js index 3c66cc2..4ceb507 100644 --- a/src/js/arching-kaos-file-system.js +++ b/src/js/arching-kaos-file-system.js @@ -1,4 +1,4 @@ -// Arching Kaos Fetch +// Arching Kaos File System // // Kaotisk Hund - 2024 // @@ -15,6 +15,7 @@ var leafs_head_counter = 0; var first_chunk_spotted = 0; var first_chunk_size = 0; var final_array_seq = []; +var status = []; var output = ""; function akfsReset() @@ -27,6 +28,7 @@ function akfsReset() first_chunk_size = 0; final_array_seq = null; final_array_seq = []; + status = []; output = ""; } @@ -70,6 +72,7 @@ function akfsFromMapGetLevelOneMapHash(reply, params) map_hash: hash }; thingy[`${level_1_map}`] = []; + status[`${level_1_map}`] = 'working'; } } @@ -121,7 +124,7 @@ function akfsChunkOrLeaf(reply, params) var base64regexp = /^[-A-Za-z0-9+/]*={0,3}$/; if(typeof(reply) === "string") { - if ( hashregexp.test(reply.split('\n')[0]) && hashregexp.test(reply.split('\n')[1]) ) + if ( hashregexp.test(reply.split('\n')[0]) && hashregexp.test(reply.split('\n')[1]) && ( thingy.leafs[hash] === undefined ) ) { if ( leafs_counter === 0 ) { @@ -144,11 +147,11 @@ function akfsChunkOrLeaf(reply, params) { console.log("Current is a root_hash"); } - if ( thingy[hash] !== undefined ) - { - thingy[hash][reply.split('\n')[0]] = []; - thingy[hash][reply.split('\n')[1]] = []; - } + // if ( thingy[hash] !== undefined ) + // { + // thingy[hash][reply.split('\n')[0]] = []; + // thingy[hash][reply.split('\n')[1]] = []; + // } var leaf = { hash: hash, head: reply.split('\n')[0], @@ -163,12 +166,12 @@ function akfsChunkOrLeaf(reply, params) archingKaosFetchBlob(akfsGetChunkURL(leaf.tail), akfsChunkOrLeaf, [leaf.tail, hash]); } } - else if ( base64regexp.test(reply.split('\n')[0]) ) + else if ( base64regexp.test(reply.replaceAll('\n', '')) && ( thingy.chunks[hash] === undefined ) ) { if ( first_chunk_spotted === 0 ) { first_chunk_spotted = leafs_head_counter; - console.log("first_chunk_spotted : "+ first_chunk_spotted); + // console.log(`first_chunk_spotted : ${first_chunk_spotted}`); first_chunk_size = reply.length; } var chunk = { -- cgit v1.2.3