diff --git a/gui_vue/.eslintrc.json b/gui_vue/.eslintrc.json new file mode 100644 index 00000000..64a243c6 --- /dev/null +++ b/gui_vue/.eslintrc.json @@ -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": { + } +} diff --git a/gui_vue/electron/main.ts b/gui_vue/electron/main.ts index 4a8e299a..d6ed3af1 100644 --- a/gui_vue/electron/main.ts +++ b/gui_vue/electron/main.ts @@ -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) + + diff --git a/gui_vue/electron/preload.ts b/gui_vue/electron/preload.ts index f1c701f8..3daa4521 100644 --- a/gui_vue/electron/preload.ts +++ b/gui_vue/electron/preload.ts @@ -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"); +}); \ No newline at end of file diff --git a/gui_vue/package.json b/gui_vue/package.json index 7bf10415..ef91ef5d 100644 --- a/gui_vue/package.json +++ b/gui_vue/package.json @@ -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", diff --git a/gui_vue/src/components/HelloWorld.vue b/gui_vue/src/components/HelloWorld.vue deleted file mode 100644 index 7b25f3f2..00000000 --- a/gui_vue/src/components/HelloWorld.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - - diff --git a/gui_vue/src/components/main.vue b/gui_vue/src/components/main.vue index 4f99c749..d4168c54 100644 --- a/gui_vue/src/components/main.vue +++ b/gui_vue/src/components/main.vue @@ -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"); diff --git a/gui_vue/src/components/settings_web.vue b/gui_vue/src/components/settings_web.vue index fc0b68d8..aaa0aa43 100644 --- a/gui_vue/src/components/settings_web.vue +++ b/gui_vue/src/components/settings_web.vue @@ -1,4 +1,6 @@