From 548552dfe24368002f2e9378ab318fbba2338a26 Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Mon, 17 Oct 2022 18:05:08 -0400 Subject: [PATCH] Fix plugin settings and invites --- package.json | 2 +- renderer/src/data/changelog.js | 24 ++++++------------------ renderer/src/modules/updater.js | 2 +- renderer/src/structs/psconnection.js | 2 +- renderer/src/ui/modals.js | 10 ++++------ renderer/src/ui/settings/addoncard.jsx | 2 +- 6 files changed, 14 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 3de658f2..e711a7ef 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/renderer/src/data/changelog.js b/renderer/src/data/changelog.js index 5eeabc82..67d6fccd 100644 --- a/renderer/src/data/changelog.js +++ b/renderer/src/data/changelog.js @@ -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." ] } ] diff --git a/renderer/src/modules/updater.js b/renderer/src/modules/updater.js index 8002574e..4aa0ad83 100644 --- a/renderer/src/modules/updater.js +++ b/renderer/src/modules/updater.js @@ -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); })); diff --git a/renderer/src/structs/psconnection.js b/renderer/src/structs/psconnection.js index 772407c7..ed22bbf6 100644 --- a/renderer/src/structs/psconnection.js +++ b/renderer/src/structs/psconnection.js @@ -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", diff --git a/renderer/src/ui/modals.js b/renderer/src/ui/modals.js index 3cac96da..3fc8f680 100644 --- a/renderer/src/ui/modals.js +++ b/renderer/src/ui/modals.js @@ -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) diff --git a/renderer/src/ui/settings/addoncard.jsx b/renderer/src/ui/settings/addoncard.jsx index 157a915c..ae82f5c7 100644 --- a/renderer/src/ui/settings/addoncard.jsx +++ b/renderer/src/ui/settings/addoncard.jsx @@ -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);