Browse Source

feat: add auth middleware

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1631/head
Pranav C 3 years ago
parent
commit
5225f7f79a
  1. 5
      .run/Clear metadb.run.xml
  2. 14
      .run/build.run.xml
  3. 12
      .run/dev.run.xml
  4. 14
      .run/watch_run_mysql.run.xml
  5. 340
      packages/nc-gui/package-lock.json
  6. 2
      packages/nc-gui/package.json
  7. 25
      packages/nc-gui/plugins/tele.js
  8. 360
      packages/nocodb/package-lock.json
  9. 2
      packages/nocodb/package.json
  10. 35
      packages/nocodb/src/lib/noco/meta/api/index.ts
  11. 2
      packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts

5
.run/Clear metadb.run.xml

@ -0,0 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Drop metadb" type="NodeJSConfigurationType" path-to-js-file="deleteMetaDb.js" working-dir="$PROJECT_DIR$/packages/nocodb/src/example">
<method v="2" />
</configuration>
</component>

14
.run/build.run.xml

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Build Nc Common" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/packages/nocodb-sdk/package.json" />
<command value="run" />
<scripts>
<script value="build" />
</scripts>
<node-interpreter value="project" />
<envs>
<env name="NC_CACHE_DISABLED" value="true" />
</envs>
<method v="2" />
</configuration>
</component>

12
.run/dev.run.xml

@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run GUI" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/packages/nc-gui/package.json" />
<command value="run" />
<scripts>
<script value="dev" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>

14
.run/watch_run_mysql.run.xml

@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run NocoDB Mysql" type="js.build_tools.npm" activateToolWindowBeforeRun="false">
<package-json value="$PROJECT_DIR$/packages/nocodb/package.json" />
<command value="run" />
<scripts>
<script value="watch:run:mysql" />
</scripts>
<node-interpreter value="project" />
<envs>
<env name="NC_DISABLE_CACHE" value="true" />
</envs>
<method v="2" />
</configuration>
</component>

340
packages/nc-gui/package-lock.json generated

