Lord knows what I did
- Separate code into different files - Drop about-window - Drop Discord RPC - Cleanup - Maybe more?
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/tr46-npm-0.0.3-de53018915-726321c5ea.zip
vendored
BIN
.yarn/cache/tr46-npm-0.0.3-de53018915-726321c5ea.zip
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/ws-npm-7.5.7-6cc440864a-5c1f669a16.zip
vendored
BIN
.yarn/cache/ws-npm-7.5.7-6cc440864a-5c1f669a16.zip
vendored
Binary file not shown.
@@ -72,7 +72,6 @@ Supported Platforms
|
|||||||
|
|
||||||
# List of Features
|
# List of Features
|
||||||
|
|
||||||
- Discord Rich Presence
|
|
||||||
- Ability to use useragent strings of Windows, macOS or Linux
|
- Ability to use useragent strings of Windows, macOS or Linux
|
||||||
- Switch between normal and enterprise/education/developer account in the same app
|
- Switch between normal and enterprise/education/developer account in the same app
|
||||||
- Back, Forward, Reload, and Home buttons
|
- Back, Forward, Reload, and Home buttons
|
||||||
|
|||||||
176
app/main.js
Normal file
176
app/main.js
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
const { app, Menu, BrowserWindow, dialog } = require("electron");
|
||||||
|
const { autoUpdater } = require("electron-updater");
|
||||||
|
const checkInternetConnected = require("check-internet-connected");
|
||||||
|
const ElectronDl = require("electron-dl");
|
||||||
|
const contextMenu = require("electron-context-menu");
|
||||||
|
const path = require("path");
|
||||||
|
const store = require("./store");
|
||||||
|
const log = require("electron-log");
|
||||||
|
|
||||||
|
const useragents = require("./useragents.json");
|
||||||
|
|
||||||
|
log.transports.file.level = "verbose";
|
||||||
|
console.log = log.log;
|
||||||
|
Object.assign(console, log.functions);
|
||||||
|
|
||||||
|
ElectronDl({
|
||||||
|
dlPath: "./downloads",
|
||||||
|
onStarted: (item) => {
|
||||||
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
|
window.setOverlayIcon(
|
||||||
|
__dirname + "/assets/icons/download.png",
|
||||||
|
"Downloading"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
dialog.showMessageBox({
|
||||||
|
type: "info",
|
||||||
|
title: "Downloading File",
|
||||||
|
message: `Downloading "${item.getFilename()}" to "${item.getSavePath()}"`,
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCompleted: () => {
|
||||||
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
|
window.setOverlayIcon(
|
||||||
|
__dirname + "/assets/icons/download-success.png",
|
||||||
|
"Download Successful"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
dialog.showMessageBox({
|
||||||
|
type: "info",
|
||||||
|
title: "Download Completed",
|
||||||
|
message: `Downloading Completed! Please check your "Downloads" folder.`,
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
|
window.setOverlayIcon(null, "");
|
||||||
|
});
|
||||||
|
}, 7000);
|
||||||
|
},
|
||||||
|
onError: (item) => {
|
||||||
|
dialog.showMessageBox({
|
||||||
|
type: "error",
|
||||||
|
title: "Download failed",
|
||||||
|
message: `Downloading "${item.getFilename()}" failed :(`,
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
|
window.setOverlayIcon(
|
||||||
|
__dirname + "/download-fail.png",
|
||||||
|
"Download Failed"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
|
window.setOverlayIcon(null, "");
|
||||||
|
});
|
||||||
|
}, 7000);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
contextMenu({
|
||||||
|
showInspectElement: false,
|
||||||
|
showServices: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const { menulayout } = require("./menu");
|
||||||
|
|
||||||
|
const menu = Menu.buildFromTemplate(menulayout);
|
||||||
|
Menu.setApplicationMenu(menu);
|
||||||
|
|
||||||
|
function createWindow() {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
width: 1181,
|
||||||
|
height: 670,
|
||||||
|
icon: path.join(__dirname, "/assets/icons/png/1024x1024.png"),
|
||||||
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
devTools: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (store.get("autohide-menubar") === "true") {
|
||||||
|
win.setAutoHideMenuBar(true);
|
||||||
|
} else {
|
||||||
|
win.setAutoHideMenuBar(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const splash = new BrowserWindow({
|
||||||
|
width: 810,
|
||||||
|
height: 610,
|
||||||
|
transparent: true,
|
||||||
|
frame: false,
|
||||||
|
alwaysOnTop: true,
|
||||||
|
icon: path.join(__dirname, "/assets/icons/png/1024x1024.png"),
|
||||||
|
});
|
||||||
|
|
||||||
|
splash.loadURL(`https://agam778.github.io/MS-365-Electron/loading`);
|
||||||
|
win.loadURL(
|
||||||
|
`${
|
||||||
|
store.get("enterprise-or-normal") || "https://microsoft365.com/?auth=1"
|
||||||
|
}`,
|
||||||
|
{
|
||||||
|
userAgent: store.get("useragentstring") || useragents.Windows,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
win.webContents.on("did-finish-load", () => {
|
||||||
|
splash.destroy();
|
||||||
|
win.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
app.on("ready", () => {
|
||||||
|
createWindow();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on("web-contents-created", (event, contents) => {
|
||||||
|
contents.setWindowOpenHandler(({ url }) => {
|
||||||
|
if (store.get("websites-in-new-window") === "false") {
|
||||||
|
if (url.includes("page=Download")) {
|
||||||
|
return { action: "allow" };
|
||||||
|
} else {
|
||||||
|
BrowserWindow.getFocusedWindow().loadURL(url);
|
||||||
|
return { action: "deny" };
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return { action: "allow" };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on("window-all-closed", () => {
|
||||||
|
if (process.platform !== "darwin") {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on("activate", () => {
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
|
createWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on("ready", function () {
|
||||||
|
checkInternetConnected()
|
||||||
|
.then(() => {
|
||||||
|
console.log("You are connected to the internet!");
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
const options = {
|
||||||
|
type: "warning",
|
||||||
|
buttons: ["Ok"],
|
||||||
|
defaultId: 2,
|
||||||
|
title: "Warning",
|
||||||
|
message: "You appear to be offline!",
|
||||||
|
detail:
|
||||||
|
"Please check your Internet Connectivity. This app cannot run without an Internet Connection!",
|
||||||
|
};
|
||||||
|
dialog.showMessageBox(null, options, (response) => {
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
});
|
||||||
346
app/menu.js
Normal file
346
app/menu.js
Normal file
@@ -0,0 +1,346 @@
|
|||||||
|
const store = require("./store");
|
||||||
|
const useragents = require("./useragents.json");
|
||||||
|
const { app, dialog, BrowserWindow } = require("electron");
|
||||||
|
const axios = require("axios");
|
||||||
|
|
||||||
|
function getValueOrDefault(key, defaultValue) {
|
||||||
|
const value = store.get(key);
|
||||||
|
if (value === undefined) {
|
||||||
|
store.set(key, defaultValue);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkForUpdates() {
|
||||||
|
try {
|
||||||
|
const res = await axios.get(
|
||||||
|
"https://api.github.com/repos/agam778/MS-365-Electron/releases/latest"
|
||||||
|
);
|
||||||
|
const data = res.data;
|
||||||
|
const currentVersion = "v" + app.getVersion();
|
||||||
|
const latestVersion = data.tag_name;
|
||||||
|
|
||||||
|
if (currentVersion !== latestVersion) {
|
||||||
|
const updatedialog = dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Update Available",
|
||||||
|
message: `Your App's version: ${currentVersion}\nLatest version: ${latestVersion}\n\nPlease update to the latest version.`,
|
||||||
|
buttons: ["Download", "Close"],
|
||||||
|
});
|
||||||
|
if (updatedialog === 0) {
|
||||||
|
shell.openExternal(
|
||||||
|
"https://github.com/agam778/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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openExternalLink(url) {
|
||||||
|
const { shell } = require("electron");
|
||||||
|
await shell.openExternal(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openLogsFolder() {
|
||||||
|
const { shell } = require("electron");
|
||||||
|
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/"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setUserAgent(useragent) {
|
||||||
|
store.set("useragentstring", useragent);
|
||||||
|
const updatedialog = dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "User-Agent string changed",
|
||||||
|
message: `You have switched to the ${useragent} User-Agent string.\n\nPlease restart the app for the changes to take effect.`,
|
||||||
|
buttons: ["Later", "Restart"],
|
||||||
|
});
|
||||||
|
if (updatedialog === 1) {
|
||||||
|
app.relaunch();
|
||||||
|
app.exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getValueOrDefault("enterprise-or-normal", "https://microsoft365.com/?auth=1");
|
||||||
|
getValueOrDefault("autohide-menubar", "false");
|
||||||
|
getValueOrDefault("useragentstring", useragents.Windows);
|
||||||
|
|
||||||
|
const menulayout = [
|
||||||
|
{
|
||||||
|
label: "Application",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "About MS-365-Electron",
|
||||||
|
click: () => {
|
||||||
|
// placeholder
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Check for Updates",
|
||||||
|
click: async () => {
|
||||||
|
await checkForUpdates();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Learn More",
|
||||||
|
click: async () => {
|
||||||
|
await openExternalLink("https://github.com/agam778/MS-365-Electron");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Open Logs Folder",
|
||||||
|
click: async () => {
|
||||||
|
await openLogsFolder();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ type: "separator" },
|
||||||
|
{
|
||||||
|
label: "Open Normal version of MS 365",
|
||||||
|
type: "radio",
|
||||||
|
click() {
|
||||||
|
store.set("enterprise-or-normal", "https://microsoft365.com/?auth=1");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Normal version of MS 365",
|
||||||
|
message:
|
||||||
|
"The normal version of MS 365 will be opened.\n\nPlease restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked:
|
||||||
|
store.get("enterprise-or-normal") ===
|
||||||
|
"https://microsoft365.com/?auth=1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Open Enterprise version of MS 365",
|
||||||
|
type: "radio",
|
||||||
|
click() {
|
||||||
|
store.set("enterprise-or-normal", "https://microsoft365.com/?auth=2");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Enterprise version of MS 365",
|
||||||
|
message:
|
||||||
|
"The enterprise version of MS 365 will be opened.\n\nPlease restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked:
|
||||||
|
store.get("enterprise-or-normal") ===
|
||||||
|
"https://microsoft365.com/?auth=2",
|
||||||
|
},
|
||||||
|
{ type: "separator" },
|
||||||
|
{
|
||||||
|
label: "Open Websites in New Windows (Recommended)",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
store.set("websites-in-new-window", "true");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Websites in New Windows",
|
||||||
|
message:
|
||||||
|
"Websites which are targeted to open in new tabs will now open in new windows.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: store.get("websites-in-new-window")
|
||||||
|
? store.get("websites-in-new-window") === "true"
|
||||||
|
: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Open Websites in the Same Window",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
store.set("websites-in-new-window", "false");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Websites in New Windows",
|
||||||
|
message:
|
||||||
|
"Websites which are targeted to open in new tabs will now open in the same window.\n\nNote: This will be buggy in some cases if you are using Enterprise version of MS 365.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: store.get("websites-in-new-window")
|
||||||
|
? store.get("websites-in-new-window") === "false"
|
||||||
|
: false,
|
||||||
|
},
|
||||||
|
{ type: "separator" },
|
||||||
|
{
|
||||||
|
label: "Windows User-Agent String",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setUserAgent(useragents.Windows);
|
||||||
|
},
|
||||||
|
checked: store.get("useragentstring") === useragents.Windows,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "macOS User-Agent String",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setUserAgent(useragents.macOS);
|
||||||
|
},
|
||||||
|
checked: store.get("useragentstring") === useragents.macOS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Linux User-Agent String",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
store.set("useragentstring", useragents.Linux);
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "User agent switcher",
|
||||||
|
message:
|
||||||
|
"You have switched to Linux Useragent.\n\nPlease restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: store.get("useragentstring") === useragents.Linux,
|
||||||
|
},
|
||||||
|
{ type: "separator" },
|
||||||
|
{
|
||||||
|
role: "quit",
|
||||||
|
accelerator: process.platform === "darwin" ? "Ctrl+Q" : "Ctrl+Q",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Navigation",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "Back",
|
||||||
|
click: () => {
|
||||||
|
BrowserWindow.getFocusedWindow().webContents.goBack();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Forward",
|
||||||
|
click: () => {
|
||||||
|
BrowserWindow.getFocusedWindow().webContents.goForward();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Reload",
|
||||||
|
click: () => {
|
||||||
|
BrowserWindow.getFocusedWindow().webContents.reload();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Home",
|
||||||
|
click: () => {
|
||||||
|
BrowserWindow.getFocusedWindow().loadURL(
|
||||||
|
`${store.get("enterprise-or-normal")}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Edit",
|
||||||
|
submenu: [
|
||||||
|
{ role: "undo" },
|
||||||
|
{ role: "redo" },
|
||||||
|
{ type: "separator" },
|
||||||
|
{ role: "cut" },
|
||||||
|
{ role: "copy" },
|
||||||
|
{ role: "paste" },
|
||||||
|
...(process.platform === "darwin"
|
||||||
|
? [
|
||||||
|
{ role: "pasteAndMatchStyle" },
|
||||||
|
{ role: "delete" },
|
||||||
|
{ role: "selectAll" },
|
||||||
|
{ type: "separator" },
|
||||||
|
{
|
||||||
|
label: "Speech",
|
||||||
|
submenu: [{ role: "startSpeaking" }, { role: "stopSpeaking" }],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [{ role: "delete" }, { type: "separator" }, { role: "selectAll" }]),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "View",
|
||||||
|
submenu: [
|
||||||
|
{ role: "reload" },
|
||||||
|
{ role: "forceReload" },
|
||||||
|
{ type: "separator" },
|
||||||
|
{ role: "resetZoom" },
|
||||||
|
{
|
||||||
|
role: "zoomIn",
|
||||||
|
accelerator: process.platform === "darwin" ? "Control+=" : "Control+=",
|
||||||
|
},
|
||||||
|
{ role: "zoomOut" },
|
||||||
|
{ type: "separator" },
|
||||||
|
{ role: "togglefullscreen" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Window",
|
||||||
|
submenu: [
|
||||||
|
{ role: "minimize" },
|
||||||
|
{ role: "zoom" },
|
||||||
|
...(process.platform === "darwin"
|
||||||
|
? [
|
||||||
|
{ type: "separator" },
|
||||||
|
{ role: "front" },
|
||||||
|
{ type: "separator" },
|
||||||
|
{ role: "window" },
|
||||||
|
]
|
||||||
|
: [{ role: "close" }]),
|
||||||
|
{ type: "separator" },
|
||||||
|
{
|
||||||
|
label: "Show Menu Bar",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
store.set("autohide-menubar", "false");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Menu Bar Settings",
|
||||||
|
message:
|
||||||
|
"Menu will be visible now. Please restart the app for changes to take effect.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: store.get("autohide-menubar") === "false",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Hide Menu Bar (ALT to show)",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
store.set("autohide-menubar", "true");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Menu Bar Settings",
|
||||||
|
message:
|
||||||
|
"Menu bar will be automatically hidden now. Please restart the app for changes to take effect.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: store.get("autohide-menubar") === "true",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
module.exports = { menulayout };
|
||||||
4
app/store.js
Normal file
4
app/store.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
const Store = require("electron-store");
|
||||||
|
const store = new Store();
|
||||||
|
|
||||||
|
module.exports = store;
|
||||||
5
app/useragents.json
Normal file
5
app/useragents.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"Windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
|
||||||
|
"macOS": "Mozilla/5.0 (Macintosh; Intel Mac OS X 13_2_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
|
||||||
|
"Linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
|
||||||
|
}
|
||||||
596
main.js
596
main.js
@@ -1,596 +0,0 @@
|
|||||||
const { app, Menu, BrowserWindow, dialog, shell } = require("electron");
|
|
||||||
const { autoUpdater } = require("electron-updater");
|
|
||||||
const openAboutWindow = require("about-window").default;
|
|
||||||
const checkInternetConnected = require("check-internet-connected");
|
|
||||||
const axios = require("axios");
|
|
||||||
const ElectronDl = require("electron-dl");
|
|
||||||
const contextMenu = require("electron-context-menu");
|
|
||||||
const path = require("path");
|
|
||||||
const Store = require("electron-store");
|
|
||||||
const log = require("electron-log");
|
|
||||||
|
|
||||||
const store = new Store();
|
|
||||||
|
|
||||||
const RPC = require("discord-rpc");
|
|
||||||
const clientId = "942637872530460742";
|
|
||||||
const rpc = new RPC.Client({ transport: "ipc" });
|
|
||||||
|
|
||||||
const windowsuseragent =
|
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36";
|
|
||||||
const macuseragent =
|
|
||||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 13_2_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36";
|
|
||||||
const linuxuseragent =
|
|
||||||
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36";
|
|
||||||
|
|
||||||
log.transports.file.level = "verbose";
|
|
||||||
console.log = log.log;
|
|
||||||
Object.assign(console, log.functions);
|
|
||||||
|
|
||||||
ElectronDl({
|
|
||||||
dlPath: "./downloads",
|
|
||||||
onStarted: (item) => {
|
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
|
||||||
window.setOverlayIcon(
|
|
||||||
__dirname + "/assets/icons/download.png",
|
|
||||||
"Downloading"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
dialog.showMessageBox({
|
|
||||||
type: "info",
|
|
||||||
title: "Downloading File",
|
|
||||||
message: `Downloading "${item.getFilename()}" to "${item.getSavePath()}"`,
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onCompleted: () => {
|
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
|
||||||
window.setOverlayIcon(
|
|
||||||
__dirname + "/assets/icons/download-success.png",
|
|
||||||
"Download Successful"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
dialog.showMessageBox({
|
|
||||||
type: "info",
|
|
||||||
title: "Download Completed",
|
|
||||||
message: `Downloading Completed! Please check your "Downloads" folder.`,
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
|
||||||
window.setOverlayIcon(null, "");
|
|
||||||
});
|
|
||||||
}, 7000);
|
|
||||||
},
|
|
||||||
onError: (item) => {
|
|
||||||
dialog.showMessageBox({
|
|
||||||
type: "error",
|
|
||||||
title: "Download failed",
|
|
||||||
message: `Downloading "${item.getFilename()}" failed :(`,
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
|
||||||
window.setOverlayIcon(
|
|
||||||
__dirname + "/download-fail.png",
|
|
||||||
"Download Failed"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
|
||||||
window.setOverlayIcon(null, "");
|
|
||||||
});
|
|
||||||
}, 7000);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
contextMenu({
|
|
||||||
showInspectElement: false,
|
|
||||||
showServices: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const menulayout = [
|
|
||||||
{
|
|
||||||
label: "Application",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "About MS-365-Electron",
|
|
||||||
click: () =>
|
|
||||||
openAboutWindow({
|
|
||||||
icon_path:
|
|
||||||
"https://raw.githubusercontent.com/agam778/MS-365-Electron/main/assets/about.png",
|
|
||||||
product_name: "MS-365-Electron",
|
|
||||||
copyright:
|
|
||||||
"Copyright (c) 2021-2023 Agampreet Singh\nOffice, the name, website, images/icons\nare the intellectual properties of Microsoft.",
|
|
||||||
package_json_dir: __dirname,
|
|
||||||
bug_report_url:
|
|
||||||
"https://github.com/agam778/MS-365-Electron/issues/",
|
|
||||||
bug_link_text: "Report an issue",
|
|
||||||
adjust_window_size: "2",
|
|
||||||
show_close_button: "Close",
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Check for Updates",
|
|
||||||
click: async () => {
|
|
||||||
axios
|
|
||||||
.get(
|
|
||||||
"https://api.github.com/repos/agam778/MS-365-Electron/releases/latest"
|
|
||||||
)
|
|
||||||
.then((res) => {
|
|
||||||
let data = res.data;
|
|
||||||
let currentVersion = "v" + app.getVersion();
|
|
||||||
let latestVersion = data.tag_name;
|
|
||||||
if (currentVersion !== latestVersion) {
|
|
||||||
const updatedialog = dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "Update Available",
|
|
||||||
message: `Your App's version: ${currentVersion}\nLatest version: ${latestVersion}\n\nPlease update to the latest version.`,
|
|
||||||
buttons: ["Download", "Close"],
|
|
||||||
});
|
|
||||||
if (updatedialog === 0) {
|
|
||||||
shell.openExternal(
|
|
||||||
"https://github.com/agam778/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"],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Learn More",
|
|
||||||
click: async () => {
|
|
||||||
const { shell } = require("electron");
|
|
||||||
await shell.openExternal(
|
|
||||||
"https://github.com/agam778/MS-365-Electron"
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Open Logs Folder",
|
|
||||||
click: async () => {
|
|
||||||
const { shell } = require("electron");
|
|
||||||
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/"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ type: "separator" },
|
|
||||||
{
|
|
||||||
label: "Open Normal version of MS 365",
|
|
||||||
type: "radio",
|
|
||||||
click() {
|
|
||||||
store.set("enterprise-or-normal", "https://microsoft365.com/?auth=1");
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "Normal version of MS 365",
|
|
||||||
message:
|
|
||||||
"The normal version of MS 365 will be opened.\n\nPlease restart the app to apply the changes.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checked:
|
|
||||||
store.get("enterprise-or-normal") ===
|
|
||||||
"https://microsoft365.com/?auth=1",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Open Enterprise version of MS 365",
|
|
||||||
type: "radio",
|
|
||||||
click() {
|
|
||||||
store.set("enterprise-or-normal", "https://microsoft365.com/?auth=2");
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "Enterprise version of MS 365",
|
|
||||||
message:
|
|
||||||
"The enterprise version of MS 365 will be opened.\n\nPlease restart the app to apply the changes.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checked:
|
|
||||||
store.get("enterprise-or-normal") ===
|
|
||||||
"https://microsoft365.com/?auth=2",
|
|
||||||
},
|
|
||||||
{ type: "separator" },
|
|
||||||
{
|
|
||||||
label: "Open Websites in New Windows (Recommended)",
|
|
||||||
type: "radio",
|
|
||||||
click: () => {
|
|
||||||
store.set("websites-in-new-window", "true");
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "Websites in New Windows",
|
|
||||||
message:
|
|
||||||
"Websites which are targeted to open in new tabs will now open in new windows.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checked: store.get("websites-in-new-window")
|
|
||||||
? store.get("websites-in-new-window") === "true"
|
|
||||||
: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Open Websites in the Same Window",
|
|
||||||
type: "radio",
|
|
||||||
click: () => {
|
|
||||||
store.set("websites-in-new-window", "false");
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "Websites in New Windows",
|
|
||||||
message:
|
|
||||||
"Websites which are targeted to open in new tabs will now open in the same window.\n\nNote: This will be buggy in some cases if you are using Enterprise version of MS 365.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checked: store.get("websites-in-new-window")
|
|
||||||
? store.get("websites-in-new-window") === "false"
|
|
||||||
: false,
|
|
||||||
},
|
|
||||||
{ type: "separator" },
|
|
||||||
{
|
|
||||||
label: "Enable Discord Rich Presence",
|
|
||||||
type: "checkbox",
|
|
||||||
click: () => {
|
|
||||||
if (store.get("discordrpcstatus") === "true") {
|
|
||||||
store.set("discordrpcstatus", "false");
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "Discord Rich Presence",
|
|
||||||
message: "Discord Rich Presence is now disabled.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
rpc.clearActivity();
|
|
||||||
return;
|
|
||||||
} else if (
|
|
||||||
store.get("discordrpcstatus") === "false" ||
|
|
||||||
store.get("discordrpcstatus") === undefined
|
|
||||||
) {
|
|
||||||
store.set("discordrpcstatus", "true");
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "Discord Rich Presence",
|
|
||||||
message: "Discord Rich Presence is now enabled.\nPlease restart the app to enable RPC.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
discordrpcupdate(
|
|
||||||
`On "${BrowserWindow.getFocusedWindow().webContents.getTitle()}"`
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
checked: store.get("discordrpcstatus") === "true" ? true : false,
|
|
||||||
},
|
|
||||||
{ type: "separator" },
|
|
||||||
{
|
|
||||||
label: "Windows User Agent String",
|
|
||||||
type: "radio",
|
|
||||||
click: () => {
|
|
||||||
store.set("useragentstring", windowsuseragent);
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "User agent switcher",
|
|
||||||
message:
|
|
||||||
"You have switched to Windows Useragent.\n\nPlease restart the app to apply the changes.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checked:
|
|
||||||
store.get("useragentstring") === windowsuseragent ? true : false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "macOS User Agent String",
|
|
||||||
type: "radio",
|
|
||||||
click: () => {
|
|
||||||
store.set("useragentstring", macuseragent);
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "User agent switcher",
|
|
||||||
message:
|
|
||||||
"You have switched to Mac OS Useragent.\n\nPlease restart the app to apply the changes.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checked: store.get("useragentstring") === macuseragent ? true : false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Linux User Agent String",
|
|
||||||
type: "radio",
|
|
||||||
click: () => {
|
|
||||||
store.set("useragentstring", linuxuseragent);
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "User agent switcher",
|
|
||||||
message:
|
|
||||||
"You have switched to Linux Useragent.\n\nPlease restart the app to apply the changes.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checked: store.get("useragentstring") === linuxuseragent ? true : false,
|
|
||||||
},
|
|
||||||
{ type: "separator" },
|
|
||||||
{
|
|
||||||
role: "quit",
|
|
||||||
accelerator: process.platform === "darwin" ? "Ctrl+Q" : "Ctrl+Q",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Navigation",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "Back",
|
|
||||||
click: () => {
|
|
||||||
BrowserWindow.getFocusedWindow().webContents.goBack();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Forward",
|
|
||||||
click: () => {
|
|
||||||
BrowserWindow.getFocusedWindow().webContents.goForward();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Reload",
|
|
||||||
click: () => {
|
|
||||||
BrowserWindow.getFocusedWindow().webContents.reload();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Home",
|
|
||||||
click: () => {
|
|
||||||
BrowserWindow.getFocusedWindow().loadURL(
|
|
||||||
`${store.get("enterprise-or-normal")}`
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Edit",
|
|
||||||
submenu: [
|
|
||||||
{ role: "undo" },
|
|
||||||
{ role: "redo" },
|
|
||||||
{ type: "separator" },
|
|
||||||
{ role: "cut" },
|
|
||||||
{ role: "copy" },
|
|
||||||
{ role: "paste" },
|
|
||||||
...(process.platform === "darwin"
|
|
||||||
? [
|
|
||||||
{ role: "pasteAndMatchStyle" },
|
|
||||||
{ role: "delete" },
|
|
||||||
{ role: "selectAll" },
|
|
||||||
{ type: "separator" },
|
|
||||||
{
|
|
||||||
label: "Speech",
|
|
||||||
submenu: [{ role: "startSpeaking" }, { role: "stopSpeaking" }],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [{ role: "delete" }, { type: "separator" }, { role: "selectAll" }]),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "View",
|
|
||||||
submenu: [
|
|
||||||
{ role: "reload" },
|
|
||||||
{ role: "forceReload" },
|
|
||||||
{ type: "separator" },
|
|
||||||
{ role: "resetZoom" },
|
|
||||||
{
|
|
||||||
role: "zoomIn",
|
|
||||||
accelerator: process.platform === "darwin" ? "Control+=" : "Control+=",
|
|
||||||
},
|
|
||||||
{ role: "zoomOut" },
|
|
||||||
{ type: "separator" },
|
|
||||||
{ role: "togglefullscreen" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Window",
|
|
||||||
submenu: [
|
|
||||||
{ role: "minimize" },
|
|
||||||
{ role: "zoom" },
|
|
||||||
...(process.platform === "darwin"
|
|
||||||
? [
|
|
||||||
{ type: "separator" },
|
|
||||||
{ role: "front" },
|
|
||||||
{ type: "separator" },
|
|
||||||
{ role: "window" },
|
|
||||||
]
|
|
||||||
: [{ role: "close" }]),
|
|
||||||
{
|
|
||||||
label: "Show Menu Bar",
|
|
||||||
type: "radio",
|
|
||||||
click: () => {
|
|
||||||
store.set("autohide-menubar", "false");
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "Menu Bar Settings",
|
|
||||||
message:
|
|
||||||
"Menu will be visible now. Please restart the app for changes to take effect.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checked: store.get("autohide-menubar") === "false",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Hide Menu Bar (Press ALT To show for some time)",
|
|
||||||
type: "radio",
|
|
||||||
click: () => {
|
|
||||||
store.set("autohide-menubar", "true");
|
|
||||||
dialog.showMessageBoxSync({
|
|
||||||
type: "info",
|
|
||||||
title: "Menu Bar Settings",
|
|
||||||
message:
|
|
||||||
"Menu bar will be automatically hidden now. Please restart the app for changes to take effect.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checked: store.get("autohide-menubar") === "true",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const menu = Menu.buildFromTemplate(menulayout);
|
|
||||||
Menu.setApplicationMenu(menu);
|
|
||||||
|
|
||||||
function discordrpc(title) {
|
|
||||||
if (store.get("discordrpcstatus") === "true") {
|
|
||||||
rpc
|
|
||||||
.setActivity({
|
|
||||||
details: `${title}`,
|
|
||||||
largeImageKey: "logo",
|
|
||||||
largeImageText: "MS-365-Electron",
|
|
||||||
startTimestamp: Date.now(),
|
|
||||||
instance: false,
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function discordrpcupdate(title) {
|
|
||||||
rpc.clearActivity();
|
|
||||||
rpc
|
|
||||||
.setActivity({
|
|
||||||
details: `${title}`,
|
|
||||||
largeImageKey: "logo",
|
|
||||||
largeImageText: "MS-365-Electron",
|
|
||||||
startTimestamp: Date.now(),
|
|
||||||
instance: false,
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function createWindow() {
|
|
||||||
const win = new BrowserWindow({
|
|
||||||
width: 1181,
|
|
||||||
height: 670,
|
|
||||||
icon: path.join(__dirname, "/assets/icons/png/1024x1024.png"),
|
|
||||||
show: false,
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: true,
|
|
||||||
devTools: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (store.get("autohide-menubar") === "true") {
|
|
||||||
win.setAutoHideMenuBar(true);
|
|
||||||
} else {
|
|
||||||
win.setAutoHideMenuBar(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
const splash = new BrowserWindow({
|
|
||||||
width: 810,
|
|
||||||
height: 610,
|
|
||||||
transparent: true,
|
|
||||||
frame: false,
|
|
||||||
alwaysOnTop: true,
|
|
||||||
icon: path.join(__dirname, "/assets/icons/png/1024x1024.png"),
|
|
||||||
});
|
|
||||||
|
|
||||||
splash.loadURL(`https://agam778.github.io/MS-365-Electron/loading`);
|
|
||||||
win.loadURL(
|
|
||||||
`${
|
|
||||||
store.get("enterprise-or-normal") || "https://microsoft365.com/?auth=1"
|
|
||||||
}`,
|
|
||||||
{
|
|
||||||
userAgent: store.get("useragentstring") || windowsuseragent,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
win.webContents.on("did-finish-load", () => {
|
|
||||||
splash.destroy();
|
|
||||||
win.show();
|
|
||||||
if (store.get("discordrpcstatus") === "true") {
|
|
||||||
discordrpc(`On "${win.webContents.getTitle()}"`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
app.on("ready", () => {
|
|
||||||
createWindow();
|
|
||||||
});
|
|
||||||
|
|
||||||
app.on("web-contents-created", (event, contents) => {
|
|
||||||
contents.setWindowOpenHandler(({ url }) => {
|
|
||||||
if (store.get("websites-in-new-window") === "false") {
|
|
||||||
if (url.includes("page=Download")) {
|
|
||||||
return { action: "allow" };
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BrowserWindow.getFocusedWindow().loadURL(url);
|
|
||||||
return { action: "deny" };
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return { action: "allow" };
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
app.on("window-all-closed", () => {
|
|
||||||
if (store.get("discordrpcstatus") === "true") {
|
|
||||||
rpc.clearActivity();
|
|
||||||
}
|
|
||||||
if (process.platform !== "darwin") {
|
|
||||||
app.quit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.on("activate", () => {
|
|
||||||
if (BrowserWindow.getAllWindows().length === 0) {
|
|
||||||
createWindow();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.on("ready", function () {
|
|
||||||
checkInternetConnected()
|
|
||||||
.then(() => {
|
|
||||||
console.log("You are connected to the internet!");
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
const options = {
|
|
||||||
type: "warning",
|
|
||||||
buttons: ["Ok"],
|
|
||||||
defaultId: 2,
|
|
||||||
title: "Warning",
|
|
||||||
message: "You appear to be offline!",
|
|
||||||
detail:
|
|
||||||
"Please check your Internet Connectivity. This app cannot run without an Internet Connection!",
|
|
||||||
};
|
|
||||||
dialog.showMessageBox(null, options, (response) => {
|
|
||||||
console.log(response);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
|
||||||
if (store.get("discordrpcstatus") === "true") {
|
|
||||||
rpc.login({ clientId }).catch(() =>
|
|
||||||
dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
|
|
||||||
type: "error",
|
|
||||||
title: "Discord RPC Error",
|
|
||||||
message:
|
|
||||||
"Oops! An Error occured while connecting to Discord RPC. Probably discord isn't installed or opened?",
|
|
||||||
buttons: ["OK"],
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "ms-365-electron",
|
"name": "ms-365-electron",
|
||||||
"version": "0.9.0",
|
"version": "0.9.0",
|
||||||
"description": "Unofficial Microsoft 365 Web Desktop Wrapper made with Electron",
|
"description": "Unofficial Microsoft 365 Web Desktop Wrapper made with Electron",
|
||||||
"main": "main.js",
|
"main": "app/main.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/agam778/MS-365-Electron.git"
|
"url": "https://github.com/agam778/MS-365-Electron.git"
|
||||||
@@ -72,10 +72,8 @@
|
|||||||
"eslint": "^8.36.0"
|
"eslint": "^8.36.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"about-window": "^1.15.2",
|
|
||||||
"axios": "^1.3.4",
|
"axios": "^1.3.4",
|
||||||
"check-internet-connected": "^2.0.6",
|
"check-internet-connected": "^2.0.6",
|
||||||
"discord-rpc": "^4.0.1",
|
|
||||||
"electron-context-menu": "^3.6.1",
|
"electron-context-menu": "^3.6.1",
|
||||||
"electron-dl": "^3.5.0",
|
"electron-dl": "^3.5.0",
|
||||||
"electron-log": "^5.0.0-beta.19",
|
"electron-log": "^5.0.0-beta.19",
|
||||||
|
|||||||
104
yarn.lock
104
yarn.lock
@@ -370,13 +370,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"about-window@npm:^1.15.2":
|
|
||||||
version: 1.15.2
|
|
||||||
resolution: "about-window@npm:1.15.2"
|
|
||||||
checksum: 0e528f6312d2dc3801926f056230e5c6c253f4be16449b4c01b115a2dd24e8b6897f8ba8c07880097415936b9c40a04c10954558af3a6d05d76a11d8a07875d8
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"acorn-jsx@npm:^5.3.2":
|
"acorn-jsx@npm:^5.3.2":
|
||||||
version: 5.3.2
|
version: 5.3.2
|
||||||
resolution: "acorn-jsx@npm:5.3.2"
|
resolution: "acorn-jsx@npm:5.3.2"
|
||||||
@@ -645,15 +638,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"bindings@npm:^1.3.0":
|
|
||||||
version: 1.5.0
|
|
||||||
resolution: "bindings@npm:1.5.0"
|
|
||||||
dependencies:
|
|
||||||
file-uri-to-path: 1.0.0
|
|
||||||
checksum: 65b6b48095717c2e6105a021a7da4ea435aa8d3d3cd085cb9e85bcb6e5773cf318c4745c3f7c504412855940b585bdf9b918236612a1c7a7942491de176f1ae7
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"bluebird-lst@npm:^1.0.9":
|
"bluebird-lst@npm:^1.0.9":
|
||||||
version: 1.0.9
|
version: 1.0.9
|
||||||
resolution: "bluebird-lst@npm:1.0.9"
|
resolution: "bluebird-lst@npm:1.0.9"
|
||||||
@@ -1146,20 +1130,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"discord-rpc@npm:^4.0.1":
|
|
||||||
version: 4.0.1
|
|
||||||
resolution: "discord-rpc@npm:4.0.1"
|
|
||||||
dependencies:
|
|
||||||
node-fetch: ^2.6.1
|
|
||||||
register-scheme: "github:devsnek/node-register-scheme"
|
|
||||||
ws: ^7.3.1
|
|
||||||
dependenciesMeta:
|
|
||||||
register-scheme:
|
|
||||||
optional: true
|
|
||||||
checksum: f96e4e32751402c9a689b24eccfa319315995f8906bb86e167c6a94bc6466f3641b41f8a082ac5b4e92baa7cefdb3456e7c4d86ccd2d9373281c9a93b7335c56
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"dmg-builder@npm:23.6.0":
|
"dmg-builder@npm:23.6.0":
|
||||||
version: 23.6.0
|
version: 23.6.0
|
||||||
resolution: "dmg-builder@npm:23.6.0"
|
resolution: "dmg-builder@npm:23.6.0"
|
||||||
@@ -1638,13 +1608,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"file-uri-to-path@npm:1.0.0":
|
|
||||||
version: 1.0.0
|
|
||||||
resolution: "file-uri-to-path@npm:1.0.0"
|
|
||||||
checksum: b648580bdd893a008c92c7ecc96c3ee57a5e7b6c4c18a9a09b44fb5d36d79146f8e442578bc0e173dc027adf3987e254ba1dfd6e3ec998b7c282873010502144
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"filelist@npm:^1.0.1":
|
"filelist@npm:^1.0.1":
|
||||||
version: 1.0.4
|
version: 1.0.4
|
||||||
resolution: "filelist@npm:1.0.4"
|
resolution: "filelist@npm:1.0.4"
|
||||||
@@ -2610,10 +2573,8 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "ms-365-electron@workspace:."
|
resolution: "ms-365-electron@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
about-window: ^1.15.2
|
|
||||||
axios: ^1.3.4
|
axios: ^1.3.4
|
||||||
check-internet-connected: ^2.0.6
|
check-internet-connected: ^2.0.6
|
||||||
discord-rpc: ^4.0.1
|
|
||||||
electron: ^23.2.0
|
electron: ^23.2.0
|
||||||
electron-builder: ^23.6.0
|
electron-builder: ^23.6.0
|
||||||
electron-context-menu: ^3.6.1
|
electron-context-menu: ^3.6.1
|
||||||
@@ -2661,7 +2622,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"node-addon-api@npm:^1.3.0, node-addon-api@npm:^1.6.3":
|
"node-addon-api@npm:^1.6.3":
|
||||||
version: 1.7.2
|
version: 1.7.2
|
||||||
resolution: "node-addon-api@npm:1.7.2"
|
resolution: "node-addon-api@npm:1.7.2"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -2670,20 +2631,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"node-fetch@npm:^2.6.1":
|
|
||||||
version: 2.6.7
|
|
||||||
resolution: "node-fetch@npm:2.6.7"
|
|
||||||
dependencies:
|
|
||||||
whatwg-url: ^5.0.0
|
|
||||||
peerDependencies:
|
|
||||||
encoding: ^0.1.0
|
|
||||||
peerDependenciesMeta:
|
|
||||||
encoding:
|
|
||||||
optional: true
|
|
||||||
checksum: 8d816ffd1ee22cab8301c7756ef04f3437f18dace86a1dae22cf81db8ef29c0bf6655f3215cb0cdb22b420b6fe141e64b26905e7f33f9377a7fa59135ea3e10b
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"node-gyp@npm:^9.3.1":
|
"node-gyp@npm:^9.3.1":
|
||||||
version: 9.3.1
|
version: 9.3.1
|
||||||
resolution: "node-gyp@npm:9.3.1"
|
resolution: "node-gyp@npm:9.3.1"
|
||||||
@@ -3017,16 +2964,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"register-scheme@github:devsnek/node-register-scheme":
|
|
||||||
version: 0.0.2
|
|
||||||
resolution: "register-scheme@https://github.com/devsnek/node-register-scheme.git#commit=e7cc9a63a1f512565da44cb57316d9fb10750e17"
|
|
||||||
dependencies:
|
|
||||||
bindings: ^1.3.0
|
|
||||||
node-addon-api: ^1.3.0
|
|
||||||
checksum: e3281b9b81f5718ebc05c27988f6ef33bcd452048a414ad5862f29348d14513b988ec117cc73ef46955c40f78185aaec1430361dc1d1fe0a662eec864a2bf058
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"require-directory@npm:^2.1.1":
|
"require-directory@npm:^2.1.1":
|
||||||
version: 2.1.1
|
version: 2.1.1
|
||||||
resolution: "require-directory@npm:2.1.1"
|
resolution: "require-directory@npm:2.1.1"
|
||||||
@@ -3449,13 +3386,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"tr46@npm:~0.0.3":
|
|
||||||
version: 0.0.3
|
|
||||||
resolution: "tr46@npm:0.0.3"
|
|
||||||
checksum: 726321c5eaf41b5002e17ffbd1fb7245999a073e8979085dacd47c4b4e8068ff5777142fc6726d6ca1fd2ff16921b48788b87225cbc57c72636f6efa8efbffe3
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"truncate-utf8-bytes@npm:^1.0.0":
|
"truncate-utf8-bytes@npm:^1.0.0":
|
||||||
version: 1.0.2
|
version: 1.0.2
|
||||||
resolution: "truncate-utf8-bytes@npm:1.0.2"
|
resolution: "truncate-utf8-bytes@npm:1.0.2"
|
||||||
@@ -3590,23 +3520,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"webidl-conversions@npm:^3.0.0":
|
|
||||||
version: 3.0.1
|
|
||||||
resolution: "webidl-conversions@npm:3.0.1"
|
|
||||||
checksum: c92a0a6ab95314bde9c32e1d0a6dfac83b578f8fa5f21e675bc2706ed6981bc26b7eb7e6a1fab158e5ce4adf9caa4a0aee49a52505d4d13c7be545f15021b17c
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"whatwg-url@npm:^5.0.0":
|
|
||||||
version: 5.0.0
|
|
||||||
resolution: "whatwg-url@npm:5.0.0"
|
|
||||||
dependencies:
|
|
||||||
tr46: ~0.0.3
|
|
||||||
webidl-conversions: ^3.0.0
|
|
||||||
checksum: b8daed4ad3356cc4899048a15b2c143a9aed0dfae1f611ebd55073310c7b910f522ad75d727346ad64203d7e6c79ef25eafd465f4d12775ca44b90fa82ed9e2c
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"which@npm:^2.0.1, which@npm:^2.0.2":
|
"which@npm:^2.0.1, which@npm:^2.0.2":
|
||||||
version: 2.0.2
|
version: 2.0.2
|
||||||
resolution: "which@npm:2.0.2"
|
resolution: "which@npm:2.0.2"
|
||||||
@@ -3652,21 +3565,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"ws@npm:^7.3.1":
|
|
||||||
version: 7.5.7
|
|
||||||
resolution: "ws@npm:7.5.7"
|
|
||||||
peerDependencies:
|
|
||||||
bufferutil: ^4.0.1
|
|
||||||
utf-8-validate: ^5.0.2
|
|
||||||
peerDependenciesMeta:
|
|
||||||
bufferutil:
|
|
||||||
optional: true
|
|
||||||
utf-8-validate:
|
|
||||||
optional: true
|
|
||||||
checksum: 5c1f669a166fb57560b4e07f201375137fa31d9186afde78b1508926345ce546332f109081574ddc4e38cc474c5406b5fc71c18d71eb75f6e2d2245576976cba
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"xmlbuilder@npm:>=11.0.1":
|
"xmlbuilder@npm:>=11.0.1":
|
||||||
version: 15.1.1
|
version: 15.1.1
|
||||||
resolution: "xmlbuilder@npm:15.1.1"
|
resolution: "xmlbuilder@npm:15.1.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user