braidfs 0.0.89 → 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.
Files changed (2) hide show
  1. package/index.js +12 -11
  2. package/package.json +3 -3
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: true,
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 they have the fork point
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] they have our latest fork point, horray!`)
752
+ console.log(`[find_fork_point] it has our latest fork point, hooray!`)
753
753
  return self.fork_point
754
754
  }
755
755
  }
@@ -812,6 +812,7 @@ async function sync_url(url) {
812
812
  },
813
813
  subscribe: true,
814
814
  retry: {
815
+ retryRes: () => true,
815
816
  onRes: (res) => {
816
817
  if (res.status !== 209)
817
818
  return log_error(`Can't sync ${url} -- got bad response ${res.status} from server (expected 209)`)
@@ -848,7 +849,7 @@ async function sync_url(url) {
848
849
  await braid_text.put(url, { ...update, peer: self.peer, merge_type: 'dt' })
849
850
 
850
851
  // the server is giving us this version,
851
- // so they must have it,
852
+ // so it must have it,
852
853
  // so let's add it to our fork point
853
854
  await self.update_fork_point(update.version[0], update.parents)
854
855
 
@@ -858,7 +859,7 @@ async function sync_url(url) {
858
859
  }).catch(e => (e?.name !== "AbortError") && console.log(e))
859
860
  }
860
861
 
861
- // send them stuff we have but they don't
862
+ // send it stuff we have but it doesn't't
862
863
  async function send_new_stuff(fork_point) {
863
864
  var in_parallel = create_parallel_promises(10)
864
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.89",
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
- "braid-http": "^1.3.73",
10
- "braid-text": "^0.2.28",
9
+ "braid-http": "^1.3.75",
10
+ "braid-text": "^0.2.30",
11
11
  "chokidar": "^3.6.0"
12
12
  },
13
13
  "bin": {