braidfs 0.0.135 → 0.0.136

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 +19 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -604,6 +604,12 @@ function sync_url(url) {
604
604
 
605
605
  self.file_mtimeNs_str = '' + stat.mtimeNs
606
606
  await save_meta()
607
+ if (freed) return
608
+
609
+ if (self.file_read_only !== null && await is_read_only(fullpath) !== self.file_read_only) {
610
+ if (freed) return
611
+ await set_read_only(fullpath, self.file_read_only)
612
+ }
607
613
  } catch (e) {
608
614
  if (e.code === 'ENOENT') return null
609
615
  throw e
@@ -648,11 +654,23 @@ function sync_url(url) {
648
654
  ...(x => x && { Cookie: x })(config.cookies?.[new URL(url).hostname])
649
655
  },
650
656
  on_pre_connect: () => reconnect_rate_limiter.get_turn(url),
651
- on_res: res => {
657
+ on_res: async res => {
652
658
  if (freed) return
653
659
  reconnect_rate_limiter.on_conn(url)
654
660
  self.file_read_only = res.headers.get('editable') === 'false'
655
661
  console.log(`connected to ${url}${self.file_read_only ? ' (readonly)' : ''}`)
662
+
663
+ await within_fiber(fullpath, async () => {
664
+ var fullpath = await get_fullpath()
665
+ if (freed) return
666
+
667
+ try {
668
+ if (await is_read_only(fullpath) !== self.file_read_only) {
669
+ if (freed) return
670
+ await set_read_only(fullpath, self.file_read_only)
671
+ }
672
+ } catch (e) {}
673
+ })
656
674
  },
657
675
  on_unauthorized: async () => {
658
676
  console.log(`access denied: reverting local edits`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braidfs",
3
- "version": "0.0.135",
3
+ "version": "0.0.136",
4
4
  "description": "braid technology synchronizing files and webpages",
5
5
  "author": "Braid Working Group",
6
6
  "repository": "braid-org/braidfs",