braidfs 0.0.90 → 0.0.91
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/index.js +11 -11
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -375,6 +375,12 @@ async function sync_url(url) {
|
|
|
375
375
|
fullpath = `${sync_base}/${path}`,
|
|
376
376
|
meta_path = `${sync_base_meta}/${braid_text.encode_filename(url)}`
|
|
377
377
|
|
|
378
|
+
async function get_fullpath() {
|
|
379
|
+
var p = fullpath
|
|
380
|
+
while (await is_dir(p)) p = require("path").join(p, 'index')
|
|
381
|
+
return p
|
|
382
|
+
}
|
|
383
|
+
|
|
378
384
|
if (!sync_url.cache) sync_url.cache = {}
|
|
379
385
|
if (!sync_url.chain) sync_url.chain = Promise.resolve()
|
|
380
386
|
if (!sync_url.cache[path]) {
|
|
@@ -425,12 +431,6 @@ async function sync_url(url) {
|
|
|
425
431
|
|
|
426
432
|
finish_something()
|
|
427
433
|
|
|
428
|
-
async function get_fullpath() {
|
|
429
|
-
var p = fullpath
|
|
430
|
-
while (await is_dir(p)) p = require("path").join(p, 'index')
|
|
431
|
-
return p
|
|
432
|
-
}
|
|
433
|
-
|
|
434
434
|
self.peer = Math.random().toString(36).slice(2)
|
|
435
435
|
self.local_edit_counter = 0
|
|
436
436
|
self.fork_point = null
|
|
@@ -498,7 +498,7 @@ async function sync_url(url) {
|
|
|
498
498
|
"Content-Type": 'text/plain',
|
|
499
499
|
...(x => x && {Cookie: x})(config.cookies?.[new URL(url).hostname])
|
|
500
500
|
},
|
|
501
|
-
retry: { retryRes:
|
|
501
|
+
retry: { retryRes: r => r.status !== 401 && r.status !== 403 },
|
|
502
502
|
...params
|
|
503
503
|
})
|
|
504
504
|
} catch (e) {
|
|
@@ -745,11 +745,11 @@ async function sync_url(url) {
|
|
|
745
745
|
async function find_fork_point() {
|
|
746
746
|
console.log(`[find_fork_point] url: ${url}`)
|
|
747
747
|
|
|
748
|
-
// see if
|
|
748
|
+
// see if remote has the fork point
|
|
749
749
|
if (self.fork_point) {
|
|
750
750
|
var r = await my_fetch({ method: "HEAD", version: self.fork_point })
|
|
751
751
|
if (r.ok) {
|
|
752
|
-
console.log(`[find_fork_point]
|
|
752
|
+
console.log(`[find_fork_point] it has our latest fork point, hooray!`)
|
|
753
753
|
return self.fork_point
|
|
754
754
|
}
|
|
755
755
|
}
|
|
@@ -849,7 +849,7 @@ async function sync_url(url) {
|
|
|
849
849
|
await braid_text.put(url, { ...update, peer: self.peer, merge_type: 'dt' })
|
|
850
850
|
|
|
851
851
|
// the server is giving us this version,
|
|
852
|
-
// so
|
|
852
|
+
// so it must have it,
|
|
853
853
|
// so let's add it to our fork point
|
|
854
854
|
await self.update_fork_point(update.version[0], update.parents)
|
|
855
855
|
|
|
@@ -859,7 +859,7 @@ async function sync_url(url) {
|
|
|
859
859
|
}).catch(e => (e?.name !== "AbortError") && console.log(e))
|
|
860
860
|
}
|
|
861
861
|
|
|
862
|
-
// send
|
|
862
|
+
// send it stuff we have but it doesn't't
|
|
863
863
|
async function send_new_stuff(fork_point) {
|
|
864
864
|
var in_parallel = create_parallel_promises(10)
|
|
865
865
|
await braid_text.get(url, braid_text_get_options = {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "braidfs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.91",
|
|
4
4
|
"description": "braid technology synchronizing files and webpages",
|
|
5
5
|
"author": "Braid Working Group",
|
|
6
6
|
"repository": "braid-org/braidfs",
|
|
7
7
|
"homepage": "https://braid.org",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"braid-http": "^1.3.75",
|
|
10
|
-
"braid-text": "^0.2.
|
|
10
|
+
"braid-text": "^0.2.30",
|
|
11
11
|
"chokidar": "^3.6.0"
|
|
12
12
|
},
|
|
13
13
|
"bin": {
|