more linting fixes

This commit is contained in:
DJ2LS 2023-10-03 21:04:37 +02:00
parent a75c6d72f0
commit 4f080d2640
9 changed files with 117 additions and 100 deletions

23
gui_vue/.eslintrc.json Normal file
View file

@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"plugin:prettier/recommended",
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"vue"
],
"ignorePatterns": ["**/src/assets/*", "**/src/js/deprecated*"],
"rules": {
}
}

View file

@ -2,6 +2,19 @@ import { app, BrowserWindow, ipcMain } from 'electron'
import path from 'node:path'
// pinia store setup
import { setActivePinia } from "pinia";
import pinia from "../store/index";
setActivePinia(pinia);
import { useSettingsStore } from "../store/settingsStore.js";
const settings = useSettingsStore(pinia);
//import { useIpcRenderer } from '@vueuse/electron'
//const ipcRenderer = useIpcRenderer()
@ -54,6 +67,17 @@ function createWindow() {
win?.webContents.send('main-process-message', (new Date).toLocaleString())
})
win.once("ready-to-show", () => {
console.log(settings.update_channel)
autoUpdater.channel = settings.update_channel;
autoUpdater.autoInstallOnAppQuit = false;
autoUpdater.autoDownload = true;
autoUpdater.checkForUpdatesAndNotify();
//autoUpdater.quitAndInstall();
});
if (VITE_DEV_SERVER_URL) {
win.loadURL(VITE_DEV_SERVER_URL)
} else {
@ -67,3 +91,5 @@ app.on('window-all-closed', () => {
})
app.whenReady().then(createWindow)

View file

@ -108,3 +108,42 @@ window.onmessage = ev => {
}
setTimeout(removeLoading, 3000)
import { autoUpdater } from 'electron-updater';
autoUpdater.channel = settings.update_channel;
autoUpdater.autoInstallOnAppQuit = false;
autoUpdater.autoDownload = true;
autoUpdater.checkForUpdatesAndNotify();
// LISTENER FOR UPDATER EVENTS
autoUpdater.on("update-available", (info) => {
console.log("update available");
});
autoUpdater.on("update-not-available", (info) => {
console.log("update not available");
});
autoUpdater.on("update-downloaded", (info) => {
console.log("update downloaded");
// we need to call this at this point.
// if an update is available and we are force closing the app
// the entire screen crashes...
//console.log('quit application and install update');
//autoUpdater.quitAndInstall();
});
autoUpdater.on("checking-for-update", () => {
console.log("checking for update");
});
autoUpdater.on("download-progress", (progress) => {
});
autoUpdater.on("error", (error) => {
console.log("update error");
});

View file

@ -11,6 +11,23 @@
"lint": "eslint --ext .js,.vue src",
"lint-fix": "eslint --ext .js,.vue --fix src"
},
"repository": {
"type": "git",
"url": "https://github.com/DJ2LS/FreeDATA.git"
},
"keywords": [
"TNC",
"GUI",
"FreeDATA",
"codec2"
],
"author": "DJ2LS",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/DJ2LS/FreeDATA/issues"
},
"homepage": "https://freedata.app",
"dependencies": {
"@vueuse/electron": "^10.4.1",
"blob-util": "^2.0.2",
@ -20,6 +37,7 @@
"browser-image-compression": "^2.0.2",
"chart.js": "^4.3.3",
"chartjs-plugin-annotation": "^3.0.1",
"@electron/notarize": "^1.5.1",
"electron-log": "^4.4.8",
"electron-updater": "^6.1.1",
"emoji-picker-element": "^1.18.3",

View file

@ -1,38 +0,0 @@
<script setup lang="ts">
import { ref } from 'vue'
defineProps<{ msg: string }>()
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Install
<a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
in your IDE for a better DX
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>

View file

@ -30,68 +30,7 @@ import chat from "./chat.vue";
import { stopTransmission } from "../js/sock.js";
function changeGuiDesign(design) {
if (
design != "default" &&
design != "default_light" &&
design != "default_dark" &&
design != "default_auto"
) {
var theme_path =
"../node_modules/bootswatch/dist/" + design + "/bootstrap.min.css";
document.getElementById("theme_selector").value = design;
document.getElementById("bootstrap_theme").href = escape(theme_path);
} else if (design == "default" || design == "default_light") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("theme_selector").value = "default_light";
document.getElementById("bootstrap_theme").href = escape(theme_path);
document.documentElement.setAttribute("data-bs-theme", "light");
} else if (design == "default_dark") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("theme_selector").value = "default_dark";
document.getElementById("bootstrap_theme").href = escape(theme_path);
document.querySelector("html").setAttribute("data-bs-theme", "dark");
} else if (design == "default_auto") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("theme_selector").value = "default_auto";
document.getElementById("bootstrap_theme").href = escape(theme_path);
// https://stackoverflow.com/a/57795495
// check if dark mode or light mode used in OS
if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
) {
// dark mode
document.documentElement.setAttribute("data-bs-theme", "dark");
} else {
document.documentElement.setAttribute("data-bs-theme", "light");
}
// also register event listener for automatic change
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", (event) => {
let newColorScheme = event.matches ? "dark" : "light";
if (newColorScheme == "dark") {
document.documentElement.setAttribute("data-bs-theme", "dark");
} else {
document.documentElement.setAttribute("data-bs-theme", "light");
}
});
} else {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("theme_selector").value = "default_light";
document.getElementById("bootstrap_theme").href = escape(theme_path);
document.documentElement.setAttribute("data-bs-theme", "light");
}
//update path to css file
document.getElementById("bootstrap_theme").href = escape(theme_path);
}
function stopAllTransmissions() {
console.log("stopping transmissions");

View file

@ -1,4 +1,6 @@
<script setup lang="ts">
import { saveSettingsToFile } from "../js/settingsHandler";
import { setActivePinia } from "pinia";
import pinia from "../store/index";
setActivePinia(pinia);
@ -38,7 +40,7 @@ function saveSettings() {
type="checkbox"
id="ExplorerStatsSwitch"
@change="saveSettings"
v-model="settings.enable_stats"
v-model="settings.explorer_stats"
true-value="True"
false-value="False"
/>

View file

@ -140,5 +140,11 @@ export const useStateStore = defineStore("stateStore", () => {
arq_seconds_until_finish,
arq_seconds_until_timeout,
arq_seconds_until_timeout_percent,
tnc_running_state,
arq_session_state,
is_codec2_traffic,
rf_level,
heard_stations,
beacon_state
};
});

View file

@ -6,6 +6,8 @@
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"allowJs": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,