The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-api/server/v1/import.js

42 lines
1.1 KiB

import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
RocketChat.API.v1.addRoute('uploadImportFile', { authRequired: true }, {
post() {
const { binaryContent, contentType, fileName, importerKey } = this.bodyParams;
Meteor.runAsUser(this.userId, () => {
RocketChat.API.v1.success(Meteor.call('uploadImportFile', binaryContent, contentType, fileName, importerKey));
});
return RocketChat.API.v1.success();
},
});
RocketChat.API.v1.addRoute('downloadPublicImportFile', { authRequired: true }, {
post() {
const { fileUrl, importerKey } = this.bodyParams;
Meteor.runAsUser(this.userId, () => {
RocketChat.API.v1.success(Meteor.call('downloadPublicImportFile', fileUrl, importerKey));
});
return RocketChat.API.v1.success();
},
});
RocketChat.API.v1.addRoute('getImportFileData', { authRequired: true }, {
get() {
const { importerKey } = this.requestParams();
let result;
Meteor.runAsUser(this.userId, () => {
result = Meteor.call('getImportFileData', importerKey);
});
return RocketChat.API.v1.success(result);
},
});