braidfs 0.0.71 → 0.0.73
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 +2 -33
- package/index.sh +3 -2
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -53,38 +53,6 @@ To run daemon in background:
|
|
|
53
53
|
launchctl submit -l org.braid.braidfs -- braidfs run` : ''
|
|
54
54
|
let argv = process.argv.slice(2)
|
|
55
55
|
|
|
56
|
-
if (argv[0] === 'editing') {
|
|
57
|
-
return (async () => {
|
|
58
|
-
var filename = argv[1]
|
|
59
|
-
if (!require('path').isAbsolute(filename))
|
|
60
|
-
filename = require('path').resolve(process.cwd(), filename)
|
|
61
|
-
var input_string = await new Promise(done => {
|
|
62
|
-
const chunks = []
|
|
63
|
-
process.stdin.on('data', chunk => chunks.push(chunk))
|
|
64
|
-
process.stdin.on('end', () => done(Buffer.concat(chunks).toString()))
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
var r = await fetch(`http://localhost:${config.port}/.braidfs/get_version/${encodeURIComponent(filename)}/${encodeURIComponent(sha256(input_string))}`)
|
|
68
|
-
if (!r.ok) throw new Error(`bad status: ${r.status}`)
|
|
69
|
-
console.log(await r.text())
|
|
70
|
-
})()
|
|
71
|
-
} else if (argv[0] === 'edited') {
|
|
72
|
-
return (async () => {
|
|
73
|
-
var filename = argv[1]
|
|
74
|
-
if (!require('path').isAbsolute(filename))
|
|
75
|
-
filename = require('path').resolve(process.cwd(), filename)
|
|
76
|
-
var parent_version = argv[2]
|
|
77
|
-
var input_string = await new Promise(done => {
|
|
78
|
-
const chunks = []
|
|
79
|
-
process.stdin.on('data', chunk => chunks.push(chunk))
|
|
80
|
-
process.stdin.on('end', () => done(Buffer.concat(chunks).toString()))
|
|
81
|
-
})
|
|
82
|
-
var r = await fetch(`http://localhost:${config.port}/.braidfs/set_version/${encodeURIComponent(filename)}/${encodeURIComponent(parent_version)}`, { method: 'PUT', body: input_string })
|
|
83
|
-
if (!r.ok) throw new Error(`bad status: ${r.status}`)
|
|
84
|
-
console.log(await r.text())
|
|
85
|
-
})()
|
|
86
|
-
}
|
|
87
|
-
|
|
88
56
|
console.log(`braidfs version: ${require(`${__dirname}/package.json`).version}`)
|
|
89
57
|
|
|
90
58
|
if (argv.length === 1 && argv[0].match(/^(run|serve)$/)) {
|
|
@@ -159,7 +127,8 @@ async function main() {
|
|
|
159
127
|
var path = require('path').relative(proxy_base, fullpath)
|
|
160
128
|
var proxy = await proxy_url.cache[normalize_url(path)]
|
|
161
129
|
var version = proxy?.hash_to_version_cache.get(hash)?.version
|
|
162
|
-
|
|
130
|
+
if (!version) res.statusCode = 404
|
|
131
|
+
return res.end(JSON.stringify(version))
|
|
163
132
|
}
|
|
164
133
|
|
|
165
134
|
var m = url.match(/^\.braidfs\/set_version\/([^\/]*)\/([^\/]*)/)
|
package/index.sh
CHANGED
|
@@ -58,9 +58,10 @@ if [ "$1" = "editing" ]; then
|
|
|
58
58
|
HASH=$(calculate_sha256)
|
|
59
59
|
|
|
60
60
|
# Make HTTP request
|
|
61
|
-
RESPONSE=$(curl -s "http://localhost:${PORT}/.braidfs/get_version/$(urlencode "$FILENAME")/$(urlencode "$HASH")")
|
|
61
|
+
RESPONSE=$(curl -s -f "http://localhost:${PORT}/.braidfs/get_version/$(urlencode "$FILENAME")/$(urlencode "$HASH")")
|
|
62
|
+
CURL_EXIT_CODE=$?
|
|
62
63
|
echo "$RESPONSE"
|
|
63
|
-
exit
|
|
64
|
+
exit $CURL_EXIT_CODE
|
|
64
65
|
|
|
65
66
|
# Check if the first argument is "edited"
|
|
66
67
|
elif [ "$1" = "edited" ]; then
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "braidfs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.73",
|
|
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.
|
|
9
|
+
"braid-http": "^1.3.73",
|
|
10
10
|
"braid-text": "^0.2.11",
|
|
11
11
|
"chokidar": "^3.6.0"
|
|
12
12
|
},
|