Fix rewrite, add todo and instructions
This commit is contained in:
parent
32dc1b5778
commit
341e685bc2
136
README.md
136
README.md
|
@ -6,133 +6,15 @@
|
|||
[paypal-badge]: https://img.shields.io/badge/Paypal-Donate!-%2300457C.svg?logo=paypal&style=flat-square
|
||||
[paypal-link]: https://paypal.me/ZackRauen
|
||||
|
||||
BandagedBD (Bandaged BetterDiscord) is a fork of the original [BetterDiscord](https://github.com/Jiiks/BetterDiscordApp) by Jiiks. This has a number of improvements over the original which is currently undergoing a full rewrite. In the interim, the current version has been unmaintained hence this fork existing. I will continue to maintain this fork until BDv2 comes out. I am helping to develop BDv2 as well so as release gets closer this fork will become less and less active.
|
||||
This branch is for the ongoing rewrite of BandagedBD. You can view what I believe to be left in the TODO.md file.
|
||||
|
||||
# Installation
|
||||
# Testing
|
||||
|
||||
### Windows
|
||||
Grab the `exe` file from the latest release on the [releases page](https://github.com/rauenzi/BetterDiscordApp/releases).
|
||||
The following steps tell you how you can currently test the state of the rewrite as of September 26th 2019.
|
||||
|
||||
### macOS/OS X
|
||||
Grab the `zip` file from the latest release on the [releases page](https://github.com/rauenzi/BetterDiscordApp/releases).
|
||||
|
||||
### Linux
|
||||
See this link: https://gist.github.com/ObserverOfTime/d7e60eb9aa7fe837545c8cb77cf31172
|
||||
|
||||
# FAQ
|
||||
|
||||
### What is this?
|
||||
|
||||
This is a client modification for Discord. You can read more about it in the [original repo](https://github.com/Jiiks/BetterDiscordApp).
|
||||
|
||||
### Where can I get plugins and themes?
|
||||
|
||||
In our suport servers we have channels with lists of official plugins and themes. Please note we do not have an official listing on a website and are **not affiliated with any of those websites**.
|
||||
|
||||
### Support Servers?
|
||||
|
||||
Yup we have two of them [this one](https://discord.gg/0Tmfo5ZbORCRqbAd) and [this one](https://discord.gg/2HScm8j)
|
||||
|
||||
<!-- # What's Different
|
||||
|
||||
## New Settings
|
||||
![Settings](https://i.zackrauen.com/nkb9Qi.png)
|
||||
|
||||
## UI
|
||||
- Redesigned plugin and theme cards with additional classes for themes to use
|
||||
- Additional tab in settings with additional settings.
|
||||
- CustomCSS editor from CodeMirror has been removed due to being bloated and having high cpu usage. Replaced with another lightweight editor
|
||||
|
||||
|
||||
## Plugins/Themes Related
|
||||
- Prevent broken plugins from halting BD from loading
|
||||
- Speed up the loading process
|
||||
- Show startup errors in a modal
|
||||
|
||||
![Startup](https://i.zackrauen.com/PwlQcp.gif)
|
||||
|
||||
- Add `try...catch` blocks to help prevent errors from crashing BD and Discord
|
||||
- Fix internal functions that some functions rely on such as `onSwitch` and `onMessage`
|
||||
- Add `source` and `website` as options for plugin and theme METAs
|
||||
- Allow themes to use spaces and apostrophes in their names
|
||||
- Prettier errors in console, useful for debugging
|
||||
- Auto-reload of themes/plugins
|
||||
- Stabalize and enhance the `BdApi`
|
||||
|
||||
## Emote Module
|
||||
- Emotes load asynchronously in the background (does not prevent the mod from loading anymore)
|
||||
- Several bug fixes including tooltips, modifiers and emote menu
|
||||
- Consolidate emotes to a single file
|
||||
- Revamp how emotes are injected—speedup
|
||||
- Use react and injection techniques
|
||||
|
||||
## Misc
|
||||
- Fix Minimal Mode
|
||||
- Fix React errors when opening settings
|
||||
- Fix selected class disappearing when clicking an open tab
|
||||
- Create new alert modal for `BdApi`
|
||||
- Add toasts as notification option and in `BdApi`
|
||||
- Remove most jQuery dependency for speedup
|
||||
- Attach to settings when entering from right click
|
||||
- Patch PublicServers
|
||||
|
||||
## And so much more... -->
|
||||
|
||||
|
||||
# Supporters
|
||||
|
||||
These people have all subscribed to the `True Supporter` tier on Patreon to support BandagedBD.
|
||||
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="https://cdn.discordapp.com/avatars/196098063092154368/78a810438015b20ea8d530fafc7fe463.png?size=128" width="100px;" alt="Kraken"/><br />
|
||||
<strong>Kraken</strong><br />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
# Bandagers
|
||||
|
||||
These people have all subscribed to the `Bandager` tier on Patreon to support BandagedBD.
|
||||
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="https://cdn.discordapp.com/avatars/332199319169925120/4709f8f0c9cb7ababd85459bf71848b9.png?size=128" width="50px;" alt="Kraken"/><br />
|
||||
<a href="https://github.com/williamjcm" target="_blank" rel="noreferrer noopener"><strong>William JCM</strong></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# Donors
|
||||
|
||||
These people have either donated or subscribed to the most basic patron tier to support BandagedBD.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="https://cdn.discordapp.com/avatars/284122164582416385/4f12bf80cac47656ad7fc6a82fbd5f3b.png?size=128" width="25px;" /><br />
|
||||
<strong>aetheryx</strong>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="https://cdn.discordapp.com/avatars/216782345779281921/d4b651b606f108cd2f96a19af68f942f.png?size=128" width="25px;" /><br />
|
||||
<strong>JBeauDee</strong>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="https://cdn.discordapp.com/avatars/261673576216789004/31d590fb92329e270a6225a13d500c1d.png?size=128" width="25px;" /><br />
|
||||
<strong>vantiss</strong>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="https://cdn.discordapp.com/avatars/122204411962327043/bd773f79607316e6be10e12682a6c10f.png?size=128" width="25px;" /><br />
|
||||
<strong>xstefen</strong>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="https://cdn.discordapp.com/avatars/219400174869413888/a_58438b5a8e939e997902dc1e4b81e09e.png?size=128" width="25px;" /><br />
|
||||
<strong>『Sorey』</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
1. locate your BD installation. For Windows it is usually in `%localappdata%\Discord\app-0.0.305\resources\app\betterdiscord`.
|
||||
2. Open config.json in a text editor (n++, notepad, etc).
|
||||
3. Change the line `"branch": "master",` to `"branch": "development",`.
|
||||
4. (optional) Change `"minified": false,` to `"minified": true,` to stay on the bleeding edge (sometimes I forget to update the minified version).
|
||||
5. Fully restart your Discord client.
|
||||
6. You can verify it worked by seeing the revamped plugins and themes pages as well as custom css. You can also see if the version in settings is 1.0.0+
|
|
@ -0,0 +1,37 @@
|
|||
# To-Do List
|
||||
|
||||
This list only reflects the items that have needed to be done since June 2019, there was a lot of progress/change before this point.
|
||||
|
||||
Note: The items listed here are not in any sort of priority order.
|
||||
|
||||
### In Progress
|
||||
- Redo emotemenu
|
||||
- Remove all jquery usage
|
||||
|
||||
### To Dummy/Crash Proof
|
||||
- PublicServers react
|
||||
- Floating window
|
||||
|
||||
### To Complete
|
||||
- Move old utilities to BdApi
|
||||
- Component patcher (also does additional classes, etc)
|
||||
- Plugin Class
|
||||
- New Plugin API
|
||||
- Require patch
|
||||
- Backwards compatibility module (with deprecation notices)
|
||||
- Modify old monkeyPatch to really use Patcher
|
||||
- Repo browser
|
||||
- Addon update system
|
||||
- PublicServer button patch
|
||||
- Redo devmode
|
||||
- Rewrite emote auto caps
|
||||
|
||||
### Potential Ideas
|
||||
- Rearchitect to not use remote files
|
||||
- Modify CSP rather than entirely remove
|
||||
|
||||
### Done
|
||||
- PublicServers React Rewrite
|
||||
- Rewrite plugin/theme cards
|
||||
- Addon list controls
|
||||
- Use an actual patcher and not monkeyPatch
|
10
js/main.js
10
js/main.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4278,9 +4278,9 @@
|
|||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.11",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
|
||||
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==",
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
||||
"dev": true
|
||||
},
|
||||
"loose-envify": {
|
||||
|
@ -4506,9 +4506,9 @@
|
|||
}
|
||||
},
|
||||
"mixin-deep": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz",
|
||||
"integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==",
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
|
||||
"integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"for-in": "^1.0.2",
|
||||
|
@ -5581,9 +5581,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"set-value": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz",
|
||||
"integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
|
||||
"integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"extend-shallow": "^2.0.1",
|
||||
|
@ -6276,38 +6276,15 @@
|
|||
"dev": true
|
||||
},
|
||||
"union-value": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz",
|
||||
"integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=",
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
|
||||
"integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arr-union": "^3.1.0",
|
||||
"get-value": "^2.0.6",
|
||||
"is-extendable": "^0.1.1",
|
||||
"set-value": "^0.4.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"set-value": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz",
|
||||
"integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"extend-shallow": "^2.0.1",
|
||||
"is-extendable": "^0.1.1",
|
||||
"is-plain-object": "^2.0.1",
|
||||
"to-object-path": "^0.3.0"
|
||||
}
|
||||
}
|
||||
"set-value": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"unique-filename": {
|
||||
|
|
|
@ -6,5 +6,5 @@ export default {
|
|||
branch: "master",
|
||||
repo: "rauenzi",
|
||||
minSupportedVersion: "0.3.0",
|
||||
bbdVersion: "0.2.17"
|
||||
bbdVersion: "1.0.0"
|
||||
};
|
|
@ -5,6 +5,8 @@ import DataStore from "./datastore";
|
|||
import DOMManager from "./dommanager";
|
||||
import Toasts from "../ui/toasts";
|
||||
import Modals from "../ui/modals";
|
||||
import PluginManager from "./pluginmanager";
|
||||
import ThemeManager from "./thememanager";
|
||||
|
||||
const BdApi = {
|
||||
get React() { return DiscordModules.React; },
|
||||
|
@ -158,9 +160,43 @@ BdApi.deleteData = function(pluginName, key) {
|
|||
|
||||
// Patches other functions
|
||||
BdApi.monkeyPatch = function(what, methodName, options) {
|
||||
return Utilities.monkeyPatch(what, methodName, options);
|
||||
const {before, after, instead, once = false, silent = false, force = false} = options;
|
||||
const displayName = options.displayName || what.displayName || what.name || what.constructor.displayName || what.constructor.name;
|
||||
if (!silent) console.log("patch", methodName, "of", displayName); // eslint-disable-line no-console
|
||||
if (!what[methodName]) {
|
||||
if (force) what[methodName] = function() {};
|
||||
else return console.error(methodName, "does not exist for", displayName); // eslint-disable-line no-console
|
||||
}
|
||||
const origMethod = what[methodName];
|
||||
const cancel = () => {
|
||||
if (!silent) console.log("unpatch", methodName, "of", displayName); // eslint-disable-line no-console
|
||||
what[methodName] = origMethod;
|
||||
};
|
||||
what[methodName] = function() {
|
||||
const data = {
|
||||
thisObject: this,
|
||||
methodArguments: arguments,
|
||||
cancelPatch: cancel,
|
||||
originalMethod: origMethod,
|
||||
callOriginalMethod: () => data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments)
|
||||
};
|
||||
if (instead) {
|
||||
const tempRet = Utilities.suppressErrors(instead, "`instead` callback of " + what[methodName].displayName)(data);
|
||||
if (tempRet !== undefined) data.returnValue = tempRet;
|
||||
}
|
||||
else {
|
||||
if (before) Utilities.suppressErrors(before, "`before` callback of " + what[methodName].displayName)(data);
|
||||
data.callOriginalMethod();
|
||||
if (after) Utilities.suppressErrors(after, "`after` callback of " + what[methodName].displayName)(data);
|
||||
}
|
||||
if (once) cancel();
|
||||
return data.returnValue;
|
||||
};
|
||||
what[methodName].__monkeyPatched = true;
|
||||
if (!what[methodName].__originalMethod) what[methodName].__originalMethod = origMethod;
|
||||
what[methodName].displayName = "patched " + (what[methodName].displayName || methodName);
|
||||
return cancel;
|
||||
};
|
||||
|
||||
// Event when element is removed
|
||||
BdApi.onRemoved = function(node, callback) {
|
||||
return Utilities.onRemoved(node, callback);
|
||||
|
@ -178,24 +214,21 @@ BdApi.testJSON = function(data) {
|
|||
|
||||
//Get another plugin
|
||||
//name = name of plugin
|
||||
// BdApi.getPlugin = function (name) {
|
||||
// if (Plugins.hasOwnProperty(name)) {
|
||||
// return Plugins[name].plugin;
|
||||
// }
|
||||
// return null;
|
||||
// };
|
||||
BdApi.getPlugin = function (name) {
|
||||
return PluginManager.addonList.find(a => a.name == name);
|
||||
};
|
||||
|
||||
// BdApi.isPluginEnabled = function(name) {
|
||||
// return !!PluginCookie[name];
|
||||
// };
|
||||
BdApi.isPluginEnabled = function(name) {
|
||||
const plugin = this.getPlugin(name);
|
||||
if (!plugin) return false;
|
||||
return PluginManager.isEnabled(plugin.id);
|
||||
};
|
||||
|
||||
// BdApi.isThemeEnabled = function(name) {
|
||||
// return !!ThemeCookie[name];
|
||||
// };
|
||||
|
||||
// BdApi.isSettingEnabled = function(id) {
|
||||
// return !!SettingsCookie[id];
|
||||
// };
|
||||
BdApi.isThemeEnabled = function(name) {
|
||||
const theme = ThemeManager.addonList.find(a => a.name == name);
|
||||
if (!theme) return false;
|
||||
return ThemeManager.isEnabled(theme.id);
|
||||
};
|
||||
|
||||
// Gets data
|
||||
BdApi.getBDData = function(key) {
|
||||
|
|
|
@ -57,45 +57,6 @@ export default class Utilities {
|
|||
};
|
||||
}
|
||||
|
||||
static monkeyPatch(what, methodName, options) {
|
||||
const {before, after, instead, once = false, silent = false, force = false} = options;
|
||||
const displayName = options.displayName || what.displayName || what.name || what.constructor.displayName || what.constructor.name;
|
||||
if (!silent) console.log("patch", methodName, "of", displayName); // eslint-disable-line no-console
|
||||
if (!what[methodName]) {
|
||||
if (force) what[methodName] = function() {};
|
||||
else return console.error(methodName, "does not exist for", displayName); // eslint-disable-line no-console
|
||||
}
|
||||
const origMethod = what[methodName];
|
||||
const cancel = () => {
|
||||
if (!silent) console.log("unpatch", methodName, "of", displayName); // eslint-disable-line no-console
|
||||
what[methodName] = origMethod;
|
||||
};
|
||||
what[methodName] = function() {
|
||||
const data = {
|
||||
thisObject: this,
|
||||
methodArguments: arguments,
|
||||
cancelPatch: cancel,
|
||||
originalMethod: origMethod,
|
||||
callOriginalMethod: () => data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments)
|
||||
};
|
||||
if (instead) {
|
||||
const tempRet = Utilities.suppressErrors(instead, "`instead` callback of " + what[methodName].displayName)(data);
|
||||
if (tempRet !== undefined) data.returnValue = tempRet;
|
||||
}
|
||||
else {
|
||||
if (before) Utilities.suppressErrors(before, "`before` callback of " + what[methodName].displayName)(data);
|
||||
data.callOriginalMethod();
|
||||
if (after) Utilities.suppressErrors(after, "`after` callback of " + what[methodName].displayName)(data);
|
||||
}
|
||||
if (once) cancel();
|
||||
return data.returnValue;
|
||||
};
|
||||
what[methodName].__monkeyPatched = true;
|
||||
if (!what[methodName].__originalMethod) what[methodName].__originalMethod = origMethod;
|
||||
what[methodName].displayName = "patched " + (what[methodName].displayName || methodName);
|
||||
return cancel;
|
||||
}
|
||||
|
||||
static onRemoved(node, callback) {
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
for (let m = 0; m < mutations.length; m++) {
|
||||
|
|
|
@ -18,7 +18,7 @@ export default class PublicServersConnection {
|
|||
}
|
||||
|
||||
static hasJoined(id) {
|
||||
return SortedGuildStore.guildPositions.includes(id);
|
||||
return SortedGuildStore.getFlattenedGuildIds().includes(id);
|
||||
}
|
||||
|
||||
static search({term = "", category = "", from = 0} = {}) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {WebpackModules, Settings} from "modules";
|
||||
|
||||
const channelsClass = WebpackModules.getByProps("channels").channels.split(" ")[0];
|
||||
const channelsClass = WebpackModules.getByProps("sidebar", "hasNotice").sidebar.split(" ")[0];
|
||||
const membersWrapClass = WebpackModules.getByProps("membersWrap").membersWrap.split(" ")[0];
|
||||
|
||||
export default class Toasts {
|
||||
|
|
Loading…
Reference in New Issue