Display file transfer index

This commit is contained in:
Matéo Duparc 2021-05-30 17:32:37 +02:00
parent bd795ca995
commit e953b7b335
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
2 changed files with 5 additions and 4 deletions

View File

@ -188,10 +188,10 @@ document.getElementById("attach_file").onchange = function(event) {
mainDiv.appendChild(p);
showPopup(mainDiv);
} else {
let fileTransfers = [];
let filesTransfer = [];
let fileInfo = "";
for (let i=0; i<files.length; ++i) {
fileTransfers.push({
filesTransfer.push({
"file": files[i],
"name": files[i].name,
"size": files[i].size,
@ -201,7 +201,7 @@ document.getElementById("attach_file").onchange = function(event) {
fileInfo += ' '+files[i].size+' '+b64EncodeUnicode(files[i].name);
};
pendingFilesTransfers.set(currentSessionId, {
"files": fileTransfers,
"files": filesTransfer,
"index": 0,
"state": "waiting",
});
@ -1091,6 +1091,7 @@ function displayChatBottom(speed = undefined) {
fileInfo.innerHTML = "";
let filesTransfer = pendingFilesTransfers.get(currentSessionId);
let file = filesTransfer.files[filesTransfer.index];
fileInfo.appendChild(document.createTextNode(filesTransfer.index+1+"/"+filesTransfer.files.length+": "));
generateFileInfo(file.name, file.size, fileInfo);
let fileProgress = document.getElementById("file_progress");
fileProgress.style.display = "none"; //hide by default

View File

@ -838,4 +838,4 @@ async fn main() {
let websocket_port = start_websocket_server(global_vars.clone()).await;
global_vars.write().unwrap().websocket_port = websocket_port;
start_http_server(global_vars).unwrap();
}
}