braidfs 0.0.26 → 0.0.27
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 +19 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -28,28 +28,38 @@ if (!require('fs').existsSync(braidfs_config_file)) {
|
|
|
28
28
|
let config = JSON.parse(require('fs').readFileSync(braidfs_config_file, 'utf8'))
|
|
29
29
|
|
|
30
30
|
// process command line args (override config)
|
|
31
|
+
console.log(`braidfs version: ${require('./package.json').version}`)
|
|
31
32
|
let argv = process.argv.slice(2)
|
|
32
33
|
let save_config = false
|
|
33
34
|
while (argv.length) {
|
|
34
35
|
let a = argv.shift()
|
|
35
36
|
if (a.match(/^\d+$/)) {
|
|
36
37
|
config.port = parseInt(a)
|
|
38
|
+
console.log(`setting port to ${config.port}`)
|
|
37
39
|
} else if (a === 'sync') {
|
|
38
40
|
let b = argv.shift()
|
|
39
41
|
if (b === 'index') {
|
|
40
42
|
config.sync_index_urls.push(argv.shift())
|
|
43
|
+
console.log(`syncing index url: ${config.sync_index_urls.slice(-1)[0]}`)
|
|
41
44
|
} else {
|
|
42
45
|
config.sync_urls.push(b)
|
|
46
|
+
console.log(`syncing url: ${config.sync_urls.slice(-1)[0]}`)
|
|
43
47
|
}
|
|
44
48
|
} else if (a === 'save') {
|
|
45
49
|
save_config = true
|
|
50
|
+
console.log(`will save new config file`)
|
|
46
51
|
} else if (a === 'expose') {
|
|
47
52
|
config.allow_remote_access = true
|
|
53
|
+
console.log(`exposing server to the outside world`)
|
|
48
54
|
} else if (a === 'unexpose') {
|
|
49
55
|
config.allow_remote_access = false
|
|
56
|
+
console.log(`unexpose server from the outside world`)
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
|
-
if (save_config)
|
|
59
|
+
if (save_config) {
|
|
60
|
+
require('fs').writeFileSync(braidfs_config_file, JSON.stringify(config, null, 4))
|
|
61
|
+
console.log(`saved config file`)
|
|
62
|
+
}
|
|
53
63
|
|
|
54
64
|
braid_text.db_folder = config.braid_text_db
|
|
55
65
|
|
|
@@ -77,6 +87,10 @@ braid_text.list().then(x => {
|
|
|
77
87
|
require('chokidar').watch(config.proxy_base).
|
|
78
88
|
on('change', (path) => {
|
|
79
89
|
path = require('path').relative(config.proxy_base, path)
|
|
90
|
+
|
|
91
|
+
// Skip any temp files with a # in the name
|
|
92
|
+
if (path.includes('#')) return
|
|
93
|
+
|
|
80
94
|
console.log(`path changed: ${path}`)
|
|
81
95
|
|
|
82
96
|
path = normalize_url(path)
|
|
@@ -86,6 +100,10 @@ require('chokidar').watch(config.proxy_base).
|
|
|
86
100
|
}).
|
|
87
101
|
on('add', async (path) => {
|
|
88
102
|
path = require('path').relative(config.proxy_base, path)
|
|
103
|
+
|
|
104
|
+
// Skip any temp files with a # in the name
|
|
105
|
+
if (path.includes('#')) return
|
|
106
|
+
|
|
89
107
|
console.log(`path added: ${path}`)
|
|
90
108
|
|
|
91
109
|
let url = null
|