mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Prettified Code!
This commit is contained in:
parent
feeced7ed3
commit
d9ef0e6208
|
@ -4,7 +4,7 @@ const { v4: uuidv4 } = require("uuid");
|
|||
const imageCompression = require("browser-image-compression");
|
||||
const blobUtil = require("blob-util");
|
||||
const FD = require("./freedata");
|
||||
const fs = require('fs');
|
||||
const fs = require("fs");
|
||||
|
||||
// https://stackoverflow.com/a/26227660
|
||||
var appDataFolder =
|
||||
|
@ -831,7 +831,10 @@ ipcRenderer.on("action-new-msg-received", (event, arg) => {
|
|||
if (config.enable_request_shared_folder == "True") {
|
||||
sendSharedFolderList(item.dxcallsign);
|
||||
}
|
||||
} else if (splitted_data[1] == "req" && splitted_data[2].substring(0,1) == "2") {
|
||||
} else if (
|
||||
splitted_data[1] == "req" &&
|
||||
splitted_data[2].substring(0, 1) == "2"
|
||||
) {
|
||||
let name = splitted_data[2].substring(1);
|
||||
//console.log("In handle req for shared folder file");
|
||||
obj.uuid = uuidv4().toString();
|
||||
|
@ -2128,7 +2131,6 @@ function sendSharedFolderList(dxcallsign) {
|
|||
}
|
||||
|
||||
function sendSharedFolderFile(dxcallsign, filename) {
|
||||
|
||||
let filePath = path.join(config.shared_folder_path, filename);
|
||||
console.log("In fuction sendSharedFolderFile ", filePath);
|
||||
|
||||
|
@ -2147,7 +2149,7 @@ function sendSharedFolderFile(dxcallsign,filename) {
|
|||
let fileData = null;
|
||||
try {
|
||||
//Has to be binary
|
||||
let data = fs.readFileSync(filePath)
|
||||
let data = fs.readFileSync(filePath);
|
||||
fileData = data.toString("utf-8");
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
@ -2158,7 +2160,7 @@ function sendSharedFolderFile(dxcallsign,filename) {
|
|||
command: "responseSharedFile",
|
||||
dxcallsign: dxcallsign,
|
||||
file: filename,
|
||||
filedata: fileData
|
||||
filedata: fileData,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
13
gui/sock.js
13
gui/sock.js
|
@ -745,8 +745,17 @@ exports.sendResponseSharedFolderList = function (dxcallsign, sharedFolderList) {
|
|||
};
|
||||
|
||||
//Send shared file response
|
||||
exports.sendResponseSharedFile = function (dxcallsign, sharedFile, sharedFileData) {
|
||||
console.log("In sendResponseSharedFile",dxcallsign,sharedFile,sharedFileData)
|
||||
exports.sendResponseSharedFile = function (
|
||||
dxcallsign,
|
||||
sharedFile,
|
||||
sharedFileData
|
||||
) {
|
||||
console.log(
|
||||
"In sendResponseSharedFile",
|
||||
dxcallsign,
|
||||
sharedFile,
|
||||
sharedFileData
|
||||
);
|
||||
//Command 0 = user/station information
|
||||
//Command 1 = shared folder list
|
||||
//Command 2 = shared file transfer
|
||||
|
|
Loading…
Reference in a new issue