Prettified Code!

This commit is contained in:
DJ2LS 2023-10-22 22:23:23 +00:00 committed by GitHub Action
parent 4f2671c359
commit 37702af344
5 changed files with 45 additions and 64 deletions

View File

@ -1,10 +1,13 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<meta
http-equiv="Content-Security-Policy"
content="script-src 'self' 'unsafe-inline';"
/>
<title>FreeDATA</title>
</head>
<body>
@ -13,30 +16,25 @@
</body>
</html>
<script type="module">
// debugging code for figuring out correct folder structure in build environment
console.log(process.env)
// 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";
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"])
function walk(dir) {
return readdirSync(dir, { withFileTypes: true }).flatMap((file) =>
file.isDirectory() ? walk(join(dir, file.name)) : join(dir, file.name),
);
}
</script>
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>

View File

@ -7,9 +7,8 @@ https://github.com/vuejs/create-vue
https://vue-community.org/guide/ecosystem/desktop-apps.html#electron
https://blog.logrocket.com/building-app-electron-vue/
Folder structure
dist-electron: Automatically compiled source from vite
electron: Source code folder for Electron stuff
public: Public data
src: VueJS source code
public: Public data
src: VueJS source code

View File

@ -80,8 +80,6 @@ PouchDB.plugin(require("pouchdb-find"));
//PouchDB.plugin(require('pouchdb-replication'));
PouchDB.plugin(require("pouchdb-upsert"));
var db = new PouchDB(chatDB);
var users = new PouchDB(userDB);
@ -673,9 +671,6 @@ ipcRenderer.on("return-select-user-image", (event, arg) => {
});
});
ipcRenderer.on("action-update-transmission-status", (event, arg) => {
var data = arg["data"][0];
@ -1056,7 +1051,6 @@ update_chat = function (obj) {
var attempt = obj.attempt;
}
// add percent and bytes per minute if not existing
//console.log(obj.percent)
if (typeof obj.percent == "undefined") {
@ -1385,17 +1379,16 @@ update_chat = function (obj) {
showOsPopUp("Message received from " + obj.dxcallsign, obj.msg);
}
// check if message is signed or not for adjusting icon
if(typeof obj.hmac_signed !== "undefined" && obj.hmac_signed !== "False"){
console.log(hmac_signed)
var hmac_signed = '<i class="bi bi-shield-fill-check"></i>';
} else {
var hmac_signed = '<i class="bi bi-shield-x"></i>';
}
// check if message is signed or not for adjusting icon
if (
typeof obj.hmac_signed !== "undefined" &&
obj.hmac_signed !== "False"
) {
console.log(hmac_signed);
var hmac_signed = '<i class="bi bi-shield-fill-check"></i>';
} else {
var hmac_signed = '<i class="bi bi-shield-x"></i>';
}
var new_message = `
<div class="d-flex align-items-center" style="margin-left: auto;"> <!-- max-width: 75%; -->
@ -1412,13 +1405,9 @@ update_chat = function (obj) {
</p>
<span id="msg-${
obj._id
}-hmac-badge" class="position-absolute top-0 start-100 translate-middle badge rounded-1 bg-secondary border border-white">
<span id="msg-${obj._id}-hmac-badge" class="position-absolute top-0 start-100 translate-middle badge rounded-1 bg-secondary border border-white">
<span id="msg-${
obj._id
}-hmac-signed" class="">${hmac_signed}</span>
<span id="msg-${obj._id}-hmac-signed" class="">${hmac_signed}</span>
</span>
</div>
@ -2902,8 +2891,6 @@ function clearUnreadMessages(dxcall) {
.catch(function (err) {
console.log(err);
});
}
//Have the operating system show a notification popup

View File

@ -2,14 +2,11 @@ const path = require("path");
const { shell, clipboard } = require("electron");
const exec = require("child_process").spawn;
//import { useIpcRenderer } from '@vueuse/electron'
//const ipcRenderer = useIpcRenderer()
//import * as bootstrap from 'bootstrap'
//require("./preload-chat.js");
//require("./preload-mesh.js");
//require("./preload-log.js");
@ -17,7 +14,6 @@ const exec = require("child_process").spawn;
//const daemon = require("./daemon.js");
//const sock = require("./sock.js");
const fs = require("fs");
const FD = require("./freedata");
const {
@ -1649,7 +1645,6 @@ window.addEventListener("DOMContentLoaded", () => {
);
});
// stopTNC button clicked
document.getElementById("stopTNC").addEventListener("click", () => {
if (!confirm("Stop the TNC?")) return;
@ -1754,8 +1749,6 @@ window.addEventListener("DOMContentLoaded", () => {
sock.disconnectARQ();
});
document.getElementById("thTime").addEventListener("click", () => {
if (hslLastSort == 0 && hslLastSortDir == "asc") hslLastSortDir = "desc";
else hslLastSortDir = "asc";
@ -2895,9 +2888,13 @@ ipcRenderer.on("action-update-unread-messages-main", (event, data) => {
//Do something
if (data == true) {
document.getElementById("list-messages-list").classList.add("bg-warning");
document.getElementById("list-messages-list").classList.remove("bg-secondary");
document
.getElementById("list-messages-list")
.classList.remove("bg-secondary");
} else {
document.getElementById("list-messages-list").classList.remove("bg-warning");
document
.getElementById("list-messages-list")
.classList.remove("bg-warning");
document.getElementById("list-messages-list").classList.add("bg-secondary");
}
});

View File

@ -108,10 +108,10 @@ https://stackoverflow.com/a/9622873
/* default dark theme mods */
}
.modal-backdrop {
background-color: transparent;
background-color: transparent;
}
.modal-backdrop.in {
filter: alpha(opacity=10);
opacity: .1
filter: alpha(opacity=10);
opacity: 0.1;
}