diff --git a/gui/preload-chat.js b/gui/preload-chat.js
index f465cf0f..195703d9 100644
--- a/gui/preload-chat.js
+++ b/gui/preload-chat.js
@@ -1946,15 +1946,27 @@ function getSetUserInformation(selected_callsign) {
if (typeof data.user_shared_folder !== "undefined") {
// shared folder table
+ var icons = ["aac","ai","bmp","cs","css","csv","doc","docx","exe","gif","heic","html","java","jpg","js","json","jsx","key","m4p","md","mdx","mov","mp3","mp4","otf","pdf","php","png","ppt","pptx","psd","py","raw","rb","sass","scss","sh","sql","svg","tiff","tsx","ttf","txt","wav","woff","xls","xlsx","xml","yml"];
var tbl = document.getElementById("sharedFolderTableDX");
tbl.innerHTML = "";
let counter = 0;
data.user_shared_folder.forEach((file) => {
var row = document.createElement("tr");
+
+ let dxcall = selected_callsign;
+ let name = file["name"];
+ let type = file["extension"];
+
+ if (icons.indexOf(type) == -1 ) {
+ type="bi-file-earmark"
+ } else {
+ type="bi-filetype-" + type;
+ }
let id = document.createElement("td");
let idText = document.createElement("span");
- idText.innerText = counter += 1;
+ counter += 1;
+ idText.innerHTML += " " + counter;
id.appendChild(idText);
row.appendChild(id);
@@ -1966,7 +1978,7 @@ function getSetUserInformation(selected_callsign) {
let filetype = document.createElement("td");
let filetypeText = document.createElement("span");
- filetypeText.innerHTML = ``;
+ filetypeText.innerHTML = ``;
filetype.appendChild(filetypeText);
row.appendChild(filetype);
@@ -1975,7 +1987,10 @@ function getSetUserInformation(selected_callsign) {
filesizeText.innerText = formatBytes(file["size"], 2);
filesize.appendChild(filesizeText);
row.appendChild(filesize);
-
+ row.addEventListener("click", function () {
+ //console.log(name," clicked");
+ sendFileReq(dxcall,name);
+ });
tbl.appendChild(row);
});
} else {
@@ -2110,3 +2125,10 @@ function formatBytes(bytes, decimals = 2) {
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
}
+function sendFileReq(dxcall, file) {
+ //console.log(file," clicked");
+ ipcRenderer.send("run-tnc-command", {
+ command: "requestSharedFile",
+ dxcallsign: dxcall,
+ file: file
+})};
\ No newline at end of file
diff --git a/gui/preload-main.js b/gui/preload-main.js
index db50460d..89ea980c 100644
--- a/gui/preload-main.js
+++ b/gui/preload-main.js
@@ -2703,6 +2703,10 @@ ipcRenderer.on("run-tnc-command", (event, arg) => {
sock.sendRequestSharedFolderList(arg.dxcallsign);
}
+ if (arg.command == "requestSharedFile") {
+ sock.sendRequestSharedFile(arg.dxcallsign,arg.file);
+ }
+
// responses
if (arg.command == "responseUserInfo") {
sock.sendResponseInfo(arg.dxcallsign, arg.userinfo);
diff --git a/gui/sock.js b/gui/sock.js
index 0b08ecdb..bc4d23c9 100644
--- a/gui/sock.js
+++ b/gui/sock.js
@@ -718,6 +718,13 @@ exports.sendRequestSharedFolderList = function (dxcallsign) {
sendRequest(dxcallsign, 255, 1, "1", "req");
};
+//Send shared file request
+exports.sendRequestSharedFile = function (dxcallsign,file) {
+ //Command 0 = user/station information
+ //Command 1 = shared folder list
+ sendRequest(dxcallsign, 255, 1, "2" + file, "req");
+};
+
//Send station info response
exports.sendResponseInfo = function (dxcallsign, userinfo) {
//Command 0 = user/station information