mirror of
https://github.com/agam778/MS-365-Electron.git
synced 2026-02-17 09:02:10 +00:00
Move store-related code from menu.js to store.js
This commit is contained in:
21
app/menu.js
21
app/menu.js
@@ -1,5 +1,5 @@
|
||||
import { app, dialog, BrowserWindow, ShareMenu, clipboard } from "electron";
|
||||
import { getValue, setValue, getValueOrDefault } from './store.js';
|
||||
import { getValue, setValue } from './store.js';
|
||||
import { ElectronBlocker } from "@cliqz/adblocker-electron";
|
||||
import { clearActivity, setActivity } from './rpc.js';
|
||||
import { fileURLToPath } from 'url';
|
||||
@@ -99,25 +99,6 @@ function setUserAgent(useragent) {
|
||||
}
|
||||
}
|
||||
|
||||
getValueOrDefault("enterprise-or-normal", "?auth=1");
|
||||
getValueOrDefault("websites-in-new-window", "true");
|
||||
getValueOrDefault("autohide-menubar", "false");
|
||||
getValueOrDefault("useragentstring", useragents.Windows);
|
||||
getValueOrDefault("discordrpcstatus", "false");
|
||||
getValueOrDefault("blockadsandtrackers", "false");
|
||||
getValueOrDefault("dynamicicons", "true");
|
||||
getValueOrDefault("autoupdater", "true");
|
||||
getValueOrDefault("custompage", "home");
|
||||
|
||||
// temporary code to change the value of enterprise-or-normal to the new values for the update, will be removed in the next update.
|
||||
if (getValue("enterprise-or-normal") === "https://microsoft365.com/?auth=1") {
|
||||
setValue("enterprise-or-normal", "?auth=1");
|
||||
} else if (
|
||||
getValue("enterprise-or-normal") === "https://microsoft365.com/?auth=2"
|
||||
) {
|
||||
setValue("enterprise-or-normal", "?auth=2");
|
||||
}
|
||||
|
||||
const commonPreferencesSubmenu = [
|
||||
{
|
||||
label: "Open MS 365 with Personal Account",
|
||||
|
||||
20
app/store.js
20
app/store.js
@@ -1,4 +1,6 @@
|
||||
import useragents from "./useragents.json" with { type: "json" }
|
||||
import Store from "electron-store";
|
||||
|
||||
const store = new Store();
|
||||
|
||||
export function getValue(key) {
|
||||
@@ -17,3 +19,21 @@ export function getValueOrDefault(key, defaultValue) {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
getValueOrDefault("enterprise-or-normal", "?auth=1");
|
||||
getValueOrDefault("websites-in-new-window", "true");
|
||||
getValueOrDefault("autohide-menubar", "false");
|
||||
getValueOrDefault("useragentstring", useragents.Windows);
|
||||
getValueOrDefault("discordrpcstatus", "false");
|
||||
getValueOrDefault("blockadsandtrackers", "false");
|
||||
getValueOrDefault("dynamicicons", "true");
|
||||
getValueOrDefault("autoupdater", "true");
|
||||
getValueOrDefault("custompage", "home");
|
||||
|
||||
if (getValue("enterprise-or-normal") === "https://microsoft365.com/?auth=1") {
|
||||
setValue("enterprise-or-normal", "?auth=1");
|
||||
} else if (
|
||||
getValue("enterprise-or-normal") === "https://microsoft365.com/?auth=2"
|
||||
) {
|
||||
setValue("enterprise-or-normal", "?auth=2");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user