diff --git a/app/config/menu.js b/app/config/menu.js index 2bd6fb2..52ea520 100644 --- a/app/config/menu.js +++ b/app/config/menu.js @@ -3,8 +3,8 @@ import { getValue, setValue } from "./store.js"; import { ElectronBlocker } from "@ghostery/adblocker-electron"; import prompt from "electron-prompt"; -//import { getScreenWidth, getScreenHeight } from "./dimensions.js"; import { setUserAgent } from "./utils.js"; +import { appUrl } from "../main.js"; import useragents from "../useragents.json" with { type: "json" }; const commonPreferencesSubmenu = [ @@ -198,32 +198,6 @@ const commonPreferencesSubmenu = [ ], }, { type: "separator" }, - { - label: "Enable Auto Updates", - type: "checkbox", - click: () => { - if (getValue("autoupdater") === "true") { - setValue("autoupdater", "false"); - dialog.showMessageBoxSync({ - type: "info", - title: "Auto Updates", - message: "Auto updates have been disabled.", - buttons: ["OK"], - }); - return; - } else if (getValue("autoupdater") === "false" || getValue("autoupdater") === undefined) { - setValue("autoupdater", "true"); - dialog.showMessageBoxSync({ - type: "info", - title: "Auto Updates", - message: "Auto updates have been enabled.", - buttons: ["OK"], - }); - return; - } - }, - checked: getValue("autoupdater") === "true", - }, { label: "Enable Dynamic Icons", type: "checkbox", @@ -250,7 +224,6 @@ const commonPreferencesSubmenu = [ }, checked: getValue("dynamicicons") === "true", }, - { type: "separator" }, { label: "Block Ads and Trackers", type: "checkbox", @@ -424,7 +397,7 @@ const menulayout = [ label: "Home", click: () => { BrowserWindow.getFocusedWindow().loadURL( - `https://microsoft365.com/${getValue("custompage")}/${getValue("enterpriseOrNormal")}` + appUrl ); }, }, diff --git a/app/config/store.js b/app/config/store.js index c010249..b88ad52 100644 --- a/app/config/store.js +++ b/app/config/store.js @@ -15,7 +15,6 @@ export function getValueOrDefault(key, defaultValue) { const value = store.get(key); if (value === undefined) { try { - console.log(key) store.set(key, defaultValue); return defaultValue; } catch (e) { @@ -36,7 +35,4 @@ getValueOrDefault("custompage", "home"); getValueOrDefault("windowWidth", 0.71); getValueOrDefault("windowHeight", 0.74); getValueOrDefault("customWindowSize", false); -getValueOrDefault("externalLinks", "false"); - -setValue("enterprise-or-normal", "?auth=2"); - +getValueOrDefault("externalLinks", "false"); \ No newline at end of file diff --git a/app/config/utils.js b/app/config/utils.js index b216eda..d8d5888 100644 --- a/app/config/utils.js +++ b/app/config/utils.js @@ -1,71 +1,5 @@ -import { app, dialog, shell } from "electron"; -import axios from "axios"; +import { app, dialog } from "electron"; import { setValue } from "./store.js"; -import updaterpkg from "electron-updater"; - -const { autoUpdater } = updaterpkg; - -export async function checkForUpdates() { - try { - const res = await axios.get( - "https://api.github.com/repos/DaanSelen/MS-365-Electron/releases/latest" - ); - const data = res.data; - const currentVersion = "v" + app.getVersion(); - const latestVersion = data.tag_name; - - if (currentVersion !== latestVersion) { - if (process.platform === "win32" || process.platform === "darwin") { - autoUpdater.checkForUpdatesAndNotify().then((result) => { - if (result === null) { - dialog.showMessageBoxSync({ - type: "info", - title: "No Update Available", - message: `Current version: ${currentVersion}\nLatest version: ${latestVersion}\n\nYou are already using the latest version.`, - buttons: ["OK"], - }); - } - }); - return; - } else { - const updatedialog = dialog.showMessageBoxSync({ - type: "info", - title: "Update Available", - message: `Current version: ${currentVersion}\nLatest version: ${latestVersion}\n\nPlease update to the latest version.`, - buttons: ["Download", "Close"], - }); - if (updatedialog === 0) { - shell.openExternal("https://github.com/DaanSelen/MS-365-Electron/releases/latest"); - } - } - } else { - dialog.showMessageBoxSync({ - type: "info", - title: "No Update Available", - message: `Your App's version: ${currentVersion}\nLatest version: ${latestVersion}\n\nYou are already using the latest version.`, - buttons: ["OK"], - }); - } - } catch (error) { - console.error("Error checking for updates:", error); - } -} - -export async function openExternalLink(url) { - await shell.openExternal(url); -} - -export async function openLogsFolder() { - if (process.platform === "win32") { - await shell.openPath( - "C:\\Users\\" + process.env.USERNAME + "\\AppData\\Roaming\\ms-365-electron\\logs\\" - ); - } else if (process.platform === "darwin") { - await shell.openPath("/Users/" + process.env.USER + "/Library/Logs/ms-365-electron/"); - } else if (process.platform === "linux") { - await shell.openPath("/home/" + process.env.USER + "/.config/ms-365-electron/logs/"); - } -} export function setUserAgent(useragent) { setValue("useragentstring", useragent); diff --git a/app/main.js b/app/main.js index 2f78467..3df1d2a 100644 --- a/app/main.js +++ b/app/main.js @@ -4,12 +4,13 @@ import { getValue } from "./config/store.js"; import { dirname, join } from "path"; import { fileURLToPath } from "url"; +app.commandLine.appendSwitch('in-process-gpu') + import { getScreenWidth, getScreenHeight } from "./config/dimensions.js"; import WindowsChrome from "./useragents.json" with { type: "json" } import checkInternetConnected from "check-internet-connected"; import domains from "./domains.json" with { type: "json" }; import contextMenu from "electron-context-menu"; -import updaterpkg from "electron-updater"; import menulayout from "./config/menu.js"; import logpkg from "electron-log"; @@ -18,8 +19,7 @@ const __filename = fileURLToPath(import.meta.url); const windowHeight = getValue("windowHeight"); const windowWidth = getValue("windowWidth"); const __dirname = dirname(__filename); -const { autoUpdater } = updaterpkg; -const appUrl = `https://akartonbv.sharepoint.com/:x:/r/sites/Bedrijfsbureau/_layouts/15/Doc.aspx?sourcedoc=%7BB0980620-EBBB-474A-AF4B-44DA45132A9C%7D&file=Productieplanning%20OneDrive.xlsx&action=default&mobileredirect=true` +export const appUrl = `https://akartonbv.sharepoint.com/:x:/r/sites/Bedrijfsbureau/_layouts/15/Doc.aspx?sourcedoc=%7BB0980620-EBBB-474A-AF4B-44DA45132A9C%7D&file=Productieplanning%20OneDrive.xlsx&action=default&mobileredirect=true` transports.file.level = "verbose"; console.log = _log; @@ -343,9 +343,6 @@ app.on("ready", function () { console.log(response); }); }); - if (getValue("autoupdater") === "true") { - autoUpdater.checkForUpdatesAndNotify(); - } }); contextMenu({ @@ -355,7 +352,6 @@ contextMenu({ Menu.setApplicationMenu(Menu.buildFromTemplate(menulayout)); -app.disableHardwareAcceleration(); app.on("ready", () => { createWindow(); }); \ No newline at end of file