mirror of
https://github.com/agam778/MS-365-Electron.git
synced 2026-02-17 09:02:10 +00:00
Welcome back, Discord RPC
- Use new image for the RPC - Switch to an updated library
This commit is contained in:
36
app/menu.js
36
app/menu.js
@@ -2,6 +2,7 @@ const store = require("./store");
|
||||
const useragents = require("./useragents.json");
|
||||
const { app, dialog, BrowserWindow } = require("electron");
|
||||
const axios = require("axios");
|
||||
const { clearActivity, setActivity } = require("./rpc");
|
||||
|
||||
function getValueOrDefault(key, defaultValue) {
|
||||
const value = store.get(key);
|
||||
@@ -87,6 +88,7 @@ function setUserAgent(useragent) {
|
||||
getValueOrDefault("enterprise-or-normal", "https://microsoft365.com/?auth=1");
|
||||
getValueOrDefault("autohide-menubar", "false");
|
||||
getValueOrDefault("useragentstring", useragents.Windows);
|
||||
getValueOrDefault("discordrpcstatus", "false");
|
||||
|
||||
const menulayout = [
|
||||
{
|
||||
@@ -187,6 +189,40 @@ const menulayout = [
|
||||
: false,
|
||||
},
|
||||
{ type: "separator" },
|
||||
{
|
||||
label: "Enable Discord RPC",
|
||||
type: "checkbox",
|
||||
click: () => {
|
||||
if (store.get("discordrpcstatus") === "true") {
|
||||
store.set("discordrpcstatus", "false");
|
||||
dialog.showMessageBoxSync({
|
||||
type: "info",
|
||||
title: "Discord RPC",
|
||||
message: "Discord RPC has been disabled.",
|
||||
buttons: ["OK"],
|
||||
});
|
||||
clearActivity();
|
||||
return;
|
||||
} else if (
|
||||
store.get("discordrpcstatus") === "false" ||
|
||||
store.get("discordrpcstatus") === undefined
|
||||
) {
|
||||
store.set("discordrpcstatus", "true");
|
||||
dialog.showMessageBoxSync({
|
||||
type: "info",
|
||||
title: "Discord RPC",
|
||||
message: "Discord RPC has been enabled.",
|
||||
buttons: ["OK"],
|
||||
});
|
||||
setActivity(
|
||||
`On ${BrowserWindow.getFocusedWindow().webContents.getTitle()}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
},
|
||||
checked: store.get("discordrpcstatus") === "true",
|
||||
},
|
||||
{ type: "separator" },
|
||||
{
|
||||
label: "Windows User-Agent String",
|
||||
type: "radio",
|
||||
|
||||
Reference in New Issue
Block a user