@ -31,7 +31,7 @@
"odometer": "^0.4.8", "odometer": "^0.4.8",
"papaparse": "^5.3.1", "papaparse": "^5.3.1",
"secure-ls": "^1.2.6", "secure-ls": "^1.2.6",
"socket.io-client": "^2.3.0", "socket.io-client": "^4.4.1",
"splitpanes": "^2.2.1", "splitpanes": "^2.2.1",
"sql-formatter": "^2.3.3", "sql-formatter": "^2.3.3",
"unique-names-generator": "^4.3.1", "unique-names-generator": "^4.3.1",
@ -2923,6 +2923,19 @@
"version": "1.0.0-next.21", "version": "1.0.0-next.21",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@socket.io/base64-arraybuffer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
"integrity": "sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ==",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/@socket.io/component-emitter": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.0.0.tgz",
"integrity": "sha512-2pTGuibAXJswAPJjaKisthqS/NOK5ypG4LYT6tEAV0S/mxW0zOIvYvGK0V8w8+SHxAm6vRMSjqSalFXeBAqs+Q=="
},
"node_modules/@types/html-minifier-terser": { "node_modules/@types/html-minifier-terser": {
"version": "5.1.2", "version": "5.1.2",
"license": "MIT" "license": "MIT"
@ -3520,10 +3533,6 @@
"node": ">=0.8" "node": ">=0.8"
} }
}, },
"node_modules/after": {
"version": "0.8.2",
"license": "MIT"
},
"node_modules/aggregate-error": { "node_modules/aggregate-error": {
"version": "3.1.0", "version": "3.1.0",
"license": "MIT", "license": "MIT",
@ -3721,10 +3730,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/arraybuffer.slice": {
"version": "0.0.7",
"license": "MIT"
},
"node_modules/asn1.js": { "node_modules/asn1.js": {
"version": "5.4.1", "version": "5.4.1",
"license": "MIT", "license": "MIT",
@ -3980,12 +3985,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/base64-arraybuffer": {
"version": "0.1.4",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/base64-js": { "node_modules/base64-js": {
"version": "1.5.1", "version": "1.5.1",
"funding": [ "funding": [
@ -4026,10 +4025,6 @@
"file-uri-to-path": "1.0.0" "file-uri-to-path": "1.0.0"
} }
}, },
"node_modules/blob": {
"version": "0.0.5",
"license": "MIT"
},
"node_modules/bluebird": { "node_modules/bluebird": {
"version": "3.7.2", "version": "3.7.2",
"license": "MIT" "license": "MIT"
@ -4822,16 +4817,10 @@
"version": "1.0.1", "version": "1.0.1",
"license": "MIT" "license": "MIT"
}, },
"node_modules/component-bind": {
"version": "1.0.0"
},
"node_modules/component-emitter": { "node_modules/component-emitter": {
"version": "1.3.0", "version": "1.3.0",
"license": "MIT" "license": "MIT"
}, },
"node_modules/component-inherit": {
"version": "0.0.3"
},
"node_modules/compressible": { "node_modules/compressible": {
"version": "2.0.18", "version": "2.0.18",
"license": "MIT", "license": "MIT",
@ -5851,38 +5840,27 @@
} }
}, },
"node_modules/engine.io-client": { "node_modules/engine.io-client": {
"version": "3.5.2", "version": "6.1.1",
"license": "MIT", "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.1.1.tgz",
"integrity": "sha512-V05mmDo4gjimYW+FGujoGmmmxRaDsrVr7AXA3ZIfa04MWM1jOfZfUwou0oNqhNwy/votUDvGDt4JA4QF4e0b4g==",
"dependencies": { "dependencies": {
"component-emitter": "~1.3.0", "@socket.io/component-emitter": "~3.0.0",
"component-inherit": "0.0.3", "debug": "~4.3.1",
"debug": "~3.1.0", "engine.io-parser": "~5.0.0",
"engine.io-parser": "~2.2.0",
"has-cors": "1.1.0", "has-cors": "1.1.0",
"indexof": "0.0.1",
"parseqs": "0.0.6", "parseqs": "0.0.6",
"parseuri": "0.0.6", "parseuri": "0.0.6",
"ws": "~7.4.2", "ws": "~8.2.3",
"xmlhttprequest-ssl": "~1.6.2", "xmlhttprequest-ssl": "~2.0.0",
"yeast": "0.1.2" "yeast": "0.1.2"
} }
}, },
"node_modules/engine.io-client/node_modules/debug": {
"version": "3.1.0",
"license": "MIT",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/engine.io-client/node_modules/ms": {
"version": "2.0.0",
"license": "MIT"
},
"node_modules/engine.io-client/node_modules/ws": { "node_modules/engine.io-client/node_modules/ws": {
"version": "7.4.6", "version": "8.2.3",
"license": "MIT", "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
"integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
"engines": { "engines": {
"node": ">=8.3.0" "node": ">=10.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"bufferutil": "^4.0.1", "bufferutil": "^4.0.1",
@ -5898,14 +5876,14 @@
} }
}, },
"node_modules/engine.io-parser": { "node_modules/engine.io-parser": {
"version": "2.2.1", "version": "5.0.3",
"license": "MIT", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz",
"integrity": "sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==",
"dependencies": { "dependencies": {
"after": "0.8.2", "@socket.io/base64-arraybuffer": "~1.0.2"
"arraybuffer.slice": "~0.0.7", },
"base64-arraybuffer": "0.1.4", "engines": {
"blob": "0.0.5", "node": ">=10.0.0"
"has-binary2": "~1.0.2"
} }
}, },
"node_modules/enhanced-resolve": { "node_modules/enhanced-resolve": {
@ -7769,20 +7747,10 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/has-binary2": {
"version": "1.0.3",
"license": "MIT",
"dependencies": {
"isarray": "2.0.1"
}
},
"node_modules/has-binary2/node_modules/isarray": {
"version": "2.0.1",
"license": "MIT"
},
"node_modules/has-cors": { "node_modules/has-cors": {
"version": "1.1.0", "version": "1.1.0",
"license": "MIT" "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz",
"integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk="
}, },
"node_modules/has-flag": { "node_modules/has-flag": {
"version": "3.0.0", "version": "3.0.0",
@ -8302,9 +8270,6 @@
"version": "1.0.1", "version": "1.0.1",
"license": "MIT" "license": "MIT"
}, },
"node_modules/indexof": {
"version": "0.0.1"
},
"node_modules/infer-owner": { "node_modules/infer-owner": {
"version": "1.0.4", "version": "1.0.4",
"license": "ISC" "license": "ISC"
@ -10228,11 +10193,13 @@
}, },
"node_modules/parseqs": { "node_modules/parseqs": {
"version": "0.0.6", "version": "0.0.6",
"license": "MIT" "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz",
"integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w=="
}, },
"node_modules/parseuri": { "node_modules/parseuri": {
"version": "0.0.6", "version": "0.0.6",
"license": "MIT" "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz",
"integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow=="
}, },
"node_modules/parseurl": { "node_modules/parseurl": {
"version": "1.3.3", "version": "1.3.3",
@ -12660,57 +12627,33 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/socket.io-client": { "node_modules/socket.io-client": {
"version": "2.4.0", "version": "4.4.1",
"license": "MIT", "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.4.1.tgz",
"integrity": "sha512-N5C/L5fLNha5Ojd7Yeb/puKcPWWcoB/A09fEjjNsg91EDVr5twk/OEyO6VT9dlLSUNY85NpW6KBhVMvaLKQ3vQ==",
"dependencies": { "dependencies": {
"backo2": "1.0.2", "@socket.io/component-emitter": "~3.0.0",
"component-bind": "1.0.0", "backo2": "~1.0.2",
"component-emitter": "~1.3.0", "debug": "~4.3.2",
"debug": "~3.1.0", "engine.io-client": "~6.1.1",
"engine.io-client": "~3.5.0",
"has-binary2": "~1.0.2",
"indexof": "0.0.1",
"parseqs": "0.0.6",
"parseuri": "0.0.6", "parseuri": "0.0.6",
"socket.io-parser": "~3.3.0", "socket.io-parser": "~4.1.1"
"to-array": "0.1.4" },
} "engines": {
}, "node": ">=10.0.0"
"node_modules/socket.io-client/node_modules/debug": {
"version": "3.1.0",
"license": "MIT",
"dependencies": {
"ms": "2.0.0"
} }
}, },
"node_modules/socket.io-client/node_modules/ms": {
"version": "2.0.0",
"license": "MIT"
},
"node_modules/socket.io-parser": { "node_modules/socket.io-parser": {
"version": "3.3.2", "version": "4.1.2",
"license": "MIT", "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.1.2.tgz",
"dependencies": { "integrity": "sha512-j3kk71QLJuyQ/hh5F/L2t1goqzdTL0gvDzuhTuNSwihfuFUrcSji0qFZmJJPtG6Rmug153eOPsUizeirf1IIog==",
"component-emitter": "~1.3.0",
"debug": "~3.1.0",
"isarray": "2.0.1"
}
},
"node_modules/socket.io-parser/node_modules/debug": {
"version": "3.1.0",
"license": "MIT",
"dependencies": { "dependencies": {
"ms": "2.0.0" "@socket.io/component-emitter": "~3.0.0",
"debug": "~4.3.1"
},
"engines": {
"node": ">=10.0.0"
} }
}, },
"node_modules/socket.io-parser/node_modules/isarray": {
"version": "2.0.1",
"license": "MIT"
},
"node_modules/socket.io-parser/node_modules/ms": {
"version": "2.0.0",
"license": "MIT"
},
"node_modules/sort-keys": { "node_modules/sort-keys": {
"version": "1.1.2", "version": "1.1.2",
"license": "MIT", "license": "MIT",
@ -13422,9 +13365,6 @@
"node": ">=0.6.0" "node": ">=0.6.0"
} }
}, },
"node_modules/to-array": {
"version": "0.1.4"
},
"node_modules/to-arraybuffer": { "node_modules/to-arraybuffer": {
"version": "1.0.1", "version": "1.0.1",
"license": "MIT" "license": "MIT"
@ -15376,7 +15316,9 @@
} }
}, },
"node_modules/xmlhttprequest-ssl": { "node_modules/xmlhttprequest-ssl": {
"version": "1.6.3", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz",
"integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==",
"engines": { "engines": {
"node": ">=0.4.0" "node": ">=0.4.0"
} }
@ -15449,7 +15391,8 @@
}, },
"node_modules/yeast": { "node_modules/yeast": {
"version": "0.1.2", "version": "0.1.2",
"license": "MIT" "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
}, },
"node_modules/yocto-queue": { "node_modules/yocto-queue": {
"version": "0.1.0", "version": "0.1.0",
@ -17252,6 +17195,16 @@
"@polka/url": { "@polka/url": {
"version": "1.0.0-next.21" "version": "1.0.0-next.21"
}, },
"@socket.io/base64-arraybuffer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
"integrity": "sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ=="
},
"@socket.io/component-emitter": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.0.0.tgz",
"integrity": "sha512-2pTGuibAXJswAPJjaKisthqS/NOK5ypG4LYT6tEAV0S/mxW0zOIvYvGK0V8w8+SHxAm6vRMSjqSalFXeBAqs+Q=="
},
"@types/html-minifier-terser": { "@types/html-minifier-terser": {
"version": "5.1.2" "version": "5.1.2"
}, },
@ -17669,9 +17622,6 @@
"printj": "~1.1.0" "printj": "~1.1.0"
} }
}, },
"after": {
"version": "0.8.2"
},
"aggregate-error": { "aggregate-error": {
"version": "3.1.0", "version": "3.1.0",
"requires": { "requires": {
@ -17784,9 +17734,6 @@
"es-abstract": "^1.19.0" "es-abstract": "^1.19.0"
} }
}, },
"arraybuffer.slice": {
"version": "0.0.7"
},
"asn1.js": { "asn1.js": {
"version": "5.4.1", "version": "5.4.1",
"requires": { "requires": {
@ -17963,9 +17910,6 @@
} }
} }
}, },
"base64-arraybuffer": {
"version": "0.1.4"
},
"base64-js": { "base64-js": {
"version": "1.5.1" "version": "1.5.1"
}, },
@ -17982,9 +17926,6 @@
"file-uri-to-path": "1.0.0" "file-uri-to-path": "1.0.0"
} }
}, },
"blob": {
"version": "0.0.5"
},
"bluebird": { "bluebird": {
"version": "3.7.2" "version": "3.7.2"
}, },
@ -18477,15 +18418,9 @@
"commondir": { "commondir": {
"version": "1.0.1" "version": "1.0.1"
}, },
"component-bind": {
"version": "1.0.0"
},
"component-emitter": { "component-emitter": {
"version": "1.3.0" "version": "1.3.0"
}, },
"component-inherit": {
"version": "0.0.3"
},
"compressible": { "compressible": {
"version": "2.0.18", "version": "2.0.18",
"requires": { "requires": {
@ -19164,44 +19099,35 @@
} }
}, },
"engine.io-client": { "engine.io-client": {
"version": "3.5.2", "version": "6.1.1",
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.1.1.tgz",
"integrity": "sha512-V05mmDo4gjimYW+FGujoGmmmxRaDsrVr7AXA3ZIfa04MWM1jOfZfUwou0oNqhNwy/votUDvGDt4JA4QF4e0b4g==",
"requires": { "requires": {
"component-emitter": "~1.3.0", "@socket.io/component-emitter": "~3.0.0",
"component-inherit": "0.0.3", "debug": "~4.3.1",
"debug": "~3.1.0", "engine.io-parser": "~5.0.0",
"engine.io-parser": "~2.2.0",
"has-cors": "1.1.0", "has-cors": "1.1.0",
"indexof": "0.0.1",
"parseqs": "0.0.6", "parseqs": "0.0.6",
"parseuri": "0.0.6", "parseuri": "0.0.6",
"ws": "~7.4.2", "ws": "~8.2.3",
"xmlhttprequest-ssl": "~1.6.2", "xmlhttprequest-ssl": "~2.0.0",
"yeast": "0.1.2" "yeast": "0.1.2"
}, },
"dependencies": { "dependencies": {
"debug": {
"version": "3.1.0",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0"
},
"ws": { "ws": {
"version": "7.4.6", "version": "8.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
"integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
"requires": {} "requires": {}
} }
} }
}, },
"engine.io-parser": { "engine.io-parser": {
"version": "2.2.1", "version": "5.0.3",
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz",
"integrity": "sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==",
"requires": { "requires": {
"after": "0.8.2", "@socket.io/base64-arraybuffer": "~1.0.2"
"arraybuffer.slice": "~0.0.7",
"base64-arraybuffer": "0.1.4",
"blob": "0.0.5",
"has-binary2": "~1.0.2"
} }
}, },
"enhanced-resolve": { "enhanced-resolve": {
@ -20359,19 +20285,10 @@
"has-bigints": { "has-bigints": {
"version": "1.0.1" "version": "1.0.1"
}, },
"has-binary2": {
"version": "1.0.3",
"requires": {
"isarray": "2.0.1"
},
"dependencies": {
"isarray": {
"version": "2.0.1"
}
}
},
"has-cors": { "has-cors": {
"version": "1.1.0" "version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz",
"integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk="
}, },
"has-flag": { "has-flag": {
"version": "3.0.0" "version": "3.0.0"
@ -20693,9 +20610,6 @@
"indexes-of": { "indexes-of": {
"version": "1.0.1" "version": "1.0.1"
}, },
"indexof": {
"version": "0.0.1"
},
"infer-owner": { "infer-owner": {
"version": "1.0.4" "version": "1.0.4"
}, },
@ -21905,10 +21819,14 @@
"dev": true "dev": true
}, },
"parseqs": { "parseqs": {
"version": "0.0.6" "version": "0.0.6",
"resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz",
"integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w=="
}, },
"parseuri": { "parseuri": {
"version": "0.0.6" "version": "0.0.6",
"resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz",
"integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow=="
}, },
"parseurl": { "parseurl": {
"version": "1.3.3" "version": "1.3.3"
@ -23521,52 +23439,25 @@
} }
}, },
"socket.io-client": { "socket.io-client": {
"version": "2.4.0", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.4.1.tgz",
"integrity": "sha512-N5C/L5fLNha5Ojd7Yeb/puKcPWWcoB/A09fEjjNsg91EDVr5twk/OEyO6VT9dlLSUNY85NpW6KBhVMvaLKQ3vQ==",
"requires": { "requires": {
"backo2": "1.0.2", "@socket.io/component-emitter": "~3.0.0",
"component-bind": "1.0.0", "backo2": "~1.0.2",
"component-emitter": "~1.3.0", "debug": "~4.3.2",
"debug": "~3.1.0", "engine.io-client": "~6.1.1",
"engine.io-client": "~3.5.0",
"has-binary2": "~1.0.2",
"indexof": "0.0.1",
"parseqs": "0.0.6",
"parseuri": "0.0.6", "parseuri": "0.0.6",
"socket.io-parser": "~3.3.0", "socket.io-parser": "~4.1.1"
"to-array": "0.1.4"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0"
}
} }
}, },
"socket.io-parser": { "socket.io-parser": {
"version": "3.3.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.1.2.tgz",
"integrity": "sha512-j3kk71QLJuyQ/hh5F/L2t1goqzdTL0gvDzuhTuNSwihfuFUrcSji0qFZmJJPtG6Rmug153eOPsUizeirf1IIog==",
"requires": { "requires": {
"component-emitter": "~1.3.0", "@socket.io/component-emitter": "~3.0.0",
"debug": "~3.1.0", "debug": "~4.3.1"
"isarray": "2.0.1"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"requires": {
"ms": "2.0.0"
}
},
"isarray": {
"version": "2.0.1"
},
"ms": {
"version": "2.0.0"
}
} }
}, },
"sort-keys": { "sort-keys": {
@ -24031,9 +23922,6 @@
"os-tmpdir": "~1.0.2" "os-tmpdir": "~1.0.2"
} }
}, },
"to-array": {
"version": "0.1.4"
},
"to-arraybuffer": { "to-arraybuffer": {
"version": "1.0.1" "version": "1.0.1"
}, },
@ -25317,7 +25205,9 @@
} }
}, },
"xmlhttprequest-ssl": { "xmlhttprequest-ssl": {
"version": "1.6.3" "version": "2.0.0",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz",
"integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A=="
}, },
"xstate": { "xstate": {
"version": "4.30.6" "version": "4.30.6"
@ -25362,7 +25252,9 @@
} }
}, },
"yeast": { "yeast": {
"version": "0.1.2" "version": "0.1.2",
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
}, },
"yocto-queue": { "yocto-queue": {
"version": "0.1.0" "version": "0.1.0"

2
packages/nc-gui/package.json

@ -34,7 +34,7 @@
"odometer": "^0.4.8", "odometer": "^0.4.8",
"papaparse": "^5.3.1", "papaparse": "^5.3.1",
"secure-ls": "^1.2.6", "secure-ls": "^1.2.6",
"socket.io-client": "^2.3.0", "socket.io-client": "^4.4.1",
"splitpanes": "^2.2.1", "splitpanes": "^2.2.1",
"sql-formatter": "^2.3.3", "sql-formatter": "^2.3.3",
"unique-names-generator": "^4.3.1", "unique-names-generator": "^4.3.1",

25
packages/nc-gui/plugins/tele.js

@ -9,10 +9,14 @@ export default function({
}, inject) { }, inject) {
let socket let socket
const init = () => { const init = (token) => {
if (socket) { return } if (socket) {
socket.disconnect()
}
socket = io($axios.defaults.baseURL) socket = io($axios.defaults.baseURL, {
extraHeaders: { 'xc-auth': token }
})
app.router.onReady(() => { app.router.onReady(() => {
app.router.afterEach(function(to, from) { app.router.afterEach(function(to, from) {
@ -29,10 +33,6 @@ export default function({
path: route.matched[0].path + (route.query && route.query.type ? `?type=${route.query.type}` : '') path: route.matched[0].path + (route.query && route.query.type ? `?type=${route.query.type}` : '')
}) })
}) })
// socket.on('connect_error', () => {
// socket.disconnect()
// })
} }
const tele = { const tele = {
emit(evt, data) { emit(evt, data) {
@ -75,10 +75,15 @@ export default function({
} }
}) })
store.watch(state => state.project.projectInfo && state.project.projectInfo.teleEnabled, (value) => { store.watch(state => state.project.projectInfo && state.project.projectInfo.teleEnabled && state.users.token, (token) => {
if (value) { init() } if (token) { init(token) } else if (socket) {
socket.disconnect()
socket = null
}
}) })
if (store.state.project.projectInfo && store.state.project.projectInfo.teleEnabled) { init() } if (store.state.project.projectInfo && store.state.project.projectInfo.teleEnabled && store.state.users.token) {
init(store.state.users.token)
}
} }
function gatPath(app) { function gatPath(app) {

360
packages/nocodb/package-lock.json generated

@ -91,7 +91,7 @@
"rmdir": "^1.2.0", "rmdir": "^1.2.0",
"sha.js": "^2.4.11", "sha.js": "^2.4.11",
"slash": "^3.0.0", "slash": "^3.0.0",
"socket.io": "^2.3.0", "socket.io": "^4.4.1",
"sqlite3": "5.0.0", "sqlite3": "5.0.0",
"twilio": "^3.55.1", "twilio": "^3.55.1",
"unique-names-generator": "^4.3.1", "unique-names-generator": "^4.3.1",
@ -1681,6 +1681,14 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/@socket.io/base64-arraybuffer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
"integrity": "sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ==",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/@stroncium/procfs": { "node_modules/@stroncium/procfs": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/@stroncium/procfs/-/procfs-1.2.1.tgz", "resolved": "https://registry.npmjs.org/@stroncium/procfs/-/procfs-1.2.1.tgz",
@ -1753,6 +1761,11 @@
"integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==",
"dev": true "dev": true
}, },
"node_modules/@types/component-emitter": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
"integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ=="
},
"node_modules/@types/connect": { "node_modules/@types/connect": {
"version": "3.4.35", "version": "3.4.35",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
@ -1762,12 +1775,22 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/@types/cookie": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q=="
},
"node_modules/@types/cookiejar": { "node_modules/@types/cookiejar": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.2.tgz", "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.2.tgz",
"integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==", "integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==",
"dev": true "dev": true
}, },
"node_modules/@types/cors": {
"version": "2.8.12",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz",
"integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw=="
},
"node_modules/@types/express": { "node_modules/@types/express": {
"version": "4.17.13", "version": "4.17.13",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz",
@ -20121,16 +20144,19 @@
} }
}, },
"node_modules/socket.io": { "node_modules/socket.io": {
"version": "2.4.1", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.4.1.tgz", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.4.1.tgz",
"integrity": "sha512-Si18v0mMXGAqLqCVpTxBa8MGqriHGQh8ccEOhmsmNS3thNCGBwO8WGrwMibANsWtQQ5NStdZwHqZR3naJVFc3w==", "integrity": "sha512-s04vrBswdQBUmuWJuuNTmXUVJhP0cVky8bBDhdkf8y0Ptsu7fKU2LuLbts9g+pdmAdyMMn8F/9Mf1/wbtUN0fg==",
"dependencies": { "dependencies": {
"debug": "~4.1.0", "accepts": "~1.3.4",
"engine.io": "~3.5.0", "base64id": "~2.0.0",
"has-binary2": "~1.0.2", "debug": "~4.3.2",
"socket.io-adapter": "~1.1.0", "engine.io": "~6.1.0",
"socket.io-client": "2.4.0", "socket.io-adapter": "~2.3.3",
"socket.io-parser": "~3.4.0" "socket.io-parser": "~4.0.4"
},
"engines": {
"node": ">=10.0.0"
} }
}, },
"node_modules/socket.io-adapter": { "node_modules/socket.io-adapter": {
@ -20238,124 +20264,61 @@
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
}, },
"node_modules/socket.io/node_modules/debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)",
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/socket.io/node_modules/engine.io": { "node_modules/socket.io/node_modules/engine.io": {
"version": "3.5.0", "version": "6.1.3",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.5.0.tgz", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.1.3.tgz",
"integrity": "sha512-21HlvPUKaitDGE4GXNtQ7PLP0Sz4aWLddMPw2VTyFz1FVZqu/kZsJUO8WNpKuE/OCL7nkfRaOui2ZCJloGznGA==", "integrity": "sha512-rqs60YwkvWTLLnfazqgZqLa/aKo+9cueVfEi/dZ8PyGyaf8TLOxj++4QMIgeG3Gn0AhrWiFXvghsoY9L9h25GA==",
"dependencies": { "dependencies": {
"@types/cookie": "^0.4.1",
"@types/cors": "^2.8.12",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4", "accepts": "~1.3.4",
"base64id": "2.0.0", "base64id": "2.0.0",
"cookie": "~0.4.1", "cookie": "~0.4.1",
"debug": "~4.1.0", "cors": "~2.8.5",
"engine.io-parser": "~2.2.0", "debug": "~4.3.1",
"ws": "~7.4.2" "engine.io-parser": "~5.0.3",
"ws": "~8.2.3"
}, },
"engines": { "engines": {
"node": ">=8.0.0" "node": ">=10.0.0"
}
},
"node_modules/socket.io/node_modules/engine.io-client": {
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.2.tgz",
"integrity": "sha512-QEqIp+gJ/kMHeUun7f5Vv3bteRHppHH/FMBQX/esFj/fuYfjyUKWGMo3VCvIP/V8bE9KcjHmRZrhIz2Z9oNsDA==",
"dependencies": {
"component-emitter": "~1.3.0",
"component-inherit": "0.0.3",
"debug": "~3.1.0",
"engine.io-parser": "~2.2.0",
"has-cors": "1.1.0",
"indexof": "0.0.1",
"parseqs": "0.0.6",
"parseuri": "0.0.6",
"ws": "~7.4.2",
"xmlhttprequest-ssl": "~1.6.2",
"yeast": "0.1.2"
}
},
"node_modules/socket.io/node_modules/engine.io-client/node_modules/debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/socket.io/node_modules/engine.io-client/node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"node_modules/socket.io/node_modules/isarray": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz",
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4="
},
"node_modules/socket.io/node_modules/parseqs": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz",
"integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w=="
},
"node_modules/socket.io/node_modules/parseuri": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz",
"integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow=="
},
"node_modules/socket.io/node_modules/socket.io-client": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.4.0.tgz",
"integrity": "sha512-M6xhnKQHuuZd4Ba9vltCLT9oa+YvTsP8j9NcEiLElfIg8KeYPyhWOes6x4t+LTAC8enQbE/995AdTem2uNyKKQ==",
"dependencies": {
"backo2": "1.0.2",
"component-bind": "1.0.0",
"component-emitter": "~1.3.0",
"debug": "~3.1.0",
"engine.io-client": "~3.5.0",
"has-binary2": "~1.0.2",
"indexof": "0.0.1",
"parseqs": "0.0.6",
"parseuri": "0.0.6",
"socket.io-parser": "~3.3.0",
"to-array": "0.1.4"
} }
}, },
"node_modules/socket.io/node_modules/socket.io-client/node_modules/debug": { "node_modules/socket.io/node_modules/engine.io-parser": {
"version": "3.1.0", "version": "5.0.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "integrity": "sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==",
"dependencies": { "dependencies": {
"ms": "2.0.0" "@socket.io/base64-arraybuffer": "~1.0.2"
},
"engines": {
"node": ">=10.0.0"
} }
}, },
"node_modules/socket.io/node_modules/socket.io-client/node_modules/ms": { "node_modules/socket.io/node_modules/socket.io-adapter": {
"version": "2.0.0", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.3.3.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" "integrity": "sha512-Qd/iwn3VskrpNO60BeRyCyr8ZWw9CPZyitW4AQwmRZ8zCiyDiL+znRnWX6tDHXnWn1sJrM1+b6Mn6wEDJJ4aYQ=="
}, },
"node_modules/socket.io/node_modules/socket.io-client/node_modules/socket.io-parser": { "node_modules/socket.io/node_modules/socket.io-parser": {
"version": "3.3.2", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.2.tgz", "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz",
"integrity": "sha512-FJvDBuOALxdCI9qwRrO/Rfp9yfndRtc1jSgVgV8FDraihmSP/MLGD5PEuJrNfjALvcQ+vMDM/33AWOYP/JSjDg==", "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==",
"dependencies": { "dependencies": {
"@types/component-emitter": "^1.2.10",
"component-emitter": "~1.3.0", "component-emitter": "~1.3.0",
"debug": "~3.1.0", "debug": "~4.3.1"
"isarray": "2.0.1" },
"engines": {
"node": ">=10.0.0"
} }
}, },
"node_modules/socket.io/node_modules/ws": { "node_modules/socket.io/node_modules/ws": {
"version": "7.4.6", "version": "8.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
"engines": { "engines": {
"node": ">=8.3.0" "node": ">=10.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"bufferutil": "^4.0.1", "bufferutil": "^4.0.1",
@ -20370,14 +20333,6 @@
} }
} }
}, },
"node_modules/socket.io/node_modules/xmlhttprequest-ssl": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.3.tgz",
"integrity": "sha512-3XfeQE/wNkvrIktn2Kf0869fC0BN6UpydVasGIeSm2B1Llihf7/0UfZM+eCkOw3P7bP4+qPgqhm7ZoxuJtFU0Q==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/sort-keys": { "node_modules/sort-keys": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz",
@ -26177,6 +26132,11 @@
"integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==",
"dev": true "dev": true
}, },
"@socket.io/base64-arraybuffer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
"integrity": "sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ=="
},
"@stroncium/procfs": { "@stroncium/procfs": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/@stroncium/procfs/-/procfs-1.2.1.tgz", "resolved": "https://registry.npmjs.org/@stroncium/procfs/-/procfs-1.2.1.tgz",
@ -26235,6 +26195,11 @@
"integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==",
"dev": true "dev": true
}, },
"@types/component-emitter": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
"integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ=="
},
"@types/connect": { "@types/connect": {
"version": "3.4.35", "version": "3.4.35",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
@ -26244,12 +26209,22 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"@types/cookie": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q=="
},
"@types/cookiejar": { "@types/cookiejar": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.2.tgz", "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.2.tgz",
"integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==", "integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==",
"dev": true "dev": true
}, },
"@types/cors": {
"version": "2.8.12",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz",
"integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw=="
},
"@types/express": { "@types/express": {
"version": "4.17.13", "version": "4.17.13",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz",
@ -40706,16 +40681,16 @@
} }
}, },
"socket.io": { "socket.io": {
"version": "2.4.1", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.4.1.tgz", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.4.1.tgz",
"integrity": "sha512-Si18v0mMXGAqLqCVpTxBa8MGqriHGQh8ccEOhmsmNS3thNCGBwO8WGrwMibANsWtQQ5NStdZwHqZR3naJVFc3w==", "integrity": "sha512-s04vrBswdQBUmuWJuuNTmXUVJhP0cVky8bBDhdkf8y0Ptsu7fKU2LuLbts9g+pdmAdyMMn8F/9Mf1/wbtUN0fg==",
"requires": { "requires": {
"debug": "~4.1.0", "accepts": "~1.3.4",
"engine.io": "~3.5.0", "base64id": "~2.0.0",
"has-binary2": "~1.0.2", "debug": "~4.3.2",
"socket.io-adapter": "~1.1.0", "engine.io": "~6.1.0",
"socket.io-client": "2.4.0", "socket.io-adapter": "~2.3.3",
"socket.io-parser": "~3.4.0" "socket.io-parser": "~4.0.4"
}, },
"dependencies": { "dependencies": {
"component-emitter": { "component-emitter": {
@ -40723,128 +40698,51 @@
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
}, },
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"engine.io": { "engine.io": {
"version": "3.5.0", "version": "6.1.3",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.5.0.tgz", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.1.3.tgz",
"integrity": "sha512-21HlvPUKaitDGE4GXNtQ7PLP0Sz4aWLddMPw2VTyFz1FVZqu/kZsJUO8WNpKuE/OCL7nkfRaOui2ZCJloGznGA==", "integrity": "sha512-rqs60YwkvWTLLnfazqgZqLa/aKo+9cueVfEi/dZ8PyGyaf8TLOxj++4QMIgeG3Gn0AhrWiFXvghsoY9L9h25GA==",
"requires": { "requires": {
"@types/cookie": "^0.4.1",
"@types/cors": "^2.8.12",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4", "accepts": "~1.3.4",
"base64id": "2.0.0", "base64id": "2.0.0",
"cookie": "~0.4.1", "cookie": "~0.4.1",
"debug": "~4.1.0", "cors": "~2.8.5",
"engine.io-parser": "~2.2.0", "debug": "~4.3.1",
"ws": "~7.4.2" "engine.io-parser": "~5.0.3",
"ws": "~8.2.3"
} }
}, },
"engine.io-client": { "engine.io-parser": {
"version": "3.5.2", "version": "5.0.3",
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.2.tgz", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz",
"integrity": "sha512-QEqIp+gJ/kMHeUun7f5Vv3bteRHppHH/FMBQX/esFj/fuYfjyUKWGMo3VCvIP/V8bE9KcjHmRZrhIz2Z9oNsDA==", "integrity": "sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==",
"requires": { "requires": {
"component-emitter": "~1.3.0", "@socket.io/base64-arraybuffer": "~1.0.2"
"component-inherit": "0.0.3",
"debug": "~3.1.0",
"engine.io-parser": "~2.2.0",
"has-cors": "1.1.0",
"indexof": "0.0.1",
"parseqs": "0.0.6",
"parseuri": "0.0.6",
"ws": "~7.4.2",
"xmlhttprequest-ssl": "~1.6.2",
"yeast": "0.1.2"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
} }
}, },
"isarray": { "socket.io-adapter": {
"version": "2.0.1", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.3.3.tgz",
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" "integrity": "sha512-Qd/iwn3VskrpNO60BeRyCyr8ZWw9CPZyitW4AQwmRZ8zCiyDiL+znRnWX6tDHXnWn1sJrM1+b6Mn6wEDJJ4aYQ=="
},
"parseqs": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz",
"integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w=="
},
"parseuri": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz",
"integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow=="
}, },
"socket.io-client": { "socket.io-parser": {
"version": "2.4.0", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.4.0.tgz", "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz",
"integrity": "sha512-M6xhnKQHuuZd4Ba9vltCLT9oa+YvTsP8j9NcEiLElfIg8KeYPyhWOes6x4t+LTAC8enQbE/995AdTem2uNyKKQ==", "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==",
"requires": { "requires": {
"backo2": "1.0.2", "@types/component-emitter": "^1.2.10",
"component-bind": "1.0.0",
"component-emitter": "~1.3.0", "component-emitter": "~1.3.0",
"debug": "~3.1.0", "debug": "~4.3.1"
"engine.io-client": "~3.5.0",
"has-binary2": "~1.0.2",
"indexof": "0.0.1",
"parseqs": "0.0.6",
"parseuri": "0.0.6",
"socket.io-parser": "~3.3.0",
"to-array": "0.1.4"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"socket.io-parser": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.2.tgz",
"integrity": "sha512-FJvDBuOALxdCI9qwRrO/Rfp9yfndRtc1jSgVgV8FDraihmSP/MLGD5PEuJrNfjALvcQ+vMDM/33AWOYP/JSjDg==",
"requires": {
"component-emitter": "~1.3.0",
"debug": "~3.1.0",
"isarray": "2.0.1"
}
}
} }
}, },
"ws": { "ws": {
"version": "7.4.6", "version": "8.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
"requires": {} "requires": {}
},
"xmlhttprequest-ssl": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.3.tgz",
"integrity": "sha512-3XfeQE/wNkvrIktn2Kf0869fC0BN6UpydVasGIeSm2B1Llihf7/0UfZM+eCkOw3P7bP4+qPgqhm7ZoxuJtFU0Q=="
} }
} }
}, },

