braidfs 0.0.47 → 0.0.49
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 +5 -5
- package/package.json +1 -1
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.
|
|
124
|
-
var new_syncs = new Set(Object.
|
|
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
|
|
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
|
|
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)
|
|
@@ -231,7 +231,7 @@ async function watch_files() {
|
|
|
231
231
|
var proxy = await proxy_url.cache[normalize_url(path)]
|
|
232
232
|
|
|
233
233
|
if (proxy && event != 'add') proxy.signal_file_needs_reading()
|
|
234
|
-
if (!proxy) await trash_file(fullpath, path)
|
|
234
|
+
if (!proxy && event != 'unlink') await trash_file(fullpath, path)
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
|