This commit is contained in:
thororen1234 2024-06-06 12:46:36 -04:00
commit b1d87cbdef
5 changed files with 25 additions and 15 deletions

View file

@ -286,7 +286,14 @@ page.on("console", async e => {
}); });
page.on("error", e => console.error("[Error]", e.message)); 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) { async function reporterRuntime(token: string) {
Vencord.Webpack.waitFor( Vencord.Webpack.waitFor(

View file

@ -47,11 +47,11 @@ export async function loadLazyChunks() {
for (const id of chunkIds) { for (const id of chunkIds) {
if (wreq.u(id) == null || wreq.u(id) === "undefined.js") continue; 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(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); invalidChunks.add(id);
invalidChunkGroup = true; invalidChunkGroup = true;
continue; continue;
@ -149,13 +149,15 @@ export async function loadLazyChunks() {
}); });
await Promise.all(chunksLeft.map(async id => { 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(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 // Loads and requires a chunk
if (!isWasm) { if (!isWorkerAsset) {
await wreq.e(id as any); await wreq.e(id as any);
// 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 as any); if (wreq.m[id]) wreq(id as any);
} }
})); }));

View file

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

View file

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

View file

@ -192,7 +192,7 @@ export default definePlugin({
} }
})), })),
// Banners // Banners
...[".NITRO_BANNER,", /profileType:\i,overrideBannerSrc:\i/, /profileType:\i,pendingBanner:\i/].map(find => ({ ...[".NITRO_BANNER,", /overrideBannerSrc:\i,overrideBannerWidth:/, /pendingBanner:\i,overrideBannerWidth:/].map(find => ({
find, find,
replacement: { replacement: {
// style: { backgroundImage: shouldShowBanner ? "url(".concat(bannerUrl, // style: { backgroundImage: shouldShowBanner ? "url(".concat(bannerUrl,