updated private cloud functions

This commit is contained in:
strawmanbobi
2025-10-29 08:59:13 +08:00
parent 7d8c328813
commit fd05f74cca
10 changed files with 133 additions and 43 deletions

View File

@@ -233,26 +233,6 @@ exports.searchRemoteIndexes = function (req, res) {
});
};
/*
* function : Download remote binary by post request
* parameter : remote index ID
* return : Redirect to binary download
*/
exports.downloadIndex = function (req, res) {
let remoteIndexID = req.body.index_id;
internalLogic.downloadRemoteBinCachedWorkUnit(remoteIndexID, function (serveBinErr, filePath) {
if (errorCode.SUCCESS.code === serveBinErr.code) {
logger.info("download file located at " + filePath);
res.download(filePath, "");
} else {
logger.info("download file failed");
res.write('');
res.end();
}
});
};
/*
* function : Download remote binary
* parameter : remote index ID
@@ -260,8 +240,10 @@ exports.downloadIndex = function (req, res) {
*/
exports.downloadRemoteIndex = function (req, res) {
let remoteIndexID = req.query.remote_index_id;
let adminId = req.query.admin_id;
let token = req.query.token;
internalLogic.downloadRemoteBinCachedWorkUnit(remoteIndexID, function (serveBinErr, filePath) {
internalLogic.downloadRemoteBinCachedWorkUnit(adminId, token, remoteIndexID, function (serveBinErr, filePath) {
if (errorCode.SUCCESS.code === serveBinErr.code) {
logger.info("download file located at " + filePath);
res.download(filePath, "");