Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Lev 2023-10-19 21:10:13 +02:00
commit 461e3c5125
9 changed files with 943 additions and 871 deletions

View File

@ -2,6 +2,38 @@
This changelog starts with the restructured 1.0.0 release that happened after context isolation changes. The changelogs here should more-or-less mirror the ones that get shown in the client but probably with less formatting and pizzazz.
## 1.9.4
### Added
- New css variable `--os-accent-color`
- Temporary `Buffer` polyfill
### Removed
### Changed
- `BdApi.Net.fetch` now has an optional `timeout` parameter
### Fixed
- Fixes not being able to use `http` for `BdApi.Net.fetch`.
- Bad URLs and other early errors in `BdApi.Net.fetch` now handled better.
## 1.9.3
### Added
- Multiple shorthand functions under `BdApi.Webpack`
- New `getStore` filter
### Removed
### Changed
- Updated translations
### Fixed
- Fixed header color in light mode.
- Fixed window size retention for users of remove minimum size option.
- Fixed a toast saying an addon was loaded when it was unloaded.
- Fixed context menu patching API for plugins.
## 1.9.2
### Added

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,10 @@
"postcss-easy-import": "^4.0.0",
"postcss-loader": "^6.2.1",
"stylelint": "^14.3.0",
"webpack": "^5.73.0",
"stylelint-config-standard": "^24.0.0"
"stylelint-config-standard": "^24.0.0",
"webpack": "^5.73.0"
},
"dependencies": {
"buffer": "^6.0.3"
}
}

View File

@ -6,19 +6,17 @@ export default {
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!"
"There's a new css variable themes can make use of called `--os-accent-color` which is the accent color used by the user's operating system. (Thanks @axolotl)",
"`BdApi.Net.fetch` now has an optional `timeout` parameter to help avoid long requests."
]
},
{
title: "Bug Fixes",
type: "fixed",
items: [
"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)"
"Adds a temporary `Buffer` polyfill and deprecates the usage of `Buffer`.",
"Fixes not being able to use `http` for `BdApi.Net.fetch`.",
"Bad URLs and other early errors in `BdApi.Net.fetch` now handled better."
]
}
]

View File

@ -40,7 +40,7 @@ export default new class Core {
const stepsMax = 14;
const increasePercent = () => stepsCounter++ / (stepsMax - 1) * 100;
IPC.getSystemAccentColor().then(value => DOMManager.injectStyle("bd-os-values", `:root {--os-accent-color: ${value};}`));
IPC.getSystemAccentColor().then(value => DOMManager.injectStyle("bd-os-values", `:root {--os-accent-color: #${value};}`));
// Load css early
Logger.log("Startup", "Injecting BD Styles");

View File

@ -1,17 +1,13 @@
import WebpackModules from "@modules/webpackmodules";
import Logger from "@common/logger";
Object.defineProperty(window, "Buffer", {
get() {return Buffer.getBuffer().Buffer;},
get() {
Logger.warn("Deprecated", `Usage of the Buffer global is deprecated. Consider using web standards such as Uint8Array and TextDecoder/TextEncoder.`);
return Buffer;
},
configurable: true,
enumerable: false
});
export default class Buffer {
static getBuffer() {
if (this.cached) return this.cached;
this.cached = WebpackModules.getByProps("INSPECT_MAX_BYTES");
return this.cached;
}
}
export default Buffer;

View File

@ -5,7 +5,7 @@ import vm from "./vm";
import fs from "./fs";
import request from "./request";
import https from "./https";
import Buffer from "./buffer";
import buffer from "./buffer";
import crypto from "./crypto";
import Remote from "./remote";
import Logger from "common/logger";
@ -37,7 +37,7 @@ export const createRequire = function (path) {
case "process": return window.process;
case "vm": return vm;
case "module": return Module;
case "buffer": return Buffer.getBuffer();
case "buffer": return buffer;
case "crypto": return crypto;
default:

View File

@ -6,7 +6,7 @@ const basePkg = require("../package.json");
module.exports = {
mode: "development",
target: "node",
target: "electron-renderer",
devtool: false,
entry: "./src/index.js",
output: {
@ -31,7 +31,10 @@ module.exports = {
data$: path.resolve("src", "modules"),
builtins$: path.resolve("src", "modules"),
common: path.resolve(__dirname, "..", "common")
}
},
fallback: {
buffer: require.resolve("buffer/"),
},
},
module: {
rules: [
@ -53,7 +56,10 @@ module.exports = {
}),
new webpack.DefinePlugin({
"process.env.__VERSION__": JSON.stringify(basePkg.version)
})
}),
new webpack.ProvidePlugin({
Buffer: [require.resolve("buffer/"), "Buffer"],
}),
],
optimization: {
minimizer: [