From 48681a8f6e155e90bb50ca2416531af0ab6bde99 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Mar 2018 10:38:14 +0200 Subject: [PATCH 1/5] use binary --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 69c8a42c7c..683c10be0e 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bin" : { "remixd" : "./bin/remixd" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "node ./src/main.js" + "start": "./bin/remixd" }, "repository": { "type": "git", From 7e61c9b86e6e25afa32a2e3e0c6c8fcd24cc194c Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Mar 2018 10:38:49 +0200 Subject: [PATCH 2/5] comment listening 'add', 'addDir' --- src/services/sharedFolder.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/sharedFolder.js b/src/services/sharedFolder.js index 9965c4d1f7..49a330611f 100644 --- a/src/services/sharedFolder.js +++ b/src/services/sharedFolder.js @@ -99,16 +99,19 @@ module.exports = { setupNotifications: function (path) { if (!isRealPath(path)) return var watcher = chokidar.watch(path, {depth: 0, ignorePermissionErrors: true}) - console.log('setup ntifications for ' + path) + console.log('setup notifications for ' + path) + /* we can't listen on created file / folder watcher.on('add', (f, stat) => { isbinaryfile(f, (error, isBinary) => { if (error) console.log(error) + console.log('add', f) if (this.websocket.connection) this.websocket.send(message('created', { path: utils.relativePath(f, this.sharedFolder), isReadOnly: isBinary, isFolder: false })) }) }) watcher.on('addDir', (f, stat) => { if (this.websocket.connection) this.websocket.send(message('created', { path: utils.relativePath(f, this.sharedFolder), isReadOnly: false, isFolder: true })) }) + */ watcher.on('change', (f, curr, prev) => { if (this.trackDownStreamUpdate[f]) { delete this.trackDownStreamUpdate[f] From 014271da71ea1159d780da4ec861a2676a82aa2c Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Mar 2018 10:39:14 +0200 Subject: [PATCH 3/5] fix get return value if readonly --- src/services/sharedFolder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/sharedFolder.js b/src/services/sharedFolder.js index 49a330611f..98b3f5e35c 100644 --- a/src/services/sharedFolder.js +++ b/src/services/sharedFolder.js @@ -46,7 +46,7 @@ module.exports = { isbinaryfile(path, (error, isBinary) => { if (error) console.log(error) if (isBinary) { - cb(null, '') + cb(null, {content: '', readonly: true}) } else { fs.readFile(path, 'utf8', (error, data) => { if (error) console.log(error) From b522bccf5bafbc5685a778928682acb3771b4a12 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Mar 2018 10:39:48 +0200 Subject: [PATCH 4/5] don't overwrite content with junk --- src/services/sharedFolder.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/sharedFolder.js b/src/services/sharedFolder.js index 98b3f5e35c..76637e78b9 100644 --- a/src/services/sharedFolder.js +++ b/src/services/sharedFolder.js @@ -64,6 +64,10 @@ module.exports = { set: function (args, cb) { var path = utils.absolutePath(args.path, this.sharedFolder) if (fs.existsSync(path) && !isRealPath(path, cb)) return + if (args.content === 'undefined') { // no !!!!! + console.log('trying to write "undefined" ! stopping.') + return + } this.trackDownStreamUpdate[path] = path fs.writeFile(path, args.content, 'utf8', (error, data) => { if (error) console.log(error) From a75754e7925a027d8483af13e0d14a58701d96af Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 28 Mar 2018 10:40:05 +0200 Subject: [PATCH 5/5] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 683c10be0e..2ffac1d639 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "remixd", - "version": "0.1.8-alpha.3", + "version": "0.1.8-alpha.4", "description": "remix server: allow accessing file system from remix.ethereum.org and start a dev environment (see help section)", "main": "./src/index.js", "bin" : { "remixd" : "./bin/remixd" },