braidfs 0.0.81 → 0.0.82

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 +11 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -482,7 +482,7 @@ async function proxy_url(url) {
482
482
 
483
483
  let a = new AbortController()
484
484
  aborts.add(a)
485
- await braid_fetch(url, {
485
+ var r = await braid_fetch(url, {
486
486
  signal: a.signal,
487
487
  headers: {
488
488
  "Merge-Type": "dt",
@@ -494,6 +494,16 @@ async function proxy_url(url) {
494
494
  ...stuff
495
495
  })
496
496
  aborts.delete(a)
497
+ // if we're not authorized,
498
+ if (r.status == 401 || r.status == 403) {
499
+ // and it's one of our versions (a local edit),
500
+ if (self.peer === braid_text.decode_version(stuff.version[0])[0]) {
501
+ // then revert it
502
+ console.log(`access denied: reverting local edits`)
503
+ unproxy_url(url)
504
+ proxy_url(url)
505
+ }
506
+ }
497
507
  } catch (e) {
498
508
  if (e?.name !== "AbortError") console.log(e)
499
509
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braidfs",
3
- "version": "0.0.81",
3
+ "version": "0.0.82",
4
4
  "description": "braid technology synchronizing files and webpages",
5
5
  "author": "Braid Working Group",
6
6
  "repository": "braid-org/braidfs",