2
packages/nocodb/package.json

@ -173,7 +173,7 @@
"rmdir": "^1.2.0", "rmdir": "^1.2.0",
"sha.js": "^2.4.11", "sha.js": "^2.4.11",
"slash": "^3.0.0", "slash": "^3.0.0",
"socket.io": "^2.3.0", "socket.io": "^4.4.1",
"sqlite3": "5.0.0", "sqlite3": "5.0.0",
"twilio": "^3.55.1", "twilio": "^3.55.1",
"unique-names-generator": "^4.3.1", "unique-names-generator": "^4.3.1",

35
packages/nocodb/src/lib/noco/meta/api/index.ts

@ -39,7 +39,8 @@ import {
publicMetaApis publicMetaApis
} from './publicApis'; } from './publicApis';
import { Tele } from 'nc-help'; import { Tele } from 'nc-help';
import Server from 'socket.io'; import { Server } from 'socket.io';
import passport from 'passport';
export default function(router: Router, server) { export default function(router: Router, server) {
initStrategies(router); initStrategies(router);
@ -79,9 +80,33 @@ export default function(router: Router, server) {
userApis(router); userApis(router);
const io = new Server(server); const io = new Server(server, {
io.on('connection', socket => { cors: {
socket.on('page', args => Tele.page(args)); origin: '*',
socket.on('event', args => Tele.event(args)); allowedHeaders: ['xc-auth'],
credentials: true
}
});
io.use(function(socket, next) {
passport.authenticate(
'jwt',
{ session: false },
(_err, user, _info): any => {
if (!user) {
socket.disconnect();
return next(new Error('Unauthorized'));
}
(socket.handshake as any).user = user;
next();
}
)(socket.handshake, {}, next);
}).on('connection', socket => {
socket.on('page', args => {
Tele.page(args);
});
socket.on('event', args => {
Tele.event(args);
});
}); });
} }

2
packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts

@ -9,12 +9,14 @@ import { ExtractJwt } from 'passport-jwt';
import { Strategy as AuthTokenStrategy } from 'passport-auth-token'; import { Strategy as AuthTokenStrategy } from 'passport-auth-token';
const PassportLocalStrategy = require('passport-local').Strategy; const PassportLocalStrategy = require('passport-local').Strategy;
// todo: read from database // todo: read from database
const jwtOptions = { const jwtOptions = {
secretOrKey: 'dkjfkdjfkjdfjdfjdkfjdkfjkdfkjdkfjdkjfkdk', secretOrKey: 'dkjfkdjfkjdfjdfjdkfjdkfjkdfkjdkfjdkjfkdk',
expiresIn: process.env.NC_JWT_EXPIRES_IN ?? '10h', expiresIn: process.env.NC_JWT_EXPIRES_IN ?? '10h',
jwtFromRequest: ExtractJwt.fromHeader('xc-auth') jwtFromRequest: ExtractJwt.fromHeader('xc-auth')
}; };
import bcrypt from 'bcryptjs'; import bcrypt from 'bcryptjs';
import Project from '../../../../noco-models/Project'; import Project from '../../../../noco-models/Project';
import NocoCache from '../../../../noco-cache/NocoCache'; import NocoCache from '../../../../noco-cache/NocoCache';

Loading…
Cancel
Save