Add upload save feature

Add /api/upload-save endpoint that streams the data via the slave
assigned to the target instance to the instance saves directory, along
with a ctl command and web interface button to do the upload.
This commit is contained in:
Hornwitser committed 2021-06-01 16:27:02 +02:00
1 parent 0066a06107
commit 2e314ff098
18 files changed
+756 -36

No files matched your search

+1 -19
View File
@@ -23,25 +23,7 @@ class BaseConnection extends libLink.Link {
}
async forwardRequestToInstance(message, request) {
let instance = this._master.instances.get(message.data.instance_id);
if (!instance) {
throw new libErrors.RequestError(`Instance with ID ${message.data.instance_id} does not exist`);
}
let slaveId = instance.config.get("instance.assigned_slave");
if (slaveId === null) {
throw new libErrors.RequestError("Instance is not assigned to a slave");
}
let connection = this._master.wsServer.slaveConnections.get(slaveId);
if (!connection) {
throw new libErrors.RequestError("Slave containing instance is not connected");
}
if (request.plugin && !connection.plugins.has(request.plugin)) {
throw new libErrors.RequestError(`Slave containing instance does not have ${request.plugin} plugin`);
}
return await request.send(connection, message.data);
return await this._master.forwardRequestToInstance(request, message.data);
}
async forwardEventToInstance(message, event) {