mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-27 14:43:14 -05:00
Fixed device file tab edit save, #3451
This commit is contained in:
parent
e5ab311a0f
commit
a438e18e6d
@ -5502,6 +5502,25 @@
|
|||||||
|
|
||||||
// Push the next part of the file into the websocket. If dataPriming is true, push more data only if it's not the last block of the file.
|
// Push the next part of the file into the websocket. If dataPriming is true, push more data only if it's not the last block of the file.
|
||||||
function p13uploadNextPart(dataPriming) {
|
function p13uploadNextPart(dataPriming) {
|
||||||
|
if (uploadFile.xdata) {
|
||||||
|
var data = uploadFile.xdata, start = uploadFile.xptr;
|
||||||
|
if (start >= data.byteLength) {
|
||||||
|
files.sendText(JSON.stringify({ action: 'uploaddone', reqid: uploadFile.xfilePtr }));
|
||||||
|
} else {
|
||||||
|
var end = uploadFile.xptr + 16384;
|
||||||
|
if (end > data.byteLength) { if (dataPriming == true) { return; } end = data.byteLength; }
|
||||||
|
var dataslice = new Uint8Array(data.slice(start, end))
|
||||||
|
if ((dataslice[0] == 123) || (dataslice[0] == 0)) {
|
||||||
|
var datapart = new Uint8Array(end - start + 1);
|
||||||
|
datapart.set(dataslice, 1); // Add a zero char at the start of the send, this will indicate that it's not a JSON command.
|
||||||
|
files.send(datapart);
|
||||||
|
} else {
|
||||||
|
files.send(dataslice); // The data does not start with 0 or 123 "{" so it can't be confused for JSON.
|
||||||
|
}
|
||||||
|
uploadFile.xptr = end;
|
||||||
|
Q('d2progressBar').value = end;
|
||||||
|
}
|
||||||
|
} else if (uploadFile.xfile) {
|
||||||
if (uploadFile.xreader != null) return; // Data reading already in process
|
if (uploadFile.xreader != null) return; // Data reading already in process
|
||||||
if (uploadFile.xptr >= uploadFile.xfile.size) return;
|
if (uploadFile.xptr >= uploadFile.xfile.size) return;
|
||||||
var end = uploadFile.xptr + 16384;
|
var end = uploadFile.xptr + 16384;
|
||||||
@ -5530,6 +5549,7 @@
|
|||||||
};
|
};
|
||||||
uploadFile.xreader.readAsArrayBuffer(uploadFile.xfile.slice(uploadFile.xptr, end));
|
uploadFile.xreader.readAsArrayBuffer(uploadFile.xfile.slice(uploadFile.xptr, end));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// DEVICE DETAILS
|
// DEVICE DETAILS
|
||||||
|
@ -10337,6 +10337,25 @@
|
|||||||
|
|
||||||
// Push the next part of the file into the websocket. If dataPriming is true, push more data only if it's not the last block of the file.
|
// Push the next part of the file into the websocket. If dataPriming is true, push more data only if it's not the last block of the file.
|
||||||
function p13uploadNextPart(dataPriming) {
|
function p13uploadNextPart(dataPriming) {
|
||||||
|
if (uploadFile.xdata) {
|
||||||
|
var data = uploadFile.xdata, start = uploadFile.xptr;
|
||||||
|
if (start >= data.byteLength) {
|
||||||
|
files.sendText(JSON.stringify({ action: 'uploaddone', reqid: uploadFile.xfilePtr }));
|
||||||
|
} else {
|
||||||
|
var end = uploadFile.xptr + 16384;
|
||||||
|
if (end > data.byteLength) { if (dataPriming == true) { return; } end = data.byteLength; }
|
||||||
|
var dataslice = new Uint8Array(data.slice(start, end))
|
||||||
|
if ((dataslice[0] == 123) || (dataslice[0] == 0)) {
|
||||||
|
var datapart = new Uint8Array(end - start + 1);
|
||||||
|
datapart.set(dataslice, 1); // Add a zero char at the start of the send, this will indicate that it's not a JSON command.
|
||||||
|
files.send(datapart);
|
||||||
|
} else {
|
||||||
|
files.send(dataslice); // The data does not start with 0 or 123 "{" so it can't be confused for JSON.
|
||||||
|
}
|
||||||
|
uploadFile.xptr = end;
|
||||||
|
Q('d2progressBar').value = end;
|
||||||
|
}
|
||||||
|
} else if (uploadFile.xfile) {
|
||||||
if (uploadFile.xreader != null) return; // Data reading already in process
|
if (uploadFile.xreader != null) return; // Data reading already in process
|
||||||
if (uploadFile.xptr >= uploadFile.xfile.size) return;
|
if (uploadFile.xptr >= uploadFile.xfile.size) return;
|
||||||
var end = uploadFile.xptr + 16384;
|
var end = uploadFile.xptr + 16384;
|
||||||
@ -10365,6 +10384,7 @@
|
|||||||
};
|
};
|
||||||
uploadFile.xreader.readAsArrayBuffer(uploadFile.xfile.slice(uploadFile.xptr, end));
|
uploadFile.xreader.readAsArrayBuffer(uploadFile.xfile.slice(uploadFile.xptr, end));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// DEVICE EVENTS
|
// DEVICE EVENTS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user