Fix most plugins

This commit is contained in:
Vendicated 2022-11-11 00:11:44 +01:00
parent 57f3feba68
commit 8ba9c96f20
No known key found for this signature in database
GPG Key ID: EC781ADFB93EFFA3
4 changed files with 27 additions and 22 deletions

@ -38,7 +38,7 @@ export default definePlugin({
{ {
find: "showCommunicationDisabledStyles", find: "showCommunicationDisabledStyles",
replacement: { replacement: {
match: /(?<=return\s+\w{1,3}\.createElement\(.+!\w{1,3}&&)(\w{1,3}.createElement\(.+?\{.+?\}\))/, match: /(?<=return\s*\(0,\w{1,3}\.jsxs?\)\(.+!\w{1,3}&&)(\(0,\w{1,3}.jsxs?\)\(.+?\{.+?\}\))/,
replace: "[$1, Vencord.Plugins.plugins.PronounDB.PronounsChatComponent(e)]" replace: "[$1, Vencord.Plugins.plugins.PronounDB.PronounsChatComponent(e)]"
} }
}, },
@ -46,8 +46,8 @@ export default definePlugin({
{ {
find: ".headerTagUsernameNoNickname", find: ".headerTagUsernameNoNickname",
replacement: { replacement: {
match: /""!==(.{1,2})&&(r\.createElement\(r\.Fragment.+?\.Messages\.USER_POPOUT_PRONOUNS.+?pronounsText.+?\},\1\)\))/, match: /(?<=""!==(.{1,2})&&).+?children:\1.+?(?=,)/,
replace: (_, __, fragment) => `Vencord.Plugins.plugins.PronounDB.PronounsProfileWrapper(e, ${fragment})` replace: "Vencord.Plugins.plugins.PronounDB.PronounsProfileWrapper(e, $1)"
} }
} }
], ],

@ -36,7 +36,7 @@ export default definePlugin({
patches: [{ patches: [{
find: "open-native-link", find: "open-native-link",
replacement: { replacement: {
match: /key:"open-native-link".{0,200}\(\{href:(.{0,3}),.{0,200}\}\)/, match: /id:"open-native-link".{0,200}\(\{href:(.{0,3}),.{0,200}\},"open-native-link"\)/,
replace: (m, src) => replace: (m, src) =>
`${m},Vencord.Plugins.plugins.ReverseImageSearch.makeMenu(${src}, arguments[2])` `${m},Vencord.Plugins.plugins.ReverseImageSearch.makeMenu(${src}, arguments[2])`
} }

@ -16,6 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import React from "react";
import gitHash from "~git-hash"; import gitHash from "~git-hash";
import { Devs } from "../utils/constants"; import { Devs } from "../utils/constants";
@ -30,22 +32,10 @@ export default definePlugin({
find: "().versionHash", find: "().versionHash",
replacement: [ replacement: [
{ {
match: /\w\.createElement\(.{1,2}.Fragment,.{0,30}\{[^}]+\},"Host ".+?\):null/, match: /\[\(0,.{1,3}\.jsxs?\)\((.{1,10}),(\{[^{}}]+\{.{0,20}\(\)\.versionHash,.+?\})\)," "/,
replace: m => { replace: (m, component, props) => {
const idx = m.indexOf("Host") - 1; props = props.replace(/children:\[.+\]/, "");
const template = m.slice(0, idx); return `${m},Vencord.Plugins.plugins.Settings.makeInfoElements(${component}, ${props})`;
const additionalInfo = IS_WEB
? " (Web)"
: IS_STANDALONE
? " (Standalone)"
: "";
let r = `${m}, ${template}"Vencord ", "${gitHash}${additionalInfo}"), " ")`;
if (!IS_WEB) {
r += `,${template} "Electron ",VencordNative.getVersions().electron)," "),`;
r += `${template} "Chrome ",VencordNative.getVersions().chrome)," ")`;
}
return r;
} }
} }
] ]
@ -66,5 +56,20 @@ export default definePlugin({
); );
} }
} }
}] }],
makeInfoElements(Component: React.ComponentType<React.PropsWithChildren>, props: React.PropsWithChildren) {
const additionalInfo = IS_WEB
? " (Web)"
: IS_STANDALONE
? " (Standalone)"
: "";
return (
<>
<Component {...props}>Vencord {gitHash}{additionalInfo}</Component>
<Component {...props}>Electron {VencordNative.getVersions().electron}</Component>
<Component {...props}>Chromium {VencordNative.getVersions().chrome}</Component>
</>
);
}
}); });

@ -40,7 +40,7 @@ export default definePlugin({
find: "showTaglessAccountPanel:", find: "showTaglessAccountPanel:",
replacement: { replacement: {
// return React.createElement(AccountPanel, { ..., showTaglessAccountPanel: blah }) // return React.createElement(AccountPanel, { ..., showTaglessAccountPanel: blah })
match: /return (.{0,30}\(.{1,3},\{[^}]+?,showTaglessAccountPanel:.+?\}\))/, match: /return ?(.{0,30}\(.{1,3},\{[^}]+?,showTaglessAccountPanel:.+?\}\))/,
// return [Player, Panel] // return [Player, Panel]
replace: "return [Vencord.Plugins.plugins.SpotifyControls.renderPlayer(),$1]" replace: "return [Vencord.Plugins.plugins.SpotifyControls.renderPlayer(),$1]"
} }