mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 03:16:01 +00:00
show cloud content
This commit is contained in:
@@ -4,8 +4,13 @@ const {
|
||||
refreshPublicFiles,
|
||||
callCloudApiGet,
|
||||
callCloudApiPost,
|
||||
getCloudFolderEncryptor,
|
||||
} = require('../utility/cloudIntf');
|
||||
const connections = require('./connections');
|
||||
const socket = require('../utility/socket');
|
||||
const { decryptConnection, recryptConnection, getInternalEncryptor } = require('../utility/crypting');
|
||||
const { getConnectionLabel, getLogger, extractErrorLogData } = require('dbgate-tools');
|
||||
const logger = getLogger('cloud');
|
||||
|
||||
module.exports = {
|
||||
publicFiles_meta: true,
|
||||
@@ -30,9 +35,14 @@ module.exports = {
|
||||
|
||||
contentList_meta: true,
|
||||
async contentList() {
|
||||
const resp = callCloudApiGet('content-list');
|
||||
console.log('contentList', resp);
|
||||
return resp;
|
||||
try {
|
||||
const resp = await callCloudApiGet('content-list');
|
||||
return resp;
|
||||
} catch (err) {
|
||||
logger.error(extractErrorLogData(err), 'Error getting cloud content list');
|
||||
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
getContent_meta: true,
|
||||
@@ -79,4 +89,21 @@ module.exports = {
|
||||
status: 'ok',
|
||||
};
|
||||
},
|
||||
|
||||
moveConnectionCloud_meta: true,
|
||||
async moveConnectionCloud({ conid, folid }) {
|
||||
const conn = await connections.getCore({ conid });
|
||||
const folderEncryptor = getCloudFolderEncryptor(folid);
|
||||
const recryptedConn = recryptConnection(conn, getInternalEncryptor(), folderEncryptor);
|
||||
await this.putContent({
|
||||
folid,
|
||||
cntid: conid,
|
||||
content: JSON.stringify(recryptedConn),
|
||||
name: getConnectionLabel(conn),
|
||||
type: 'connection',
|
||||
});
|
||||
return {
|
||||
status: 'ok',
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user