From 1f8d0800ba0e1d50b5d5b4ca3ae3c1a195abfa15 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Sun, 8 Oct 2023 09:57:03 +0200 Subject: [PATCH] adjusted build process and made freedata imports working --- gui_vue/electron-builder.json5 | 37 ++++++++++++++++++------------- gui_vue/electron/preload/index.ts | 30 ++++++++++++++++++++----- gui_vue/index.html | 28 +++++++++++++++++++++++ gui_vue/src/js/chatHandler.js | 11 +++++---- gui_vue/src/js/freedata.js | 9 +++++--- gui_vue/src/js/sock.js | 21 ++++++++++-------- 6 files changed, 99 insertions(+), 37 deletions(-) diff --git a/gui_vue/electron-builder.json5 b/gui_vue/electron-builder.json5 index 0326cfeb..7e384c3f 100644 --- a/gui_vue/electron-builder.json5 +++ b/gui_vue/electron-builder.json5 @@ -11,8 +11,28 @@ }, "files": [ "dist", - "dist-electron" + "dist-electron", + "src/**/*", + "node_modules/**/*", + { + from: 'src', + to: 'dist' + } ], + + + "extraResources": [ + { + "from": "src", + "to": "testfolder", + "filter": [ + "**/*", + "!**/.git" + ] + } + ], + + "mac": { "target": [ "dmg" @@ -41,18 +61,5 @@ "AppImage" ], "artifactName": "${productName}-${version}.${ext}" - }, - "files": [ - "**/*", - "!**/*.ts", - "!*.map", - "!package.json", - "!package-lock.json", - { - "from": "../dist", - "filter": [ - "**/*" - ] - }, - ] + } } diff --git a/gui_vue/electron/preload/index.ts b/gui_vue/electron/preload/index.ts index ebf1276f..57adf56c 100644 --- a/gui_vue/electron/preload/index.ts +++ b/gui_vue/electron/preload/index.ts @@ -35,17 +35,35 @@ function useLoading() { const className = `loaders-css__square-spin` const styleContent = ` @keyframes square-spin { - 25% { transform: perspective(100px) rotateX(180deg) rotateY(0); } - 50% { transform: perspective(100px) rotateX(180deg) rotateY(180deg); } - 75% { transform: perspective(100px) rotateX(0) rotateY(180deg); } - 100% { transform: perspective(100px) rotateX(0) rotateY(0); } + 0% { + transform: rotate(0deg); + background-image: url('/icon_cube_border.png'); /* Replace with the URL of your image */ + background-size: cover; /* Scale the image to cover the entire container */ + } + 25% { transform: perspective(100px) rotateX(180deg) rotateY(0); + background-image: url('/icon_cube_border.png'); /* Replace with the URL of your image */ + background-size: cover; /* Scale the image to cover the entire container */ + } + + 50% { transform: perspective(100px) rotateX(180deg) rotateY(180deg); + background-image: url('/icon_cube_border.png'); /* Replace with the URL of your image */ + background-size: cover; /* Scale the image to cover the entire container */ + } + 75% { transform: perspective(100px) rotateX(0) rotateY(180deg); + background-image: url('/icon_cube_border.png'); /* Replace with the URL of your image */ + background-size: cover; /* Scale the image to cover the entire container */ + } + 100% { transform: perspective(100px) rotateX(0) rotateY(0); + background-image: url('/icon_cube_border.png'); /* Replace with the URL of your image */ + background-size: cover; /* Scale the image to cover the entire container */ + } } .${className} > div { animation-fill-mode: both; width: 50px; height: 50px; background: #fff; - animation: square-spin 3s 0s cubic-bezier(0.09, 0.57, 0.49, 0.9) infinite; + animation: square-spin 6s 0s cubic-bezier(0.09, 0.57, 0.49, 0.9) infinite; } .app-loading-wrap { position: fixed; @@ -57,7 +75,7 @@ function useLoading() { align-items: center; justify-content: center; background: #282c34; - z-index: 9; + z-index: 99999; } ` const oStyle = document.createElement('style') diff --git a/gui_vue/index.html b/gui_vue/index.html index 3409fc22..ff2459bf 100644 --- a/gui_vue/index.html +++ b/gui_vue/index.html @@ -12,3 +12,31 @@ + + + + \ No newline at end of file diff --git a/gui_vue/src/js/chatHandler.js b/gui_vue/src/js/chatHandler.js index 45d79dca..8ca17db0 100644 --- a/gui_vue/src/js/chatHandler.js +++ b/gui_vue/src/js/chatHandler.js @@ -13,7 +13,10 @@ const chat = useChatStore(pinia); import { sendMessage } from "./sock.js"; -const FD = require("./src/js/freedata.js"); + +//const FD = require("./src/js/freedata.js"); +import {btoa_FD} from "./freedata.js" + // split character const split_char = "0;1;"; @@ -118,7 +121,7 @@ export function newBroadcast(broadcastChannel, chatmessage) { newChatObj._attachments = { [filename]: { content_type: filetype, - data: FD.btoa_FD(file), + data: btoa_FD(file), }, }; @@ -197,7 +200,7 @@ export function newMessage( newChatObj._attachments = { [filename]: { content_type: filetype, - data: FD.btoa_FD(file), + data: btoa_FD(file), }, }; @@ -592,7 +595,7 @@ export function newMessageReceived(message, protocol) { newChatObj._attachments = { [message[6]]: { content_type: message[7], - data: FD.btoa_FD(message[8]), + data: btoa_FD(message[8]), }, }; diff --git a/gui_vue/src/js/freedata.js b/gui_vue/src/js/freedata.js index 67814e97..93eebe91 100644 --- a/gui_vue/src/js/freedata.js +++ b/gui_vue/src/js/freedata.js @@ -5,7 +5,8 @@ const fs = require("fs"); * @param {string} data in normal/usual utf-8 format * @returns base64 encoded string */ -exports.btoa_FD = function (data) { +export function btoa_FD(data) { +//exports.btoa_FD = function (data) { return Buffer.from(data, "utf-8").toString("base64"); }; /** @@ -13,7 +14,8 @@ exports.btoa_FD = function (data) { * @param {string} data in base64 encoding * @returns utf-8 normal/usual string */ -exports.atob_FD = function (data) { +export function atob_FD(data) { +//exports.atob_FD = function (data) { return Buffer.from(data, "base64").toString("utf-8"); }; /** @@ -21,6 +23,7 @@ exports.atob_FD = function (data) { * @param {string} data in base64 encoding * @returns base64 bota compatible data for use in browser */ -exports.atob = function (data) { +export function atob(data) { +//exports.atob = function (data) { return window.btoa(Buffer.from(data, "base64").toString("utf8")); }; diff --git a/gui_vue/src/js/sock.js b/gui_vue/src/js/sock.js index 4b6cca38..f6bcae71 100644 --- a/gui_vue/src/js/sock.js +++ b/gui_vue/src/js/sock.js @@ -1,7 +1,10 @@ var net = require("net"); const path = require("path"); -const FD = require("./src/js/freedata.js"); +//const FD = require("./src/js/freedata.js"); +import {atob_FD, btoa_FD} from "./freedata.js" //import FD from './freedata.js'; + + import { newMessageReceived, newBeaconReceived, @@ -276,7 +279,7 @@ client.on("data", function (socketdata) { case "broadcast": // RX'd FEC BROADCAST - var encoded_data = FD.atob_FD(data["data"]); + var encoded_data = atob_FD(data["data"]); var splitted_data = encoded_data.split(split_char); var messageArray = []; if (splitted_data[0] == "m") { @@ -449,7 +452,7 @@ client.on("data", function (socketdata) { console.log(data); // we need to encode here to do a deep check for checking if file or message //var encoded_data = atob(data['data']) - var encoded_data = FD.atob_FD(data["data"]); + var encoded_data = atob_FD(data["data"]); var splitted_data = encoded_data.split(split_char); // new message received @@ -490,7 +493,7 @@ client.on("data", function (socketdata) { try { // we need to encode here to do a deep check for checking if file or message //var encoded_data = atob(data['data-array'][i]['data']) - var encoded_data = FD.atob_FD(data["data-array"][i]["data"]); + var encoded_data = atob_FD(data["data-array"][i]["data"]); var splitted_data = encoded_data.split(split_char); if (splitted_data[0] == "m") { @@ -600,7 +603,7 @@ function sendFile( //Btoa / atob will not work with charsets > 8 bits (i.e. the emojis); should probably move away from using it //TODO: Will need to update anyother occurences and throughly test //data = btoa(data) - data = FD.btoa_FD(data); + data = btoa_FD(data); command = '{"type" : "arq", "command" : "send_raw", "parameter" : [{"dxcallsign" : "' + @@ -617,7 +620,7 @@ function sendFile( // Send Message export function sendMessage(dxcallsign, data, checksum, uuid, command) { - data = FD.btoa_FD( + data = btoa_FD( "m" + split_char + command + @@ -652,7 +655,7 @@ export function sendMessage(dxcallsign, data, checksum, uuid, command) { // Send Request message //It would be then „m + split + request + split + request-type“ function sendRequest(dxcallsign, mode, frames, data, command) { - data = FD.btoa_FD("m" + split_char + command + split_char + data); + data = btoa_FD("m" + split_char + command + split_char + data); command = '{"type" : "arq", "command" : "send_raw", "parameter" : [{"dxcallsign" : "' + dxcallsign + @@ -671,7 +674,7 @@ function sendRequest(dxcallsign, mode, frames, data, command) { // Send Response message //It would be then „m + split + request + split + request-type“ function sendResponse(dxcallsign, mode, frames, data, command) { - data = FD.btoa_FD("m" + split_char + command + split_char + data); + data = btoa_FD("m" + split_char + command + split_char + data); command = '{"type" : "arq", "command" : "send_raw", "parameter" : [{"dxcallsign" : "' + dxcallsign + @@ -823,7 +826,7 @@ export function sendFecIsWriting(mycallsign) { export function sendBroadcastChannel(channel, data_out, uuid) { let checksum = ""; let command = ""; - let data = FD.btoa_FD( + let data = btoa_FD( "m" + split_char + channel +