Merge branch 'main' into development

This commit is contained in:
Zack Rauen 2023-09-22 16:30:27 -04:00
commit 17f39f0fa4
6 changed files with 31 additions and 12 deletions

View File

@ -12,7 +12,8 @@ export const TOGGLE_DEVTOOLS = "bd-toggle-devtools";
export const OPEN_WINDOW = "bd-open-window";
export const INSPECT_ELEMENT = "bd-inspect-element";
export const MINIMUM_SIZE = "bd-minimum-size";
export const WINDOW_SIZE = "bd-window-size";
export const WINDOW_SIZE = "bd-window-size";
export const DEVTOOLS_WARNING = "bd-remove-devtools-message";
export const OPEN_DIALOG = "bd-open-dialog";
export const REGISTER_PRELOAD = "bd-register-preload";
export const GET_ACCENT_COLOR = "bd-get-accent-color";

View File

@ -1,4 +1,4 @@
import {ipcMain as ipc, BrowserWindow, app, dialog} from "electron";
import {ipcMain as ipc, BrowserWindow, app, dialog, systemPreferences} from "electron";
import * as IPCEvents from "common/constants/ipcevents";
@ -84,6 +84,11 @@ const setWindowSize = (event, width, height) => {
window.setSize(width, height);
};
const getAccentColor = () => {
// intentionally left blank so that fallback colors will be used
return systemPreferences.getAccentColor() || "";
};
const stopDevtoolsWarning = event => event.sender.removeAllListeners("devtools-opened");
const openDialog = (event, options = {}) => {
@ -144,6 +149,7 @@ export default class IPCMain {
ipc.on(IPCEvents.WINDOW_SIZE, setWindowSize);
ipc.on(IPCEvents.DEVTOOLS_WARNING, stopDevtoolsWarning);
ipc.on(IPCEvents.REGISTER_PRELOAD, registerPreload);
ipc.handle(IPCEvents.GET_ACCENT_COLOR, getAccentColor);
ipc.handle(IPCEvents.RUN_SCRIPT, runScript);
ipc.handle(IPCEvents.OPEN_DIALOG, openDialog);
ipc.handle(IPCEvents.OPEN_WINDOW, createBrowserWindow);

View File

@ -1,6 +1,6 @@
{
"name": "betterdiscord",
"version": "1.9.2",
"version": "1.9.3",
"description": "Enhances Discord by adding functionality and themes.",
"main": "src/index.js",
"scripts": {

View File

@ -1,19 +1,24 @@
// fixed, improved, added, progress
export default {
description: "Hotfix!",
description: "This update has a few important bugfixes but it also contains some important QOL updates for plugin developers!",
changes: [
// {
// title: "What's New?",
// type: "improved",
// items: [
// "Added SourceURL for the renderer. This makes it easier for developers to identify BD in call stacks.",
// ]
// },
{
title: "What's New?",
type: "improved",
items: [
"Updated translations for many languages! Thank you to our many contributors!",
"New shorthand API methods for developers available under `BdApi.Webpack`. Documentation should be updated soon!",
"Also a new `Filter` has been added for internal stores. This includes the `getStore` shorthand!"
]
},
{
title: "Bug Fixes",
type: "fixed",
items: [
"Fixed context menu crashes & api",
"Fixed header color in light mode. (Thanks @Fede)",
"Fixed window size retention for users of remove minimum size option. (Thanks @Neodymium)",
"Fixed a toast saying an addon was loaded when it was unloaded. (Thanks @benji78)",
"Fixed context menu patching API for plugins. (Thanks @Strencher)"
]
}
]

View File

@ -15,6 +15,7 @@ import Settings from "./settingsmanager";
import DataStore from "./datastore";
import DiscordModules from "./discordmodules";
import IPC from "./ipc";
import Editor from "./editor";
import Updater from "./updater";
@ -33,6 +34,8 @@ export default new class Core {
Config.userData = process.env.DISCORD_USER_DATA;
Config.dataPath = process.env.BETTERDISCORD_DATA_PATH;
IPC.getSystemAccentColor().then(value => DOMManager.injectStyle("bd-os-values", `:root {--os-accent-color: ${value};}`));
// Load css early
Logger.log("Startup", "Injecting BD Styles");
DOMManager.injectStyle("bd-stylesheet", Styles.toString());

View File

@ -56,4 +56,8 @@ export default new class IPCRenderer {
openDialog(options) {
return ipc.invoke(IPCEvents.OPEN_DIALOG, options);
}
getSystemAccentColor() {
return ipc.invoke(IPCEvents.GET_ACCENT_COLOR);
}
};