show cloud content

This commit is contained in:
SPRINX0\prochazka
2025-05-21 17:09:16 +02:00
parent b553a81d47
commit 590a4ae476
9 changed files with 96 additions and 10 deletions

View File

@@ -10,6 +10,7 @@ const connections = require('../controllers/connections');
const { isProApp } = require('./checkLicense');
const socket = require('./socket');
const config = require('../controllers/config');
const simpleEncryptor = require('simple-encryptor');
const logger = getLogger('cloudIntf');
@@ -239,6 +240,14 @@ async function callCloudApiPost(endpoint, body) {
return resp.data;
}
async function getCloudFolderEncryptor(folid) {
const { encryptionKey } = await callCloudApiGet(`folder-key/${folid}`);
if (!encryptionKey) {
throw new Error('No encryption key');
}
return simpleEncryptor.createEncryptor(encryptionKey);
}
module.exports = {
createDbGateIdentitySession,
startCloudTokenChecking,
@@ -248,4 +257,5 @@ module.exports = {
refreshPublicFiles,
callCloudApiGet,
callCloudApiPost,
getCloudFolderEncryptor,
};