From 54f655c2045a662dfea1c6287e6be5fe8ed50520 Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Thu, 15 Jun 2023 15:38:26 -0400 Subject: [PATCH 1/2] Update version and changelog --- package.json | 2 +- renderer/src/data/changelog.js | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index acb3e747..ff9434e5 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/renderer/src/data/changelog.js b/renderer/src/data/changelog.js index 9838fe59..e0511210 100644 --- a/renderer/src/data/changelog.js +++ b/renderer/src/data/changelog.js @@ -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)" ] } ] From b62deff1407c52bda5415a2d464de9566a78e4f4 Mon Sep 17 00:00:00 2001 From: axolotl <87679354+TheCommieAxolotl@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:23:14 +1000 Subject: [PATCH 2/2] Add custom `--os-accent-color` css value (#1663) * Add custom -bd-accent-color css value * Use global variable for accent color * Fallback to "" * Run accent color ipc call in parallel * Typo --- common/constants/ipcevents.js | 3 ++- injector/src/modules/ipc.js | 8 +++++++- renderer/src/modules/core.js | 3 +++ renderer/src/modules/ipc.js | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/common/constants/ipcevents.js b/common/constants/ipcevents.js index d97bf90a..6aa2997b 100644 --- a/common/constants/ipcevents.js +++ b/common/constants/ipcevents.js @@ -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"; \ No newline at end of file diff --git a/injector/src/modules/ipc.js b/injector/src/modules/ipc.js index 7ba9bb6e..0de96f9a 100644 --- a/injector/src/modules/ipc.js +++ b/injector/src/modules/ipc.js @@ -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); diff --git a/renderer/src/modules/core.js b/renderer/src/modules/core.js index 2125c72f..02b02925 100644 --- a/renderer/src/modules/core.js +++ b/renderer/src/modules/core.js @@ -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()); diff --git a/renderer/src/modules/ipc.js b/renderer/src/modules/ipc.js index df89c3db..bb937b05 100644 --- a/renderer/src/modules/ipc.js +++ b/renderer/src/modules/ipc.js @@ -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); + } }; \ No newline at end of file