Update hub ! (#1134)

* Fix the "/" bug.

* Update the "hub-test" to make them work everywhere!
This commit is contained in:
Hector 2021-09-16 17:54:01 +02:00 committed by GitHub
parent edf6c5f38d
commit 0b158667a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -57,7 +57,7 @@ function watch(what, options) {
if (options.msg) log(`File ${path} has been added`);
if(path[path.search(/^./gm)] === "/" || ".") {
gun.get('hub').get(modifiedPath + path).put(fs.readFileSync(path, 'utf-8'))
gun.get('hub').get(modifiedPath + '/' + path).put(fs.readFileSync(path, 'utf-8'))
} else {
gun.get('hub').get(modifiedPath + '/' + path).put(fs.readFileSync(path, 'utf-8'))
}

View File

@ -2,8 +2,8 @@
// const gun = Gun();
// gun.get('hub').on(data => {
// console.log(data['/home/noctisatrae/gun/test/hub/index.html'])
// console.log(data[`${__dirname}/index.html`])
// })
const hub = require('../../lib/hub');
hub.watch('/home/noctisatrae/gun/test/hub', {msg: true, hubignore: true})
hub.watch(__dirname, {msg: true, hubignore: true})