dbgate-api-premium 6.5.2 → 6.5.4
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbgate-api-premium",
|
|
3
3
|
"main": "src/index.js",
|
|
4
|
-
"version": "6.5.
|
|
4
|
+
"version": "6.5.4",
|
|
5
5
|
"homepage": "https://dbgate.org/",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"compare-versions": "^3.6.0",
|
|
31
31
|
"cors": "^2.8.5",
|
|
32
32
|
"cross-env": "^6.0.3",
|
|
33
|
-
"dbgate-datalib": "^6.5.
|
|
33
|
+
"dbgate-datalib": "^6.5.4",
|
|
34
34
|
"dbgate-query-splitter": "^4.11.5",
|
|
35
|
-
"dbgate-sqltree": "^6.5.
|
|
36
|
-
"dbgate-tools": "^6.5.
|
|
35
|
+
"dbgate-sqltree": "^6.5.4",
|
|
36
|
+
"dbgate-tools": "^6.5.4",
|
|
37
37
|
"debug": "^4.3.4",
|
|
38
38
|
"diff": "^5.0.0",
|
|
39
39
|
"diff2html": "^3.4.13",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@types/fs-extra": "^9.0.11",
|
|
87
87
|
"@types/lodash": "^4.14.149",
|
|
88
|
-
"dbgate-types": "^6.5.
|
|
88
|
+
"dbgate-types": "^6.5.4",
|
|
89
89
|
"env-cmd": "^10.1.0",
|
|
90
90
|
"jsdoc-to-markdown": "^9.0.5",
|
|
91
91
|
"node-loader": "^1.0.2",
|
package/src/controllers/auth.js
CHANGED
|
@@ -142,6 +142,8 @@ module.exports = {
|
|
|
142
142
|
const res = await createDbGateIdentitySession(client);
|
|
143
143
|
startCloudTokenChecking(res.sid, tokenHolder => {
|
|
144
144
|
socket.emit('got-cloud-token', tokenHolder);
|
|
145
|
+
socket.emitChanged('cloud-content-changed');
|
|
146
|
+
socket.emit('cloud-content-updated');
|
|
145
147
|
});
|
|
146
148
|
return res;
|
|
147
149
|
},
|
package/src/currentVersion.js
CHANGED
|
@@ -33,18 +33,25 @@ const licenseTypeById = {
|
|
|
33
33
|
isForApp: true,
|
|
34
34
|
},
|
|
35
35
|
'9682a88b-909f-48b1-adbf-c03622884421': {
|
|
36
|
-
|
|
36
|
+
// old Team Premium, now Academic
|
|
37
|
+
name: 'Academic',
|
|
37
38
|
isPremium: true,
|
|
38
39
|
isForWeb: true,
|
|
39
40
|
isForApp: true,
|
|
40
41
|
},
|
|
41
42
|
'81456363-f167-41e3-9496-b540f4b0c150': {
|
|
42
|
-
name: '
|
|
43
|
+
name: 'Trial',
|
|
43
44
|
isPremium: true,
|
|
44
45
|
isForWeb: true,
|
|
45
46
|
isForApp: true,
|
|
46
47
|
isTrial: true,
|
|
47
48
|
},
|
|
49
|
+
'f0346efe-ebc2-4822-9a83-4b4668a897e5': {
|
|
50
|
+
name: 'Team Premium',
|
|
51
|
+
isPremium: true,
|
|
52
|
+
isForWeb: true,
|
|
53
|
+
isForApp: true,
|
|
54
|
+
},
|
|
48
55
|
};
|
|
49
56
|
|
|
50
57
|
function getLicenseByDecoded(decoded) {
|
|
@@ -88,13 +88,33 @@ async function extractConnectionSslParams(connection) {
|
|
|
88
88
|
return ssl;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
async function decryptCloudConnection(connection) {
|
|
92
|
+
const { getCloudFolderEncryptor } = require('./cloudIntf');
|
|
93
|
+
|
|
94
|
+
const m = connection?._id?.match(/^cloud\:\/\/(.+)\/(.+)$/);
|
|
95
|
+
if (!m) {
|
|
96
|
+
throw new Error('Invalid cloud connection ID format');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const folid = m[1];
|
|
100
|
+
const cntid = m[2];
|
|
101
|
+
|
|
102
|
+
const folderEncryptor = await getCloudFolderEncryptor(folid);
|
|
103
|
+
return decryptConnection(connection, folderEncryptor);
|
|
104
|
+
}
|
|
105
|
+
|
|
91
106
|
async function connectUtility(driver, storedConnection, connectionMode, additionalOptions = null) {
|
|
92
107
|
const connectionLoaded = await loadConnection(driver, storedConnection, connectionMode);
|
|
93
108
|
|
|
94
|
-
const connection =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
const connection = connectionLoaded?._id?.startsWith('cloud://')
|
|
110
|
+
? {
|
|
111
|
+
database: connectionLoaded.defaultDatabase,
|
|
112
|
+
...(await decryptCloudConnection(connectionLoaded)),
|
|
113
|
+
}
|
|
114
|
+
: {
|
|
115
|
+
database: connectionLoaded.defaultDatabase,
|
|
116
|
+
...decryptConnection(connectionLoaded),
|
|
117
|
+
};
|
|
98
118
|
|
|
99
119
|
if (!connection.port && driver.defaultPort) {
|
|
100
120
|
connection.port = driver.defaultPort.toString();
|
package/src/utility/crypting.js
CHANGED
|
@@ -91,11 +91,11 @@ function encryptObjectPasswordField(obj, field, encryptor = null) {
|
|
|
91
91
|
return obj;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
function decryptObjectPasswordField(obj, field) {
|
|
94
|
+
function decryptObjectPasswordField(obj, field, encryptor = null) {
|
|
95
95
|
if (obj && obj[field] && obj[field].startsWith('crypt:')) {
|
|
96
96
|
return {
|
|
97
97
|
...obj,
|
|
98
|
-
[field]: getInternalEncryptor().decrypt(obj[field].substring('crypt:'.length)),
|
|
98
|
+
[field]: (encryptor || getInternalEncryptor()).decrypt(obj[field].substring('crypt:'.length)),
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
return obj;
|
|
@@ -115,10 +115,10 @@ function maskConnection(connection) {
|
|
|
115
115
|
return _.omit(connection, ['password', 'sshPassword', 'sshKeyfilePassword']);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
function decryptConnection(connection) {
|
|
119
|
-
connection = decryptObjectPasswordField(connection, 'password');
|
|
120
|
-
connection = decryptObjectPasswordField(connection, 'sshPassword');
|
|
121
|
-
connection = decryptObjectPasswordField(connection, 'sshKeyfilePassword');
|
|
118
|
+
function decryptConnection(connection, encryptor = null) {
|
|
119
|
+
connection = decryptObjectPasswordField(connection, 'password', encryptor);
|
|
120
|
+
connection = decryptObjectPasswordField(connection, 'sshPassword', encryptor);
|
|
121
|
+
connection = decryptObjectPasswordField(connection, 'sshKeyfilePassword', encryptor);
|
|
122
122
|
return connection;
|
|
123
123
|
}
|
|
124
124
|
|