dbgate-api 5.3.0 → 5.3.1

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/env/portal/.env CHANGED
@@ -1,6 +1,6 @@
1
1
  DEVMODE=1
2
2
 
3
- CONNECTIONS=mysql,postgres,mongo,mongo2,mysqlssh,sqlite,relational
3
+ CONNECTIONS=mysql,postgres,postgres1,mongo,mongo2,mysqlssh,sqlite,relational
4
4
 
5
5
  LABEL_mysql=MySql localhost
6
6
  SERVER_mysql=localhost
@@ -12,10 +12,18 @@ ENGINE_mysql=mysql@dbgate-plugin-mysql
12
12
  LABEL_postgres=Postgres localhost
13
13
  SERVER_postgres=localhost
14
14
  USER_postgres=postgres
15
- PASSWORD_postgres=test
16
- PORT_postgres=5433
15
+ PASSWORD_postgres=Pwd2020Db
16
+ PORT_postgres=5432
17
17
  ENGINE_postgres=postgres@dbgate-plugin-postgres
18
18
 
19
+ LABEL_postgres1=Postgres localhost test DB
20
+ SERVER_postgres1=localhost
21
+ USER_postgres1=postgres
22
+ PASSWORD_postgres1=Pwd2020Db
23
+ PORT_postgres1=5432
24
+ ENGINE_postgres1=postgres@dbgate-plugin-postgres
25
+ DATABASE_postgres1=test
26
+
19
27
  LABEL_mongo=Mongo URL
20
28
  URL_mongo=mongodb://localhost:27017
21
29
  ENGINE_mongo=mongo@dbgate-plugin-mongo
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dbgate-api",
3
3
  "main": "src/index.js",
4
- "version": "5.3.0",
4
+ "version": "5.3.1",
5
5
  "homepage": "https://dbgate.org/",
6
6
  "repository": {
7
7
  "type": "git",
@@ -26,10 +26,10 @@
26
26
  "compare-versions": "^3.6.0",
27
27
  "cors": "^2.8.5",
28
28
  "cross-env": "^6.0.3",
29
- "dbgate-datalib": "^5.3.0",
29
+ "dbgate-datalib": "^5.3.1",
30
30
  "dbgate-query-splitter": "^4.10.1",
31
- "dbgate-sqltree": "^5.3.0",
32
- "dbgate-tools": "^5.3.0",
31
+ "dbgate-sqltree": "^5.3.1",
32
+ "dbgate-tools": "^5.3.1",
33
33
  "debug": "^4.3.4",
34
34
  "diff": "^5.0.0",
35
35
  "diff2html": "^3.4.13",
@@ -73,7 +73,7 @@
73
73
  "devDependencies": {
74
74
  "@types/fs-extra": "^9.0.11",
75
75
  "@types/lodash": "^4.14.149",
76
- "dbgate-types": "^5.3.0",
76
+ "dbgate-types": "^5.3.1",
77
77
  "env-cmd": "^10.1.0",
78
78
  "node-loader": "^1.0.2",
79
79
  "nodemon": "^2.0.2",
@@ -149,7 +149,7 @@ module.exports = {
149
149
  const { sesid } = await this.create({ conid, database });
150
150
  const session = this.opened.find(x => x.sesid == sesid);
151
151
  session.killOnDone = true;
152
- const jslid = uuidv1();
152
+ const jslid = crypto.randomUUID();
153
153
  session.loadingReader_jslid = jslid;
154
154
  const fileName = queryName && appFolder ? path.join(appdir(), appFolder, `${queryName}.query.sql`) : null;
155
155
 
@@ -169,7 +169,7 @@ module.exports = {
169
169
 
170
170
  startProfiler_meta: true,
171
171
  async startProfiler({ sesid }) {
172
- const jslid = uuidv1();
172
+ const jslid = crypto.randomUUID();
173
173
  const session = this.opened.find(x => x.sesid == sesid);
174
174
  if (!session) {
175
175
  throw new Error('Invalid session');
@@ -12,6 +12,7 @@ const _ = require('lodash');
12
12
  const serverConnections = require('./serverConnections');
13
13
  const config = require('./config');
14
14
  const gistSecret = require('../gistSecret');
15
+ const currentVersion = require('../currentVersion');
15
16
 
16
17
  module.exports = {
17
18
  upload_meta: {
@@ -59,7 +60,7 @@ module.exports = {
59
60
  const response = await axios.default.post(
60
61
  'https://api.github.com/gists',
61
62
  {
62
- description: 'DbGate error report',
63
+ description: `DbGate ${currentVersion.version} error report`,
63
64
  public: false,
64
65
  files: {
65
66
  'logs.jsonl': {
@@ -93,6 +94,9 @@ module.exports = {
93
94
  'connections.json': {
94
95
  content: JSON.stringify(connections, null, 2),
95
96
  },
97
+ 'version.json': {
98
+ content: JSON.stringify(currentVersion, null, 2),
99
+ },
96
100
  },
97
101
  },
98
102
  {
@@ -1,5 +1,5 @@
1
1
 
2
2
  module.exports = {
3
- version: '5.3.0',
4
- buildTime: '2024-06-07T08:19:32.117Z'
3
+ version: '5.3.1',
4
+ buildTime: '2024-06-21T07:36:24.602Z'
5
5
  };
@@ -210,7 +210,7 @@ class JsonLinesDatastore {
210
210
  async getRows(offset, limit, filter, sort) {
211
211
  const res = [];
212
212
  if (sort && !this.sortedFiles[stableStringify(sort)]) {
213
- const jslid = uuidv1();
213
+ const jslid = crypto.randomUUID();
214
214
  const sortedFile = path.join(jsldir(), `${jslid}.jsonl`);
215
215
  await JsonLinesDatastore.sortFile(this.file, sortedFile, sort);
216
216
  this.sortedFiles[stableStringify(sort)] = sortedFile;
@@ -9,7 +9,8 @@ function hasPermission(tested, req) {
9
9
  return true;
10
10
  }
11
11
  const { user } = (req && req.auth) || {};
12
- const key = user || '';
12
+ const { login } = (process.env.OAUTH_PERMISSIONS && req && req.user) || {};
13
+ const key = user || login || '';
13
14
  const logins = getLogins();
14
15
 
15
16
  if (!userPermissions[key]) {
@@ -39,7 +40,7 @@ function getLogins() {
39
40
  permissions: process.env.PERMISSIONS,
40
41
  });
41
42
  }
42
- if (process.env.LOGINS || process.env.OAUTH_PERMISSIONS) {
43
+ if (process.env.LOGINS) {
43
44
  const logins = _.compact(process.env.LOGINS.split(',').map(x => x.trim()));
44
45
  for (const login of logins) {
45
46
  const password = process.env[`LOGIN_PASSWORD_${login}`];
@@ -51,13 +52,14 @@ function getLogins() {
51
52
  permissions,
52
53
  });
53
54
  }
54
- if (process.env.OAUTH_PERMISSIONS) {
55
- res.push({
56
- login,
57
- password: null,
58
- permissions,
59
- })
60
- }
55
+ }
56
+ }
57
+ else if (process.env.OAUTH_PERMISSIONS) {
58
+ const login_permission_keys = Object.keys(process.env).filter((key) => _.startsWith(key, 'LOGIN_PERMISSIONS_'))
59
+ for (const permissions_key of login_permission_keys) {
60
+ const login = permissions_key.replace('LOGIN_PERMISSIONS_', '');
61
+ const permissions = process.env[permissions_key];
62
+ userPermissions[login] = compilePermissions(permissions);
61
63
  }
62
64
  }
63
65