Fix plugin settings and invites

This commit is contained in:
Zack Rauen 2022-10-17 18:05:08 -04:00
parent f0bf331933
commit 548552dfe2
6 changed files with 14 additions and 28 deletions

View File

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

View File

@ -1,28 +1,16 @@
// fixed, improved, added, progress
export default {
description: "Several new translations have been added thanks to our wonderful volunteers!",
description: "Just some smaller fixes while we work on some big things in the background.",
changes: [
{
title: "New or Updated Translations",
type: "improved",
items: [
"Finnish",
"Hungarian",
"Italian",
"Japanese",
"Korean",
"Russian",
"Ukrainian"
]
},
{
title: "Bug Fixes",
type: "fixed",
items: [
"Fixed a few issues with our context menu api.",
"Fixed an issue in our API that could lead to styles not being removed correctly.",
"Fixed an issue where `getOwnerInstance` would cause an error.",
"Fixed an issue with the core updater not updating on click."
"Fixed _even more_ issues with the built-in updater.",
"Fixed not being able to click support server links in plugin/theme pages.",
"Fixed some issues with not being able to join public servers.",
"Fixed plugin settings not being able to be displayed.",
"Fixed changelog modal not being able to be displayed."
]
}
]

View File

@ -106,7 +106,7 @@ export class CoreUpdater {
const asar = this.apiData.assets.find(a => a.name === "betterdiscord.asar");
const buff = await new Promise((resolve, reject) =>
request(asar.url, {encoding: null, headers: {"User-Agent": "BetterDiscord Updater", "Accept": "application/octet-stream"}}, (err, resp, body) => {
request(asar.url, {headers: {"Content-Type": "application/octet-stream", "User-Agent": "BetterDiscord Updater", "Accept": "application/octet-stream"}}, (err, resp, body) => {
if (err || resp.statusCode != 200) return reject(err || `${resp.statusCode} ${resp.statusMessage}`);
return resolve(body);
}));

View File

@ -99,7 +99,7 @@ export default new class PublicServersConnection {
}
async join(id, native = false) {
if (native) return InviteActions.acceptInvite(id);
if (native) return InviteActions.acceptInvite({inviteKey: id});
try {
await fetch(`${this.joinEndPoint}/${id}`,{
method: "GET",

View File

@ -21,7 +21,6 @@ export default class Modals {
static get ModalRoot() {return this._ModalRoot ??= WebpackModules.getModule(m => m?.toString?.()?.includes("ENTERING"), {searchExports: true});}
static get ModalClasses() {return this._ModalClasses ??= WebpackModules.getByProps("modal", "content");}
static get FlexElements() {return this._FlexElements ??= WebpackModules.getByProps("Child", "Align");}
static get FormTitle() {return this._FormTitle ??= WebpackModules.getByProps("Tags", "Sizes");}
static get TextElement() {return this._TextElement ??= WebpackModules.getModule(m => m?.Sizes?.SIZE_32 && m.Colors);}
static get ConfirmationModal() {return this._ConfirmationModal ??= WebpackModules.getModule(m => m?.toString?.()?.includes(".confirmButtonColor"));}
static get Markdown() {return this._Markdown ??= WebpackModules.find(m => m?.prototype?.render && m.rules);}
@ -228,10 +227,9 @@ export default class Modals {
const ChangelogClasses = WebpackModules.getByProps("fixed", "improved");
const TextElement = this.TextElement;
const FlexChild = this.FlexElements;
const Titles = this.FormTitle;
const MarkdownParser = WebpackModules.getByProps("defaultRules", "parse");
if (!OriginalModalClasses || !ChangelogModalClasses || !ChangelogClasses || !TextElement || !FlexChild || !Titles || !MarkdownParser) return Logger.warn("Modals", "showChangelogModal missing modules");
if (!OriginalModalClasses || !ChangelogModalClasses || !ChangelogClasses || !TextElement || !FlexChild || !MarkdownParser) return Logger.warn("Modals", "showChangelogModal missing modules");
const {image = "https://i.imgur.com/wuh5yMK.png", description = "", changes = [], title = "BetterDiscord", subtitle = `v${Config.version}`, footer} = options;
const ce = React.createElement;
@ -248,7 +246,7 @@ export default class Modals {
}
const renderHeader = function() {
return ce(FlexChild, {className: OriginalModalClasses.header, grow: 0, shrink: 0, direction: FlexChild.Direction.VERTICAL},
ce(Titles, {tag: Titles.Tags.H1, size: TextElement.Sizes.SIZE_20}, title),
ce(TextElement, {tag: "h1", size: TextElement.Sizes.SIZE_20, strong: true}, title),
ce(TextElement, {size: TextElement.Sizes.SIZE_12, color: TextElement.Colors.STANDARD, className: ChangelogClasses.date}, subtitle)
);
};
@ -258,7 +256,7 @@ export default class Modals {
const joinSupportServer = (click) => {
click.preventDefault();
click.stopPropagation();
DiscordModules.InviteActions.acceptInviteAndTransitionToInviteChannel("0Tmfo5ZbORCRqbAd");
DiscordModules.InviteActions.acceptInviteAndTransitionToInviteChannel({inviteKey: "0Tmfo5ZbORCRqbAd"});
};
const supportLink = ce("a", {className: `${AnchorClasses.anchor} ${AnchorClasses.anchorUnderlineOnHover}`, onClick: joinSupportServer}, "Join our Discord Server.");
const defaultFooter = ce(TextElement, {size: TextElement.Sizes.SIZE_12, color: TextElement.Colors.STANDARD}, "Need support? ", supportLink);
@ -313,7 +311,7 @@ export default class Modals {
const modal = props => {
return React.createElement(ErrorBoundary, {}, React.createElement(this.ModalRoot, Object.assign({size: mc.Sizes.MEDIUM, className: "bd-addon-modal" + " " + mc.Sizes.MEDIUM}, props),
React.createElement(mc.Header, {separator: false, className: "bd-addon-modal-header"},
React.createElement(this.FormTitle, {tag: "h4"}, `${name} Settings`)
React.createElement(this.TextElement, {tag: "h1", size: this.TextElement.Sizes.SIZE_20, strong: true}, `${name} Settings`)
),
React.createElement(mc.Content, {className: "bd-addon-modal-settings"},
React.createElement(ErrorBoundary, {}, child)

View File

@ -125,7 +125,7 @@ export default class AddonCard extends React.Component {
const tester = /\.gg\/(.*)$/;
if (tester.test(code)) code = code.match(tester)[1];
LayerManager.popLayer();
DiscordModules.InviteActions.acceptInviteAndTransitionToInviteChannel(code);
DiscordModules.InviteActions.acceptInviteAndTransitionToInviteChannel({inviteKey: code});
};
}
return this.makeButton(Strings.Addons[which], link);