mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
adjusted build process and made freedata imports working
This commit is contained in:
parent
3a4de02569
commit
1f8d0800ba
6 changed files with 99 additions and 37 deletions
|
@ -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": [
|
||||
"**/*"
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -12,3 +12,31 @@
|
|||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
<script type="module">
|
||||
// debugging code for figuring out correct folder structure in build environment
|
||||
console.log(process.env)
|
||||
|
||||
|
||||
import { readdir } from 'node:fs/promises';
|
||||
import { readdirSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
|
||||
function walk(dir) {
|
||||
return readdirSync(dir, { withFileTypes: true }).flatMap((file) => file.isDirectory() ? walk(join(dir, file.name)) : join(dir, file.name))
|
||||
}
|
||||
|
||||
|
||||
if (process.env["NODE_ENV"] == "production"){
|
||||
|
||||
console.log(walk(process.env["APPDIR"]))
|
||||
console.log(walk(process.env["DIST"]))
|
||||
console.log(walk(process.env["DIST_ELECTRON"]))
|
||||
|
||||
} else {
|
||||
console.log("running in " + process.env["NODE_ENV"])
|
||||
}
|
||||
|
||||
</script>
|
|
@ -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]),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -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"));
|
||||
};
|
||||
|
|
|
@ -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 +
|
||||
|
|
Loading…
Reference in a new issue