mirror of
https://github.com/agam778/MS-365-Electron.git
synced 2026-02-17 09:02:10 +00:00
Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cc4f71535 | ||
|
|
6f49a5554f | ||
|
|
aaa862364e | ||
|
|
0a3e4514a9 | ||
|
|
701d63c900 | ||
|
|
8f24d0184a | ||
|
|
34fdc82b50 | ||
|
|
48bab03708 | ||
|
|
af448cac3d | ||
|
|
102126d6d3 | ||
|
|
0b308b066f | ||
|
|
e60ffc52c9 | ||
|
|
ed0e90c451 | ||
|
|
3f67f7575f | ||
|
|
9fac90d90b | ||
|
|
36e42e311b | ||
|
|
bffa016eb9 | ||
|
|
c85ae12648 | ||
|
|
bc7968978a | ||
|
|
058711af45 | ||
|
|
179c52c28b | ||
|
|
acdae139d6 | ||
|
|
9a0bdc8fae | ||
|
|
81fe8c3ec0 | ||
|
|
8887d8a365 | ||
|
|
83ecdcd09b | ||
|
|
191876de3d | ||
|
|
56ab9b5007 | ||
|
|
7de220f5c6 | ||
|
|
7c295c51e6 | ||
|
|
34fc4ede8d | ||
|
|
dc23b1a58d | ||
|
|
664ddf81bf | ||
|
|
705f0447e7 | ||
|
|
69565c589a | ||
|
|
75d032248f | ||
|
|
7bd0ad2462 | ||
|
|
dc64f14fcb | ||
|
|
6e7a551d86 | ||
|
|
477f534049 | ||
|
|
25ac26214b | ||
|
|
e884d01cb1 | ||
|
|
729e9e276d | ||
|
|
df135f9578 | ||
|
|
e333196dc2 | ||
|
|
77c7cb08c0 | ||
|
|
96a4020e1e | ||
|
|
cbe9194a35 | ||
|
|
e238550568 | ||
|
|
e942b06a10 | ||
|
|
affc7bb676 | ||
|
|
4d0d742520 | ||
|
|
686d3ac491 | ||
|
|
6a706a96f4 | ||
|
|
bcd15e05cd | ||
|
|
c9ea1d2d3b | ||
|
|
c094b28f74 |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
|
||||||
|
|
||||||
- name: Install Node.js, NPM and Yarn
|
- name: Install Node.js, NPM and Yarn
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
|
|||||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
|
||||||
|
|
||||||
- name: Install Node.js, NPM and Yarn
|
- name: Install Node.js, NPM and Yarn
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,3 +1,3 @@
|
|||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-4.0.2.cjs
|
yarnPath: .yarn/releases/yarn-4.2.1.cjs
|
||||||
|
|||||||
32
README.md
32
README.md
@@ -40,6 +40,8 @@
|
|||||||
- [Installation on Ubuntu/Debian based distributions](#installation-on-ubuntudebian-based-distributions)
|
- [Installation on Ubuntu/Debian based distributions](#installation-on-ubuntudebian-based-distributions)
|
||||||
- [Installation on Red Hat/Fedora based distributions](#installation-on-red-hatfedora-based-distributions)
|
- [Installation on Red Hat/Fedora based distributions](#installation-on-red-hatfedora-based-distributions)
|
||||||
- [Installation on Arch Linux based distributions](#installation-on-arch-linux-based-distributions)
|
- [Installation on Arch Linux based distributions](#installation-on-arch-linux-based-distributions)
|
||||||
|
- [Installation on Void Linux](#installation-on-void-linux)
|
||||||
|
- [Maintained by: @xHyroM](#maintained-by-xhyrom)
|
||||||
- [Installation on Gentoo Linux (Unmaintained)](#installation-on-gentoo-linux-unmaintained)
|
- [Installation on Gentoo Linux (Unmaintained)](#installation-on-gentoo-linux-unmaintained)
|
||||||
- [💻 Developing Locally](#-developing-locally)
|
- [💻 Developing Locally](#-developing-locally)
|
||||||
- [📃 MIT License](#-mit-license)
|
- [📃 MIT License](#-mit-license)
|
||||||
@@ -61,9 +63,10 @@ Supported Platforms
|
|||||||
3. Ubuntu/Debian based distributions (DEB File)
|
3. Ubuntu/Debian based distributions (DEB File)
|
||||||
4. Red Hat Linux/Fedora based distributions (RPM File)
|
4. Red Hat Linux/Fedora based distributions (RPM File)
|
||||||
5. Arch Linux based distributions (Uploaded on AUR)
|
5. Arch Linux based distributions (Uploaded on AUR)
|
||||||
6. Gentoo Linux (Unofficial overlay) **[MAINTAINER NEEDED]**
|
6. Void Linux (Maintained by: [@xHyroM](https://github.com/xHyroM))
|
||||||
7. All Distributions supporting AppImage (AppImage File); and
|
7. Gentoo Linux (Unofficial overlay) **[MAINTAINER NEEDED]**
|
||||||
8. All Distributions supporting Snap (Uploaded on Snap Store)
|
8. All Distributions supporting AppImage (AppImage File); and
|
||||||
|
9. All Distributions supporting Snap (Uploaded on Snap Store)
|
||||||
|
|
||||||
# List of Features
|
# List of Features
|
||||||
|
|
||||||
@@ -163,6 +166,29 @@ For Installing in Red Hat/Fedora based distribution :-
|
|||||||
|
|
||||||
4. Wait for it to install and tada! The app is installed.
|
4. Wait for it to install and tada! The app is installed.
|
||||||
|
|
||||||
|
### Installation on Void Linux
|
||||||
|
#### Maintained by: [@xHyroM](https://github.com/xHyroM)
|
||||||
|
|
||||||
|
1. In order to install the package, create a new .conf file in the /etc/xbps.d directory containing the repository URL:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo nano /etc/xbps.d/99-xhyrom-dev.conf
|
||||||
|
|
||||||
|
repository=https://void-repo.xhyrom.dev
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Synchronize the repository and import the RSA key:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo xbps-install -S
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Install the package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo xbps-install -S ms-365-electron
|
||||||
|
```
|
||||||
|
|
||||||
### Installation on Gentoo Linux (Unmaintained)
|
### Installation on Gentoo Linux (Unmaintained)
|
||||||
|
|
||||||
_Maintainer needed_
|
_Maintainer needed_
|
||||||
|
|||||||
155
app/main.js
155
app/main.js
@@ -1,74 +1,68 @@
|
|||||||
const { app, Menu, BrowserWindow, dialog, nativeImage } = require("electron");
|
import { app, Menu, BrowserWindow, dialog, nativeImage } from "electron";
|
||||||
const { autoUpdater } = require("electron-updater");
|
import { clearActivity, setActivity, loginToRPC } from './rpc.js';
|
||||||
const checkInternetConnected = require("check-internet-connected");
|
import { initialize, trackEvent } from "@aptabase/electron/main";
|
||||||
const ElectronDl = require("electron-dl");
|
import { ElectronBlocker } from "@cliqz/adblocker-electron";
|
||||||
const contextMenu = require("electron-context-menu");
|
import { getValue } from './store.js';
|
||||||
const path = require("path");
|
import { fileURLToPath } from 'url';
|
||||||
const log = require("electron-log");
|
import { dirname } from 'path';
|
||||||
const { setActivity, loginToRPC, clearActivity } = require("./rpc");
|
import { join } from "path";
|
||||||
const useragents = require("./useragents.json");
|
|
||||||
const { ElectronBlocker } = require("@cliqz/adblocker-electron");
|
|
||||||
const { getValue } = require("./store");
|
|
||||||
const { menulayout } = require("./menu");
|
|
||||||
|
|
||||||
log.transports.file.level = "verbose";
|
import Windows from "./useragents.json" with { type: "json" };
|
||||||
console.log = log.log;
|
import checkInternetConnected from "check-internet-connected";
|
||||||
Object.assign(console, log.functions);
|
import contextMenu from "electron-context-menu";
|
||||||
|
import updaterpkg from "electron-updater";
|
||||||
|
import ElectronDl from "electron-dl";
|
||||||
|
import menulayout from './menu.js'
|
||||||
|
import logpkg from 'electron-log';
|
||||||
|
|
||||||
|
const { transports, log: _log, functions } = logpkg;
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = dirname(__filename);
|
||||||
|
const { autoUpdater } = updaterpkg;
|
||||||
|
|
||||||
|
transports.file.level = "verbose";
|
||||||
|
console.log = _log;
|
||||||
|
Object.assign(console, functions);
|
||||||
|
|
||||||
|
initialize("A-US-2528580917");
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
if (getValue("enterprise-or-normal") === "https://microsoft365.com/?auth=1") {
|
const enterpriseOrNormal = getValue("enterprise-or-normal");
|
||||||
var win = new BrowserWindow({
|
const custompage = getValue("custompage");
|
||||||
width: 1181,
|
const partition = enterpriseOrNormal === "?auth=1" ? "persist:personal" : "persist:work";
|
||||||
height: 670,
|
|
||||||
icon: path.join(__dirname, "/assets/icons/png/1024x1024.png"),
|
const win = new BrowserWindow({
|
||||||
show: false,
|
width: 1181,
|
||||||
webPreferences: {
|
height: 670,
|
||||||
nodeIntegration: true,
|
icon: join(__dirname, "/assets/icons/png/1024x1024.png"),
|
||||||
devTools: true,
|
show: false,
|
||||||
partition: "persist:personal",
|
webPreferences: {
|
||||||
},
|
nodeIntegration: true,
|
||||||
});
|
devTools: true,
|
||||||
} else if (
|
partition: partition,
|
||||||
getValue("enterprise-or-normal") === "https://microsoft365.com/?auth=2"
|
},
|
||||||
) {
|
});
|
||||||
var win = new BrowserWindow({
|
|
||||||
width: 1181,
|
win.setAutoHideMenuBar(getValue("autohide-menubar") === "true");
|
||||||
height: 670,
|
|
||||||
icon: path.join(__dirname, "/assets/icons/png/1024x1024.png"),
|
|
||||||
show: false,
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: true,
|
|
||||||
devTools: true,
|
|
||||||
partition: "persist:work",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getValue("autohide-menubar") === "true") {
|
|
||||||
win.setAutoHideMenuBar(true);
|
|
||||||
} else {
|
|
||||||
win.setAutoHideMenuBar(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
const splash = new BrowserWindow({
|
const splash = new BrowserWindow({
|
||||||
width: 810,
|
width: 810,
|
||||||
height: 610,
|
height: 610,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
frame: false,
|
frame: false,
|
||||||
icon: path.join(__dirname, "/assets/icons/png/1024x1024.png"),
|
icon: join(__dirname, "/assets/icons/png/1024x1024.png"),
|
||||||
});
|
});
|
||||||
|
|
||||||
splash.loadURL(`https://agam778.github.io/MS-365-Electron/loading`);
|
splash.loadURL(`https://agam778.github.io/MS-365-Electron/loading`);
|
||||||
win.loadURL(
|
|
||||||
`${getValue("enterprise-or-normal") || "https://microsoft365.com/?auth=1"}`,
|
win.loadURL(`https://microsoft365.com/${custompage}/${enterpriseOrNormal}`, {
|
||||||
{
|
userAgent: getValue("useragentstring") || Windows,
|
||||||
userAgent: getValue("useragentstring") || useragents.Windows,
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
win.webContents.on("did-finish-load", () => {
|
win.webContents.on("did-finish-load", () => {
|
||||||
splash.destroy();
|
splash.destroy();
|
||||||
win.show();
|
win.show();
|
||||||
|
trackEvent("app_started");
|
||||||
if (getValue("discordrpcstatus") === "true") {
|
if (getValue("discordrpcstatus") === "true") {
|
||||||
setActivity(`On "${win.webContents.getTitle()}"`);
|
setActivity(`On "${win.webContents.getTitle()}"`);
|
||||||
}
|
}
|
||||||
@@ -143,7 +137,7 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
`On "${BrowserWindow.getFocusedWindow().webContents.getTitle()}"`
|
`On "${BrowserWindow.getFocusedWindow().webContents.getTitle()}"`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return { action: "allow" };
|
return { action: "allow", overrideBrowserWindowOptions: { width: 1081, height: 610 } };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
contents.on("did-finish-load", () => {
|
contents.on("did-finish-load", () => {
|
||||||
@@ -159,11 +153,11 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
) {
|
) {
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
app.dock.setIcon(
|
app.dock.setIcon(
|
||||||
path.join(__dirname, "../assets/icons/apps/powerpoint-mac.png")
|
join(__dirname, "../assets/icons/apps/powerpoint-mac.png")
|
||||||
);
|
);
|
||||||
} else if (process.platform === "win32") {
|
} else if (process.platform === "win32") {
|
||||||
let nimage = nativeImage.createFromPath(
|
let nimage = nativeImage.createFromPath(
|
||||||
path.join(__dirname, "../assets/icons/apps/powerpoint.png")
|
join(__dirname, "../assets/icons/apps/powerpoint.png")
|
||||||
);
|
);
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
window.setOverlayIcon(nimage, "PowerPoint");
|
window.setOverlayIcon(nimage, "PowerPoint");
|
||||||
@@ -179,11 +173,11 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
) {
|
) {
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
app.dock.setIcon(
|
app.dock.setIcon(
|
||||||
path.join(__dirname, "../assets/icons/apps/word-mac.png")
|
join(__dirname, "../assets/icons/apps/word-mac.png")
|
||||||
);
|
);
|
||||||
} else if (process.platform === "win32") {
|
} else if (process.platform === "win32") {
|
||||||
let nimage = nativeImage.createFromPath(
|
let nimage = nativeImage.createFromPath(
|
||||||
path.join(__dirname, "../assets/icons/apps/word.png")
|
join(__dirname, "../assets/icons/apps/word.png")
|
||||||
);
|
);
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
window.setOverlayIcon(nimage, "Word");
|
window.setOverlayIcon(nimage, "Word");
|
||||||
@@ -199,11 +193,11 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
) {
|
) {
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
app.dock.setIcon(
|
app.dock.setIcon(
|
||||||
path.join(__dirname, "../assets/icons/apps/excel-mac.png")
|
join(__dirname, "../assets/icons/apps/excel-mac.png")
|
||||||
);
|
);
|
||||||
} else if (process.platform === "win32") {
|
} else if (process.platform === "win32") {
|
||||||
let nimage = nativeImage.createFromPath(
|
let nimage = nativeImage.createFromPath(
|
||||||
path.join(__dirname, "../assets/icons/apps/excel.png")
|
join(__dirname, "../assets/icons/apps/excel.png")
|
||||||
);
|
);
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
window.setOverlayIcon(nimage, "Excel");
|
window.setOverlayIcon(nimage, "Excel");
|
||||||
@@ -219,11 +213,11 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
) {
|
) {
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
app.dock.setIcon(
|
app.dock.setIcon(
|
||||||
path.join(__dirname, "../assets/icons/apps/outlook-mac.png")
|
join(__dirname, "../assets/icons/apps/outlook-mac.png")
|
||||||
);
|
);
|
||||||
} else if (process.platform === "win32") {
|
} else if (process.platform === "win32") {
|
||||||
let nimage = nativeImage.createFromPath(
|
let nimage = nativeImage.createFromPath(
|
||||||
path.join(__dirname, "../assets/icons/apps/outlook.png")
|
join(__dirname, "../assets/icons/apps/outlook.png")
|
||||||
);
|
);
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
window.setOverlayIcon(nimage, "Outlook");
|
window.setOverlayIcon(nimage, "Outlook");
|
||||||
@@ -239,11 +233,11 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
) {
|
) {
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
app.dock.setIcon(
|
app.dock.setIcon(
|
||||||
path.join(__dirname, "../assets/icons/apps/onedrive-mac.png")
|
join(__dirname, "../assets/icons/apps/onedrive-mac.png")
|
||||||
);
|
);
|
||||||
} else if (process.platform === "win32") {
|
} else if (process.platform === "win32") {
|
||||||
let nimage = nativeImage.createFromPath(
|
let nimage = nativeImage.createFromPath(
|
||||||
path.join(__dirname, "../assets/icons/apps/onedrive.png")
|
join(__dirname, "../assets/icons/apps/onedrive.png")
|
||||||
);
|
);
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
window.setOverlayIcon(nimage, "OneDrive");
|
window.setOverlayIcon(nimage, "OneDrive");
|
||||||
@@ -256,11 +250,11 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
) {
|
) {
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
app.dock.setIcon(
|
app.dock.setIcon(
|
||||||
path.join(__dirname, "../assets/icons/apps/teams-mac.png")
|
join(__dirname, "../assets/icons/apps/teams-mac.png")
|
||||||
);
|
);
|
||||||
} else if (process.platform === "win32") {
|
} else if (process.platform === "win32") {
|
||||||
let nimage = nativeImage.createFromPath(
|
let nimage = nativeImage.createFromPath(
|
||||||
path.join(__dirname, "../assets/icons/apps/teams.png")
|
join(__dirname, "../assets/icons/apps/teams.png")
|
||||||
);
|
);
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
window.setOverlayIcon(nimage, "Teams");
|
window.setOverlayIcon(nimage, "Teams");
|
||||||
@@ -273,11 +267,11 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
) {
|
) {
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
app.dock.setIcon(
|
app.dock.setIcon(
|
||||||
path.join(__dirname, "../assets/icons/apps/onenote-mac.png")
|
join(__dirname, "../assets/icons/apps/onenote-mac.png")
|
||||||
);
|
);
|
||||||
} else if (process.platform === "win32") {
|
} else if (process.platform === "win32") {
|
||||||
let nimage = nativeImage.createFromPath(
|
let nimage = nativeImage.createFromPath(
|
||||||
path.join(__dirname, "../assets/icons/apps/onenote.png")
|
join(__dirname, "../assets/icons/apps/onenote.png")
|
||||||
);
|
);
|
||||||
BrowserWindow.getAllWindows().forEach((window) => {
|
BrowserWindow.getAllWindows().forEach((window) => {
|
||||||
window.setOverlayIcon(nimage, "OneNote");
|
window.setOverlayIcon(nimage, "OneNote");
|
||||||
@@ -294,6 +288,27 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
contents.insertCSS(
|
||||||
|
`
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
328
app/menu.js
328
app/menu.js
@@ -1,20 +1,21 @@
|
|||||||
const useragents = require("./useragents.json");
|
import { app, dialog, BrowserWindow, ShareMenu, clipboard } from "electron";
|
||||||
const {
|
import { getValue, setValue, getValueOrDefault } from './store.js';
|
||||||
app,
|
import { ElectronBlocker } from "@cliqz/adblocker-electron";
|
||||||
dialog,
|
import { clearActivity, setActivity } from './rpc.js';
|
||||||
BrowserWindow,
|
import { fileURLToPath } from 'url';
|
||||||
ShareMenu,
|
import { shell } from "electron";
|
||||||
clipboard,
|
import { dirname } from 'path';
|
||||||
} = require("electron");
|
|
||||||
const axios = require("axios");
|
import useragents from "./useragents.json" with { type: "json" }
|
||||||
const { clearActivity, setActivity } = require("./rpc");
|
import updaterpkg from "electron-updater";
|
||||||
const { shell } = require("electron");
|
import fetch from "cross-fetch";
|
||||||
const { autoUpdater } = require("electron-updater");
|
import axios from "axios";
|
||||||
const { ElectronBlocker } = require("@cliqz/adblocker-electron");
|
import path from "path";
|
||||||
const fetch = require("cross-fetch");
|
|
||||||
const openAboutWindow = require("about-window").default;
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const path = require("path");
|
const __dirname = dirname(__filename);
|
||||||
const { getValue, setValue, getValueOrDefault } = require("./store");
|
const { autoUpdater } = updaterpkg;
|
||||||
|
|
||||||
|
|
||||||
async function checkForUpdates() {
|
async function checkForUpdates() {
|
||||||
try {
|
try {
|
||||||
@@ -65,12 +66,10 @@ async function checkForUpdates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function openExternalLink(url) {
|
async function openExternalLink(url) {
|
||||||
const { shell } = require("electron");
|
|
||||||
await shell.openExternal(url);
|
await shell.openExternal(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openLogsFolder() {
|
async function openLogsFolder() {
|
||||||
const { shell } = require("electron");
|
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
await shell.openPath(
|
await shell.openPath(
|
||||||
"C:\\Users\\" +
|
"C:\\Users\\" +
|
||||||
@@ -102,7 +101,7 @@ function setUserAgent(useragent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getValueOrDefault("enterprise-or-normal", "https://microsoft365.com/?auth=1");
|
getValueOrDefault("enterprise-or-normal", "?auth=1");
|
||||||
getValueOrDefault("websites-in-new-window", "true");
|
getValueOrDefault("websites-in-new-window", "true");
|
||||||
getValueOrDefault("autohide-menubar", "false");
|
getValueOrDefault("autohide-menubar", "false");
|
||||||
getValueOrDefault("useragentstring", useragents.Windows);
|
getValueOrDefault("useragentstring", useragents.Windows);
|
||||||
@@ -110,6 +109,16 @@ getValueOrDefault("discordrpcstatus", "false");
|
|||||||
getValueOrDefault("blockadsandtrackers", "false");
|
getValueOrDefault("blockadsandtrackers", "false");
|
||||||
getValueOrDefault("dynamicicons", "true");
|
getValueOrDefault("dynamicicons", "true");
|
||||||
getValueOrDefault("autoupdater", "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 menulayout = [
|
const menulayout = [
|
||||||
...(process.platform === "darwin"
|
...(process.platform === "darwin"
|
||||||
@@ -119,19 +128,10 @@ const menulayout = [
|
|||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: "About MS-365-Electron",
|
label: "About MS-365-Electron",
|
||||||
click: () => {
|
click: async () => {
|
||||||
openAboutWindow({
|
await openExternalLink(
|
||||||
icon_path: path.join(__dirname, "../assets/about.png"),
|
"https://github.com/agam778/MS-365-Electron"
|
||||||
product_name: "MS-365-Electron",
|
);
|
||||||
copyright:
|
|
||||||
"Copyright (c) 2021-2023 Agampreet Singh\nMicrosoft 365, 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",
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -142,14 +142,6 @@ const menulayout = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
|
||||||
label: "Learn More",
|
|
||||||
click: async () => {
|
|
||||||
await openExternalLink(
|
|
||||||
"https://github.com/agam778/MS-365-Electron"
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Open Logs Folder",
|
label: "Open Logs Folder",
|
||||||
click: async () => {
|
click: async () => {
|
||||||
@@ -166,7 +158,7 @@ const menulayout = [
|
|||||||
click() {
|
click() {
|
||||||
setValue(
|
setValue(
|
||||||
"enterprise-or-normal",
|
"enterprise-or-normal",
|
||||||
"https://microsoft365.com/?auth=1"
|
"?auth=1"
|
||||||
);
|
);
|
||||||
dialog.showMessageBoxSync({
|
dialog.showMessageBoxSync({
|
||||||
type: "info",
|
type: "info",
|
||||||
@@ -178,7 +170,7 @@ const menulayout = [
|
|||||||
},
|
},
|
||||||
checked:
|
checked:
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=1",
|
"?auth=1",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Open MS 365 with Work/School Account",
|
label: "Open MS 365 with Work/School Account",
|
||||||
@@ -186,7 +178,7 @@ const menulayout = [
|
|||||||
click() {
|
click() {
|
||||||
setValue(
|
setValue(
|
||||||
"enterprise-or-normal",
|
"enterprise-or-normal",
|
||||||
"https://microsoft365.com/?auth=2"
|
"?auth=2"
|
||||||
);
|
);
|
||||||
dialog.showMessageBoxSync({
|
dialog.showMessageBoxSync({
|
||||||
type: "info",
|
type: "info",
|
||||||
@@ -198,7 +190,7 @@ const menulayout = [
|
|||||||
},
|
},
|
||||||
checked:
|
checked:
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=2",
|
"?auth=2",
|
||||||
},
|
},
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
@@ -232,6 +224,72 @@ const menulayout = [
|
|||||||
checked: getValue("websites-in-new-window") === "false",
|
checked: getValue("websites-in-new-window") === "false",
|
||||||
},
|
},
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
|
{
|
||||||
|
label: "Custom Home Page",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "Home (Default)",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setValue("custompage", "home");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Custom Home Page",
|
||||||
|
message:
|
||||||
|
"You have set the home page to the default home page. Please restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: getValue("custompage") === "home",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Create",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setValue("custompage", "create");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Custom Home Page",
|
||||||
|
message:
|
||||||
|
"You have set the home page to the \"Create\" page. Please restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: getValue("custompage") === "create",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "My Content",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setValue("custompage", "mycontent");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Custom Home Page",
|
||||||
|
message:
|
||||||
|
"You have set the home page to the \"My Content\" page. Please restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: getValue("custompage") === "mycontent",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Apps",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setValue("custompage", "apps");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Custom Home Page",
|
||||||
|
message:
|
||||||
|
"You have set the home page to the \"Apps\" page. Please restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: getValue("custompage") === "apps",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
label: "Enable Discord RPC",
|
label: "Enable Discord RPC",
|
||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
@@ -336,13 +394,15 @@ const menulayout = [
|
|||||||
message: "Ads and trackers will no longer be blocked.",
|
message: "Ads and trackers will no longer be blocked.",
|
||||||
buttons: ["OK"],
|
buttons: ["OK"],
|
||||||
});
|
});
|
||||||
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then(
|
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
|
||||||
(blocker) => {
|
BrowserWindow.getAllWindows().forEach(window => {
|
||||||
blocker.disableBlockingInSession(
|
blocker.disableBlockingInSession(window.webContents.session);
|
||||||
BrowserWindow.getFocusedWindow().webContents.session
|
});
|
||||||
);
|
}).catch((error) => {
|
||||||
|
if (error.message !== "Trying to disable blocking which was not enabled") {
|
||||||
|
console.error(error);
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -350,11 +410,10 @@ const menulayout = [
|
|||||||
getValue("blockadsandtrackers") === undefined
|
getValue("blockadsandtrackers") === undefined
|
||||||
) {
|
) {
|
||||||
setValue("blockadsandtrackers", "true");
|
setValue("blockadsandtrackers", "true");
|
||||||
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then(
|
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
|
||||||
(blocker) => {
|
BrowserWindow.getAllWindows().forEach(window => {
|
||||||
blocker.enableBlockingInSession(
|
blocker.enableBlockingInSession(window.webContents.session);
|
||||||
BrowserWindow.getFocusedWindow().webContents.session
|
})
|
||||||
);
|
|
||||||
dialog.showMessageBoxSync({
|
dialog.showMessageBoxSync({
|
||||||
type: "info",
|
type: "info",
|
||||||
title: "Block Ads and Trackers",
|
title: "Block Ads and Trackers",
|
||||||
@@ -429,19 +488,10 @@ const menulayout = [
|
|||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: "About MS-365-Electron",
|
label: "About MS-365-Electron",
|
||||||
click: () => {
|
click: async () => {
|
||||||
openAboutWindow({
|
await openExternalLink(
|
||||||
icon_path: path.join(__dirname, "../assets/about.png"),
|
"https://github.com/agam778/MS-365-Electron"
|
||||||
product_name: "MS-365-Electron",
|
);
|
||||||
copyright:
|
|
||||||
"Copyright (c) 2021-2023 Agampreet Singh\nMicrosoft 365, 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",
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -451,14 +501,6 @@ const menulayout = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
|
||||||
label: "Learn More",
|
|
||||||
click: async () => {
|
|
||||||
await openExternalLink(
|
|
||||||
"https://github.com/agam778/MS-365-Electron"
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Open Logs Folder",
|
label: "Open Logs Folder",
|
||||||
click: async () => {
|
click: async () => {
|
||||||
@@ -472,7 +514,7 @@ const menulayout = [
|
|||||||
click() {
|
click() {
|
||||||
setValue(
|
setValue(
|
||||||
"enterprise-or-normal",
|
"enterprise-or-normal",
|
||||||
"https://microsoft365.com/?auth=1"
|
"?auth=1"
|
||||||
);
|
);
|
||||||
dialog.showMessageBoxSync({
|
dialog.showMessageBoxSync({
|
||||||
type: "info",
|
type: "info",
|
||||||
@@ -484,7 +526,7 @@ const menulayout = [
|
|||||||
},
|
},
|
||||||
checked:
|
checked:
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=1",
|
"?auth=1",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Open MS 365 with Work/School Account",
|
label: "Open MS 365 with Work/School Account",
|
||||||
@@ -492,7 +534,7 @@ const menulayout = [
|
|||||||
click() {
|
click() {
|
||||||
setValue(
|
setValue(
|
||||||
"enterprise-or-normal",
|
"enterprise-or-normal",
|
||||||
"https://microsoft365.com/?auth=2"
|
"?auth=2"
|
||||||
);
|
);
|
||||||
dialog.showMessageBoxSync({
|
dialog.showMessageBoxSync({
|
||||||
type: "info",
|
type: "info",
|
||||||
@@ -504,7 +546,7 @@ const menulayout = [
|
|||||||
},
|
},
|
||||||
checked:
|
checked:
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=2",
|
"?auth=2",
|
||||||
},
|
},
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
@@ -538,6 +580,72 @@ const menulayout = [
|
|||||||
checked: getValue("websites-in-new-window") === "false",
|
checked: getValue("websites-in-new-window") === "false",
|
||||||
},
|
},
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
|
{
|
||||||
|
label: "Custom Home Page",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "Home (Default)",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setValue("custompage", "home");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Custom Home Page",
|
||||||
|
message:
|
||||||
|
"You have set the home page to the default home page. Please restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: getValue("custompage") === "home",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Create",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setValue("custompage", "create");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Custom Home Page",
|
||||||
|
message:
|
||||||
|
"You have set the home page to the \"Create\" page. Please restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: getValue("custompage") === "create",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "My Content",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setValue("custompage", "mycontent");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Custom Home Page",
|
||||||
|
message:
|
||||||
|
"You have set the home page to the \"My Content\" page. Please restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: getValue("custompage") === "mycontent",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Apps",
|
||||||
|
type: "radio",
|
||||||
|
click: () => {
|
||||||
|
setValue("custompage", "apps");
|
||||||
|
dialog.showMessageBoxSync({
|
||||||
|
type: "info",
|
||||||
|
title: "Custom Home Page",
|
||||||
|
message:
|
||||||
|
"You have set the home page to the \"Apps\" page. Please restart the app to apply the changes.",
|
||||||
|
buttons: ["OK"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checked: getValue("custompage") === "apps",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
label: "Enable Discord RPC",
|
label: "Enable Discord RPC",
|
||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
@@ -642,13 +750,15 @@ const menulayout = [
|
|||||||
message: "Ads and trackers will no longer be blocked.",
|
message: "Ads and trackers will no longer be blocked.",
|
||||||
buttons: ["OK"],
|
buttons: ["OK"],
|
||||||
});
|
});
|
||||||
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then(
|
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
|
||||||
(blocker) => {
|
BrowserWindow.getAllWindows().forEach(window => {
|
||||||
blocker.disableBlockingInSession(
|
blocker.disableBlockingInSession(window.webContents.session);
|
||||||
BrowserWindow.getFocusedWindow().webContents.session
|
});
|
||||||
);
|
}).catch((error) => {
|
||||||
|
if (error.message !== "Trying to disable blocking which was not enabled") {
|
||||||
|
console.error(error);
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -656,11 +766,10 @@ const menulayout = [
|
|||||||
getValue("blockadsandtrackers") === undefined
|
getValue("blockadsandtrackers") === undefined
|
||||||
) {
|
) {
|
||||||
setValue("blockadsandtrackers", "true");
|
setValue("blockadsandtrackers", "true");
|
||||||
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then(
|
ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
|
||||||
(blocker) => {
|
BrowserWindow.getAllWindows().forEach(window => {
|
||||||
blocker.enableBlockingInSession(
|
blocker.enableBlockingInSession(window.webContents.session);
|
||||||
BrowserWindow.getFocusedWindow().webContents.session
|
})
|
||||||
);
|
|
||||||
dialog.showMessageBoxSync({
|
dialog.showMessageBoxSync({
|
||||||
type: "info",
|
type: "info",
|
||||||
title: "Block Ads and Trackers",
|
title: "Block Ads and Trackers",
|
||||||
@@ -735,7 +844,7 @@ const menulayout = [
|
|||||||
partition: "persist:personal",
|
partition: "persist:personal",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
newWindow.loadURL("https://microsoft365.com/?auth=1");
|
newWindow.loadURL(`https://microsoft365.com/${getValue("custompage")}/?auth=1`);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -751,7 +860,7 @@ const menulayout = [
|
|||||||
partition: "persist:work",
|
partition: "persist:work",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
newWindow.loadURL("https://microsoft365.com/?auth=2");
|
newWindow.loadURL(`https://microsoft365.com/${getValue("custompage")}/?auth=2`);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
@@ -881,7 +990,7 @@ const menulayout = [
|
|||||||
click: () => {
|
click: () => {
|
||||||
if (
|
if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=2"
|
"?auth=2"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let wordwindow = new BrowserWindow({
|
let wordwindow = new BrowserWindow({
|
||||||
@@ -901,7 +1010,7 @@ const menulayout = [
|
|||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=1"
|
"?auth=1"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let wordwindow = new BrowserWindow({
|
let wordwindow = new BrowserWindow({
|
||||||
@@ -927,7 +1036,7 @@ const menulayout = [
|
|||||||
click: () => {
|
click: () => {
|
||||||
if (
|
if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=2"
|
"?auth=2"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let excelwindow = new BrowserWindow({
|
let excelwindow = new BrowserWindow({
|
||||||
@@ -949,7 +1058,7 @@ const menulayout = [
|
|||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=1"
|
"?auth=1"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let excelwindow = new BrowserWindow({
|
let excelwindow = new BrowserWindow({
|
||||||
@@ -977,7 +1086,7 @@ const menulayout = [
|
|||||||
click: () => {
|
click: () => {
|
||||||
if (
|
if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=2"
|
"?auth=2"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let powerpointwindow = new BrowserWindow({
|
let powerpointwindow = new BrowserWindow({
|
||||||
@@ -999,7 +1108,7 @@ const menulayout = [
|
|||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=1"
|
"?auth=1"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let powerpointwindow = new BrowserWindow({
|
let powerpointwindow = new BrowserWindow({
|
||||||
@@ -1027,7 +1136,7 @@ const menulayout = [
|
|||||||
click: () => {
|
click: () => {
|
||||||
if (
|
if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=2"
|
"?auth=2"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let outlookwindow = new BrowserWindow({
|
let outlookwindow = new BrowserWindow({
|
||||||
@@ -1047,7 +1156,7 @@ const menulayout = [
|
|||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=1"
|
"?auth=1"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let outlookwindow = new BrowserWindow({
|
let outlookwindow = new BrowserWindow({
|
||||||
@@ -1075,7 +1184,7 @@ const menulayout = [
|
|||||||
click: () => {
|
click: () => {
|
||||||
if (
|
if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=2"
|
"?auth=2"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let onedrivewindow = new BrowserWindow({
|
let onedrivewindow = new BrowserWindow({
|
||||||
@@ -1097,7 +1206,7 @@ const menulayout = [
|
|||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=1"
|
"?auth=1"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let onedrivewindow = new BrowserWindow({
|
let onedrivewindow = new BrowserWindow({
|
||||||
@@ -1125,7 +1234,7 @@ const menulayout = [
|
|||||||
click: () => {
|
click: () => {
|
||||||
if (
|
if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=2"
|
"?auth=2"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let onenotewindow = new BrowserWindow({
|
let onenotewindow = new BrowserWindow({
|
||||||
@@ -1147,7 +1256,7 @@ const menulayout = [
|
|||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=1"
|
"?auth=1"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let onenotewindow = new BrowserWindow({
|
let onenotewindow = new BrowserWindow({
|
||||||
@@ -1173,7 +1282,7 @@ const menulayout = [
|
|||||||
click: () => {
|
click: () => {
|
||||||
if (
|
if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=2"
|
"?auth=2"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let allappswindow = new BrowserWindow({
|
let allappswindow = new BrowserWindow({
|
||||||
@@ -1193,7 +1302,7 @@ const menulayout = [
|
|||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
getValue("enterprise-or-normal") ===
|
getValue("enterprise-or-normal") ===
|
||||||
"https://microsoft365.com/?auth=1"
|
"?auth=1"
|
||||||
) {
|
) {
|
||||||
if (getValue("websites-in-new-window") === "true") {
|
if (getValue("websites-in-new-window") === "true") {
|
||||||
let allappswindow = new BrowserWindow({
|
let allappswindow = new BrowserWindow({
|
||||||
@@ -1262,4 +1371,5 @@ const menulayout = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
module.exports = { menulayout };
|
|
||||||
|
export default menulayout;
|
||||||
|
|||||||
20
app/rpc.js
20
app/rpc.js
@@ -1,12 +1,12 @@
|
|||||||
const { Client } = require("@xhayper/discord-rpc");
|
import { dialog, BrowserWindow } from "electron";
|
||||||
const { dialog, BrowserWindow } = require("electron");
|
import { Client } from "@xhayper/discord-rpc";
|
||||||
const { setValue } = require("./store");
|
import { setValue } from "./store.js";
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
clientId: "942637872530460742",
|
clientId: "942637872530460742",
|
||||||
});
|
});
|
||||||
|
|
||||||
async function rpcError(status) {
|
export async function rpcError(status) {
|
||||||
const rpcerror = dialog.showMessageBoxSync(BrowserWindow.getFocusedWindow(), {
|
const rpcerror = dialog.showMessageBoxSync(BrowserWindow.getFocusedWindow(), {
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Discord RPC Error",
|
title: "Discord RPC Error",
|
||||||
@@ -19,14 +19,14 @@ async function rpcError(status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clearActivity() {
|
export async function clearActivity() {
|
||||||
await client.user?.clearActivity().catch((err) => {
|
await client.user?.clearActivity().catch((err) => {
|
||||||
rpcError("clearing");
|
rpcError("clearing");
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setActivity(details) {
|
export async function setActivity(details) {
|
||||||
if (!client.user) {
|
if (!client.user) {
|
||||||
await loginToRPC();
|
await loginToRPC();
|
||||||
}
|
}
|
||||||
@@ -43,15 +43,9 @@ async function setActivity(details) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loginToRPC() {
|
export async function loginToRPC() {
|
||||||
await client.login().catch((err) => {
|
await client.login().catch((err) => {
|
||||||
rpcError("logging into");
|
rpcError("logging into");
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
clearActivity,
|
|
||||||
setActivity,
|
|
||||||
loginToRPC,
|
|
||||||
};
|
|
||||||
|
|||||||
10
app/store.js
10
app/store.js
@@ -1,15 +1,15 @@
|
|||||||
const Store = require("electron-store");
|
import Store from "electron-store";
|
||||||
const store = new Store();
|
const store = new Store();
|
||||||
|
|
||||||
function getValue(key) {
|
export function getValue(key) {
|
||||||
return store.get(key);
|
return store.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValue(key, value) {
|
export function setValue(key, value) {
|
||||||
store.set(key, value);
|
store.set(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getValueOrDefault(key, defaultValue) {
|
export function getValueOrDefault(key, defaultValue) {
|
||||||
const value = store.get(key);
|
const value = store.get(key);
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
store.set(key, defaultValue);
|
store.set(key, defaultValue);
|
||||||
@@ -17,5 +17,3 @@ function getValueOrDefault(key, defaultValue) {
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { getValue, setValue, getValueOrDefault };
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
"Windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
|
||||||
"macOS": "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
"macOS": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
|
||||||
"Linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
"Linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
|
||||||
}
|
}
|
||||||
|
|||||||
19
package.json
19
package.json
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "ms-365-electron",
|
"name": "ms-365-electron",
|
||||||
"version": "1.1.0",
|
"version": "2.0.0",
|
||||||
|
"type": "module",
|
||||||
"description": "Unofficial Microsoft 365 Web Desktop Wrapper made with Electron",
|
"description": "Unofficial Microsoft 365 Web Desktop Wrapper made with Electron",
|
||||||
"main": "app/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"
|
||||||
@@ -66,23 +67,23 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^28.0.0",
|
"electron": "^30.0.0",
|
||||||
"electron-builder": "^24.6.3",
|
"electron-builder": "^24.6.3",
|
||||||
"eslint": "^8.45.0"
|
"eslint": "^9.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@aptabase/electron": "^0.3.1",
|
||||||
"@cliqz/adblocker-electron": "^1.26.6",
|
"@cliqz/adblocker-electron": "^1.26.6",
|
||||||
"@xhayper/discord-rpc": "^1.0.21",
|
"@xhayper/discord-rpc": "^1.0.21",
|
||||||
"about-window": "^1.15.2",
|
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"check-internet-connected": "^2.0.6",
|
"check-internet-connected": "^2.0.6",
|
||||||
"cross-fetch": "^4.0.0",
|
"cross-fetch": "^4.0.0",
|
||||||
"electron-context-menu": "^3.6.1",
|
"electron-context-menu": "^4.0.0",
|
||||||
"electron-dl": "^3.5.0",
|
"electron-dl": "^4.0.0",
|
||||||
"electron-log": "^5.0.0-beta.25",
|
"electron-log": "^5.0.0-beta.25",
|
||||||
"electron-store": "^8.1.0",
|
"electron-store": "^9.0.0",
|
||||||
"electron-updater": "^6.1.4",
|
"electron-updater": "^6.1.4",
|
||||||
"node-gyp": "^10.0.0"
|
"node-gyp": "^10.0.0"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.0.2"
|
"packageManager": "yarn@4.2.1"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user