Merge branch 'dev' into modules-proxy-patches

This commit is contained in:
Nuckyz 2024-06-06 00:50:09 -03:00
commit 94ea4f8e5c
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
5 changed files with 35 additions and 17 deletions

View file

@ -286,7 +286,14 @@ page.on("console", async e => {
});
page.on("error", e => console.error("[Error]", e.message));
page.on("pageerror", e => console.error("[Page Error]", e.message));
page.on("pageerror", e => {
if (!e.message.startsWith("Object") && !e.message.includes("Cannot find module")) {
console.error("[Page Error]", e.message);
report.otherErrors.push(e.message);
} else {
report.ignoredErrors.push(e.message);
}
});
async function reporterRuntime(token: string) {
Vencord.Webpack.waitFor(

View file

@ -48,11 +48,11 @@ export async function loadLazyChunks() {
for (const id of chunkIds) {
if (wreq.u(id) == null || wreq.u(id) === "undefined.js") continue;
const isWasm = await fetch(wreq.p + wreq.u(id))
const isWorkerAsset = await fetch(wreq.p + wreq.u(id))
.then(r => r.text())
.then(t => (IS_WEB && t.includes(".module.wasm")) || !t.includes("(this.webpackChunkdiscord_app=this.webpackChunkdiscord_app||[]).push"));
.then(t => t.includes("importScripts("));
if (isWasm && IS_WEB) {
if (isWorkerAsset) {
invalidChunks.add(id);
invalidChunkGroup = true;
continue;
@ -151,13 +151,15 @@ export async function loadLazyChunks() {
});
await Promise.all(chunksLeft.map(async id => {
const isWasm = await fetch(wreq.p + wreq.u(id))
const isWorkerAsset = await fetch(wreq.p + wreq.u(id))
.then(r => r.text())
.then(t => (IS_WEB && t.includes(".module.wasm")) || !t.includes("(this.webpackChunkdiscord_app=this.webpackChunkdiscord_app||[]).push"));
.then(t => t.includes("importScripts("));
// Loads and requires a chunk
if (!isWasm) {
if (!isWorkerAsset) {
await wreq.e(id);
// Technically, the id of the chunk does not match the entry point
// But, still try it because we have no way to get the actual entry point
if (wreq.m[id]) wreq(id);
}
}));

View file

@ -6,7 +6,7 @@
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType, PluginNative } from "@utils/types";
import definePlugin, { OptionType, PluginNative, ReporterTestable } from "@utils/types";
import { ApplicationAssetUtils, FluxDispatcher, Forms } from "@webpack/common";
const Native = VencordNative.pluginHelpers.AppleMusic as PluginNative<typeof import("./native")>;
@ -171,6 +171,7 @@ export default definePlugin({
description: "Discord rich presence for your Apple Music!",
authors: [Devs.RyanCaoDev],
hidden: !navigator.platform.startsWith("Mac"),
reporterTestable: ReporterTestable.None,
settingsAboutComponent() {
return <>

View file

@ -74,15 +74,15 @@ export default definePlugin({
]
},
{
find: /overrideBannerSrc:\i,profileType:/,
find: /overrideBannerSrc:\i,overrideBannerWidth:/,
replacement: [
{
match: /(\i)\.premiumType/,
replace: "$self.premiumHook($1)||$&"
},
{
match: /(?<=function \i\((\i)\)\{)(?=var.{30,50},overrideBannerSrc:)/,
replace: "$1.overrideBannerSrc=$self.useBannerHook($1);"
match: /function \i\((\i)\)\{/,
replace: "$&$1.overrideBannerSrc=$self.useBannerHook($1);"
}
]
},

View file

@ -184,16 +184,16 @@ export default definePlugin({
patches: [
// Profiles Modal pfp
{
find: "User Profile Modal - Context Menu",
...["User Profile Modal - Context Menu", ".UserProfileTypes.FULL_SIZE,hasProfileEffect:"].map(find => ({
find,
replacement: {
match: /\{src:(\i)(?=,avatarDecoration)/,
replace: "{src:$1,onClick:()=>$self.openImage($1)"
}
},
})),
// Banners
{
find: ".NITRO_BANNER,",
...[".NITRO_BANNER,", /overrideBannerSrc:\i,overrideBannerWidth:/].map(find => ({
find,
replacement: {
// style: { backgroundImage: shouldShowBanner ? "url(".concat(bannerUrl,
match: /style:\{(?=backgroundImage:(null!=\i)\?"url\("\.concat\((\i),)/,
@ -201,7 +201,7 @@ export default definePlugin({
// onClick: () => shouldShowBanner && ev.target.style.backgroundImage && openImage(bannerUrl), style: { cursor: shouldShowBanner ? "pointer" : void 0,
'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
}
},
})),
// User DMs "User Profile" popup in the right
{
find: ".avatarPositionPanel",
@ -210,6 +210,14 @@ export default definePlugin({
replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}"
}
},
{
find: ".canUsePremiumProfileCustomization,{avatarSrc:",
replacement: {
match: /children:\(0,\i\.jsx\)\(\i,{src:(\i)/,
replace: "style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},$&"
}
},
// Group DMs top small & large icon
{
find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/,