@ethersphere/bee-js 9.7.0 → 9.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bee.js +2 -1
- package/dist/cjs/utils/chunk-stream.js +15 -3
- package/dist/cjs/utils/http.js +1 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +2 -1
- package/dist/mjs/utils/chunk-stream.js +14 -3
- package/dist/mjs/utils/http.js +1 -1
- package/dist/types/bee.d.ts +1 -1
- package/dist/types/utils/chunk-stream.d.ts +2 -2
- package/package.json +3 -3
package/dist/cjs/bee.js
CHANGED
|
@@ -722,7 +722,8 @@ class Bee {
|
|
|
722
722
|
for (let i = 0n; i < 0xffffn; i++) {
|
|
723
723
|
const signer = new typed_bytes_1.PrivateKey(cafe_utility_1.Binary.numberToUint256(start + i, 'BE'));
|
|
724
724
|
const socAddress = (0, soc_1.makeSOCAddress)(identifier, signer.publicKey().address());
|
|
725
|
-
|
|
725
|
+
// TODO: test the significance of the hardcoded 256
|
|
726
|
+
const actualProximity = 256 - cafe_utility_1.Binary.proximity(socAddress.toUint8Array(), targetOverlay.toUint8Array());
|
|
726
727
|
if (actualProximity <= 256 - proximity) {
|
|
727
728
|
return signer;
|
|
728
729
|
}
|
|
@@ -40,6 +40,7 @@ async function streamDirectory(bee, dir, postageBatchId, onUploadProgress, optio
|
|
|
40
40
|
for (const file of files) {
|
|
41
41
|
total += (0, chunk_size_1.totalChunks)(file.size);
|
|
42
42
|
}
|
|
43
|
+
let hasIndexHtml = false;
|
|
43
44
|
async function onChunk(chunk) {
|
|
44
45
|
await queue.enqueue(async () => {
|
|
45
46
|
await bee.uploadChunk(postageBatchId, chunk.build(), options, requestOptions);
|
|
@@ -64,11 +65,22 @@ async function streamDirectory(bee, dir, postageBatchId, onUploadProgress, optio
|
|
|
64
65
|
Filename: filename,
|
|
65
66
|
});
|
|
66
67
|
if (file.path === 'index.html') {
|
|
67
|
-
|
|
68
|
-
'website-index-document': 'index.html',
|
|
69
|
-
});
|
|
68
|
+
hasIndexHtml = true;
|
|
70
69
|
}
|
|
71
70
|
}
|
|
71
|
+
if (hasIndexHtml || options?.indexDocument || options?.errorDocument) {
|
|
72
|
+
const metadata = {};
|
|
73
|
+
if (options?.indexDocument) {
|
|
74
|
+
metadata['website-index-document'] = options.indexDocument;
|
|
75
|
+
}
|
|
76
|
+
else if (hasIndexHtml) {
|
|
77
|
+
metadata['website-index-document'] = 'index.html';
|
|
78
|
+
}
|
|
79
|
+
if (options?.errorDocument) {
|
|
80
|
+
metadata['website-error-document'] = options.errorDocument;
|
|
81
|
+
}
|
|
82
|
+
mantaray.addFork('/', __1.NULL_ADDRESS, metadata);
|
|
83
|
+
}
|
|
72
84
|
return mantaray.saveRecursively(bee, postageBatchId, options, requestOptions);
|
|
73
85
|
}
|
|
74
86
|
exports.streamDirectory = streamDirectory;
|
package/dist/cjs/utils/http.js
CHANGED
|
@@ -67,7 +67,7 @@ function maybeRunOnRequestHook(options, requestConfig) {
|
|
|
67
67
|
if (options.onRequest) {
|
|
68
68
|
options.onRequest({
|
|
69
69
|
method: requestConfig.method || 'GET',
|
|
70
|
-
url: cafe_utility_1.Strings.joinUrl(requestConfig.baseURL, requestConfig.url),
|
|
70
|
+
url: cafe_utility_1.Strings.joinUrl([requestConfig.baseURL, requestConfig.url]),
|
|
71
71
|
headers: { ...requestConfig.headers },
|
|
72
72
|
params: requestConfig.params,
|
|
73
73
|
});
|