From 47806991b8733cdeb8e7ef43ce49337626474b70 Mon Sep 17 00:00:00 2001 From: Jes Date: Fri, 18 May 2018 11:27:19 +0300 Subject: [PATCH] added editor, updated libraries, upnp fixes --- .DS_Store | Bin 8196 -> 0 bytes .gitignore | 1 + HACKS | 8 ++++++++ README.md | 2 ++ app/services/editor.js | 2 +- package.json | 39 ++++++++++++++++++++------------------- static/editor/diff.js | 6 ++++-- static/editor/editor.css | 8 ++++---- static/editor/editor.js | 33 ++++++++++++++++++++++++++------- static/editor/helpers.js | 3 +++ static/editor/index.html | 7 +++++-- static/main.js | 8 ++++++-- 12 files changed, 80 insertions(+), 37 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 079b8a414eff27d0de229f503fb80614cdda1c39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHM-EPw`6h21Q&q1q^-6uM*v_R!^+TBKmLIZ4*)9$#~LvL6WSH1U4=Pf2y=E2+8x&`hCkM* z-ASlBV;*y7VNNK*96f}i=p-r{ZEY2>3QQ}&XZIYr)TQoWCv|?miz_#ODpPJb^2nzk z!}^+GErQhtuS2agQ>N+>fem?}h65t+r>{Ps6Y?X}jJtzddM_uJ4CI z?D|2wm!Q9V?gy=KP!0P*D^l}3cHojs zl5+LN*1f}{)3@)2??)d#V=*vc-gI)$9#ARjob(-JS{?hdSwZ73t+tlir{{27eu1 zq3Wxkqn$}B!GTZCu#%Z!o*ySd(yvHQu(tbjKo5Z%c4g2Zga>aIBGscwFtmK)e65Al9q`7f6Aee%3Od|7-KV|6iaL z*+;bsSOxx60g*qbA5`I`cJ&$FyvsW%M<{H}8*5Z9s8T-!(4YLn5N!uk_Nf>gYs3i5 Peh5%9*vcyKR~7gLday2% diff --git a/.gitignore b/.gitignore index cce16948d9..ed330fb602 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ bower_components **/test package-lock.json unused +.DS_Store diff --git a/HACKS b/HACKS index 851085db0b..39919e670d 100644 --- a/HACKS +++ b/HACKS @@ -2,3 +2,11 @@ nat-upnp/lib/nat-upnp/client.js @@ -119,3 +119,3 @@ - protocol: data.NewProtocol.toLowerCase(), + protocol: (data.NewProtocol || '').toLowerCase(), + +used updated version from: +https://github.com/MelvinTo/node-nat-upnp + +cd node_modules/ot +npm i +node_modules/.bin/grunt --force +rm -r node_modules diff --git a/README.md b/README.md index e8ee9e1dc7..c66ba8be8d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,9 @@ supported OS: Linux,Mac,Windows * quick help for Marlin options and G-codes * compilation and uploading your customized firmware * console for access to serial ports +* **collaborative editor for whole project** * share your configuration on [the site](http://lt.rv.ua/mc) +* **automatical installer for PlatformIO** # Features: * automatically clone repository from [Marlin github](https://github.com/MarlinFirmware/Marlin) if you don't have it * instant changing of Configuration*.h files diff --git a/app/services/editor.js b/app/services/editor.js index 835ef72fa6..8a4a5d3183 100644 --- a/app/services/editor.js +++ b/app/services/editor.js @@ -93,7 +93,7 @@ router.post('/upload/*', function(req, res) { //git file TODO: git for multiproject router.get('/git/*', function(req, res) { git.Tag() - .then(tag => git.Show(tag, req.originalUrl.replace(/.*git\//, ''))) + .then(tag => git.Show(tag, req.originalUrl.replace(/.*git\//, '')).catch(a=>'')) .catch(e => res.status(501).send(e.message)) .then(data => res.send(data)) }) diff --git a/package.json b/package.json index a2219e3f05..7e73547cc4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "marlin-conf", - "version": "2.9.1", + "version": "2.10.1", "description": "configuration tool for Marlin project", "main": "./index.js", "scripts": { @@ -11,7 +11,7 @@ "test": "echo \"Error: no test specified\" && exit 1", "lint": "eslint .", "rebuild": "npm rebuild serialport --update-binary", - "prepublish": "./node_modules/.bin/json -I -f package.json -e 'if(this.devDependencies)this.devDependenciesOff=this.devDependencies;this.devDependencies=undefined'", + "prepublishOnly": "./node_modules/.bin/json -I -f package.json -e 'if(this.devDependencies)this.devDependenciesOff=this.devDependencies;this.devDependencies=undefined'", "postpublish": "./node_modules/.bin/json -I -f package.json -e 'if(this.devDependenciesOff)this.devDependencies=this.devDependenciesOff;this.devDependenciesOff=undefined'", "prebuild-": "sudo apt install icnsutils graphicsmagick" }, @@ -57,50 +57,51 @@ "homepage": "https://github.com/akaJes/marlin-config#readme", "dependencies": { "ace-builds": "^1.3.3", - "body-parser": "^1.17.2", + "body-parser": "^1.18.3", "bootstrap": "4.0.0-alpha.6", - "cropper": "^3.1.5", + "cropper": "^3.1.6", "data-store": "^1.0.0", - "diff-match-patch": "^1.0.0", - "express": "^4.16.2", + "diff-match-patch": "^1.0.1", + "electron-debug": "^1.5.0", + "express": "^4.16.3", "fix-path": "^2.1.0", "font-awesome": "^4.7.0", "form-data": "^2.3.2", - "formidable": "^1.1.1", + "formidable": "^1.2.1", "get-port": "^3.1.0", "highlight.js": "^9.11.0", "jquery": "^3.3.1", "jquery-ui-dist": "^1.12.1", - "js-yaml": "^3.8.4", + "js-yaml": "^3.11.0", "jstree": "^3.3.5", - "marked": "^0.3.16", + "marked": "^0.3.19", "mkdirp": "^0.5.1", - "moment": "^2.20.1", - "nat-upnp": "^1.1.1", + "moment": "^2.22.1", + "nat-upnp": "git+https://github.com/MelvinTo/node-nat-upnp.git", "node-machine-id": "^1.1.10", "node-notifier": "^5.2.1", - "opn": "^5.2.0", + "opn": "^5.3.0", "ot": "git+https://github.com/Operational-Transformation/ot.js.git", "platformio-node-helpers": "^0.4.3", "qr-image": "^3.2.0", "rtcmulticonnection-v3": "^3.4.4", - "serialport": "^6.1.0", - "simple-git": "^1.91.0", - "socket.io": "^2.0.4", + "serialport": "^6.2.0", + "simple-git": "^1.92.0", + "socket.io": "^2.1.1", "swig-templates": "^2.0.2", - "tether": "^1.4.3", + "tether": "^1.4.4", "tmp": "0.0.33", "tty2html": "^1.0.0", "universal-analytics": "^0.4.16", + "vex-js": "^4.1.0", "which": "^1.2.14", "yauzl": "^2.9.1", "yazl": "^2.4.3" }, "devDependencies": { "devtron": "^1.4.0", - "electron": "=1.7.10", - "electron-builder": "^20.2.0", - "electron-debug": "^1.5.0", + "electron": "latest", + "electron-builder": "latest", "eslint": "^4.18.1", "json": "^9.0.6", "nodemon": "^1.15.1" diff --git a/static/editor/diff.js b/static/editor/diff.js index bd7e9fecc3..d5b8b5016c 100644 --- a/static/editor/diff.js +++ b/static/editor/diff.js @@ -14,8 +14,9 @@ ace.define("diff", function(require, exports, module) { function DMP(editor) { this.editor = editor; var self = this; + var dc = debounce(scan, 500, self) this.onChange = function(obj, editor) { - self.scan(); + dc(); //self.scan(); } this.updateAnnotations = function(session) { self.editor.renderer.setAnnotations((session.$annotations || []).concat(session.diffAnnotations || [])) @@ -96,7 +97,8 @@ ace.define("diff", function(require, exports, module) { } return seek(-1).concat(quote(diffs[pos][1], diffs[pos][0]), seek(1)); } - this.scan = function() { + this.scan = scan; + function scan() { var session = this.editor.getSession(); session.diffAnnotations = []; var markers = session.getMarkers(); diff --git a/static/editor/editor.css b/static/editor/editor.css index 847d1964c6..056e761cb3 100644 --- a/static/editor/editor.css +++ b/static/editor/editor.css @@ -1,8 +1,8 @@ /* editor*/ -.added-gutter { background: #00AA0055; } -.changed-gutter { background: #AA000055; } -.changed-text { background: #AA000025; position:absolute; z-index:2;} -.added-text { background: #00AA0025; position:absolute; z-index:2;} +.added-gutter { background-color: rgba(0,170,0,.33); } +.changed-gutter { background-color: rgba(170,0,0,.33); } +.changed-text { background-color: rgba(170,0,0,.14); position:absolute; z-index:2;} +.added-text { background-color: rgba(0,170,0,.14); position:absolute; z-index:2;} .ace_gutter-cell { background-repeat: no-repeat; } /* layout */ html, body { diff --git a/static/editor/editor.js b/static/editor/editor.js index 0eb5d1ab88..4942d67dd3 100644 --- a/static/editor/editor.js +++ b/static/editor/editor.js @@ -2,14 +2,14 @@ var myName; var otI; var state; function createFileUploader(element, tree, editor) { - function addButton(name,fn){ - $(element).append($('