aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-11-11 00:11:44 +0100
committerVendicated <vendicated@riseup.net>2022-11-11 00:11:44 +0100
commit8ba9c96f2075f5245a9fec369046559d6a1e107c (patch)
tree8951172468bb9fa79b6b60e3aed2dabf2e5c3ea4
parent57f3feba6896033008826818b3260f4474d9cfae (diff)
downloadVencord-8ba9c96f2075f5245a9fec369046559d6a1e107c.tar.gz
Vencord-8ba9c96f2075f5245a9fec369046559d6a1e107c.tar.bz2
Vencord-8ba9c96f2075f5245a9fec369046559d6a1e107c.zip
Fix most plugins
-rw-r--r--src/plugins/pronoundb/index.ts6
-rw-r--r--src/plugins/reverseImageSearch.tsx2
-rw-r--r--src/plugins/settings.tsx (renamed from src/plugins/settings.ts)39
-rw-r--r--src/plugins/spotifyControls/index.tsx2
4 files changed, 27 insertions, 22 deletions
diff --git a/src/plugins/pronoundb/index.ts b/src/plugins/pronoundb/index.ts
index 68fa265..5dfeda5 100644
--- a/src/plugins/pronoundb/index.ts
+++ b/src/plugins/pronoundb/index.ts
@@ -38,7 +38,7 @@ export default definePlugin({
{
find: "showCommunicationDisabledStyles",
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)]"
}
},
@@ -46,8 +46,8 @@ export default definePlugin({
{
find: ".headerTagUsernameNoNickname",
replacement: {
- match: /""!==(.{1,2})&&(r\.createElement\(r\.Fragment.+?\.Messages\.USER_POPOUT_PRONOUNS.+?pronounsText.+?\},\1\)\))/,
- replace: (_, __, fragment) => `Vencord.Plugins.plugins.PronounDB.PronounsProfileWrapper(e, ${fragment})`
+ match: /(?<=""!==(.{1,2})&&).+?children:\1.+?(?=,)/,
+ replace: "Vencord.Plugins.plugins.PronounDB.PronounsProfileWrapper(e, $1)"
}
}
],
diff --git a/src/plugins/reverseImageSearch.tsx b/src/plugins/reverseImageSearch.tsx
index 3bcefba..cbe72d8 100644
--- a/src/plugins/reverseImageSearch.tsx
+++ b/src/plugins/reverseImageSearch.tsx
@@ -36,7 +36,7 @@ export default definePlugin({
patches: [{
find: "open-native-link",
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) =>
`${m},Vencord.Plugins.plugins.ReverseImageSearch.makeMenu(${src}, arguments[2])`
}
diff --git a/src/plugins/settings.ts b/src/plugins/settings.tsx
index f8ef7d8..d80b0ff 100644
--- a/src/plugins/settings.ts
+++ b/src/plugins/settings.tsx
@@ -16,6 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import React from "react";
+
import gitHash from "~git-hash";
import { Devs } from "../utils/constants";
@@ -30,22 +32,10 @@ export default definePlugin({
find: "().versionHash",
replacement: [
{
- match: /\w\.createElement\(.{1,2}.Fragment,.{0,30}\{[^}]+\},"Host ".+?\):null/,
- replace: m => {
- const idx = m.indexOf("Host") - 1;
- const template = m.slice(0, idx);
- 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;
+ match: /\[\(0,.{1,3}\.jsxs?\)\((.{1,10}),(\{[^{}}]+\{.{0,20}\(\)\.versionHash,.+?\})\)," "/,
+ replace: (m, component, props) => {
+ props = props.replace(/children:\[.+\]/, "");
+ return `${m},Vencord.Plugins.plugins.Settings.makeInfoElements(${component}, ${props})`;
}
}
]
@@ -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>
+ </>
+ );
+ }
});
diff --git a/src/plugins/spotifyControls/index.tsx b/src/plugins/spotifyControls/index.tsx
index 18bced9..6bf6625 100644
--- a/src/plugins/spotifyControls/index.tsx
+++ b/src/plugins/spotifyControls/index.tsx
@@ -40,7 +40,7 @@ export default definePlugin({
find: "showTaglessAccountPanel:",
replacement: {
// return React.createElement(AccountPanel, { ..., showTaglessAccountPanel: blah })
- match: /return (.{0,30}\(.{1,3},\{[^}]+?,showTaglessAccountPanel:.+?\}\))/,
+ match: /return ?(.{0,30}\(.{1,3},\{[^}]+?,showTaglessAccountPanel:.+?\}\))/,
// return [Player, Panel]
replace: "return [Vencord.Plugins.plugins.SpotifyControls.renderPlayer(),$1]"
}