From f0b67be017c47517116fa2707f915091e9a9cddc Mon Sep 17 00:00:00 2001 From: kaotisk Date: Thu, 24 Jul 2025 22:11:45 +0300 Subject: [fs] Now AKFS downloads are offered with their names --- src/js/arching-kaos-file-system.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 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 1c12a06..bee474e 100644 --- a/src/js/arching-kaos-file-system.js +++ b/src/js/arching-kaos-file-system.js @@ -88,10 +88,21 @@ function akfsFromMapGetOriginalHash(reply, params) function akfsFromMapGetOriginalFilename(reply, params) { - const [ hash ] = params; + const [ data, toDownload ] = params; if(typeof(reply) === "string") { - console.log(reply.split('\n')[0].split(' ')[1]); + // console.log(reply.split('\n')[0].split(' ')[1]); + var first_line = reply.split('\n')[0].split(' '); + var filename = ""; + for ( let i = 1; i < first_line.length; i++ ) + { + filename += first_line[i]; + if ( i < first_line.length - 1 ) + { + filename += " "; + } + } + if ( toDownload ) offerDownloadableData(data, filename); } } @@ -159,9 +170,9 @@ export function akfsWorkOnChunks() { akfsSerializeChunks(thingy.root_hash); var data = makeUpData(); - offerDownloadableData(data); + archingKaosFetchBlob(akfsGetMapURL(thingy.map_hash), akfsFromMapGetOriginalFilename, [data, true]); downloaded = true; - console.log(workspace); + // console.log(workspace); } function akfsChunkOrLeaf(reply, params) -- cgit v1.2.3