braidfs 0.0.48 → 0.0.50

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 +13 -4
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -120,13 +120,13 @@ async function main() {
120
120
  config = JSON.parse(x)
121
121
 
122
122
  // did anything get deleted?
123
- var old_syncs = Object.keys(prev.sync).map(url => normalize_url(url).replace(/^https?:\/\//, ''))
124
- var new_syncs = new Set(Object.keys(config.sync).map(url => normalize_url(url).replace(/^https?:\/\//, '')))
123
+ var old_syncs = Object.entries(prev.sync).filter(x => x[1]).map(x => normalize_url(x[0]).replace(/^https?:\/\//, ''))
124
+ var new_syncs = new Set(Object.entries(config.sync).filter(x => x[1]).map(x => normalize_url(x[0]).replace(/^https?:\/\//, '')))
125
125
  for (let url of old_syncs.filter(x => !new_syncs.has(x)))
126
126
  unproxy_url(url)
127
127
 
128
128
  // proxy all the new stuff
129
- for (let url of Object.keys(config.sync)) proxy_url(url)
129
+ for (let x of Object.entries(config.sync)) if (x[1]) proxy_url(x[0])
130
130
 
131
131
  // if any auth stuff has changed,
132
132
  // have the appropriate connections reconnect
@@ -154,7 +154,7 @@ async function main() {
154
154
  proxy_url('.braidfs/errors')
155
155
 
156
156
  console.log({ sync: config.sync })
157
- for (let url of Object.keys(config.sync)) proxy_url(url)
157
+ for (let x of Object.entries(config.sync)) if (x[1]) proxy_url(x[0])
158
158
 
159
159
  watch_files()
160
160
  setTimeout(scan_files, 1200)
@@ -301,6 +301,7 @@ async function proxy_url(url) {
301
301
  if (!proxy_url.cache[path]) proxy_url.cache[path] = proxy_url.chain = proxy_url.chain.then(async () => {
302
302
  var freed = false,
303
303
  aborts = new Set(),
304
+ braid_text_get_options = null,
304
305
  wait_count = 0
305
306
  var wait_promise, wait_promise_done
306
307
  var start_something = () => {
@@ -318,6 +319,7 @@ async function proxy_url(url) {
318
319
  freed = true
319
320
  for (let a of aborts) a.abort()
320
321
  await wait_promise
322
+ if (braid_text_get_options) await braid_text.forget(url, braid_text_get_options)
321
323
  await braid_text.delete(url)
322
324
  try { await require('fs').promises.unlink(meta_path) } catch (e) {}
323
325
  try { await require('fs').promises.unlink(await get_fullpath()) } catch (e) {}
@@ -649,6 +651,13 @@ async function proxy_url(url) {
649
651
  finish_something()
650
652
  }
651
653
 
654
+ // for config and errors file, listen for web changes
655
+ if (!is_external_link) braid_text.get(url, braid_text_get_options = {
656
+ merge_type: 'dt',
657
+ peer,
658
+ subscribe: signal_file_needs_writing,
659
+ })
660
+
652
661
  return self
653
662
  })
654
663
  return await proxy_url.cache[url]
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "braidfs",
3
- "version": "0.0.48",
3
+ "version": "0.0.50",
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.13",
9
+ "braid-http": "^1.3.16",
10
10
  "braid-text": "^0.2.5",
11
11
  "chokidar": "^3.6.0"
12
12
  },