From fb7115dd511379f55f4395684344e701df811d5d Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 24 Aug 2025 09:38:08 -0400 Subject: [PATCH] Some Bug Fixes --- .../bannersEverywhere/index.tsx | 17 ++--------------- .../spotify/lyrics/providers/store.ts | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/equicordplugins/bannersEverywhere/index.tsx b/src/equicordplugins/bannersEverywhere/index.tsx index 7b30c7e59..b6f5b8984 100644 --- a/src/equicordplugins/bannersEverywhere/index.tsx +++ b/src/equicordplugins/bannersEverywhere/index.tsx @@ -116,19 +116,7 @@ export default definePlugin({ ); }, - async checkImageExists(url: string): Promise { - return new Promise(resolve => { - const img = new Image(); - img.onload = () => resolve(true); - img.onerror = () => resolve(false); - img.src = url; - }); - }, - async gifToPng(url: string): Promise { - const exists = await this.checkImageExists(url); - if (!exists) return ""; - return new Promise((resolve, reject) => { const img = new Image(); img.crossOrigin = "anonymous"; @@ -139,13 +127,12 @@ export default definePlugin({ const ctx = canvas.getContext("2d"); if (ctx) { ctx.drawImage(img, 0, 0); - const pngDataUrl = canvas.toDataURL("image/png"); - resolve(pngDataUrl); + resolve(canvas.toDataURL("image/png")); } else { reject(new Error("Failed to get canvas context.")); } }; - img.onerror = err => reject(err); + img.onerror = () => resolve(""); img.src = url; }); }, diff --git a/src/equicordplugins/musicControls/spotify/lyrics/providers/store.ts b/src/equicordplugins/musicControls/spotify/lyrics/providers/store.ts index 5f9049891..475820eba 100644 --- a/src/equicordplugins/musicControls/spotify/lyrics/providers/store.ts +++ b/src/equicordplugins/musicControls/spotify/lyrics/providers/store.ts @@ -74,15 +74,28 @@ export const SpotifyLrcStore = proxyLazyWebpack(() => { } if (provider === Provider.Translated || provider === Provider.Romanized) { - const originalLyrics = currentInfo?.lyricsVersions[settings.store.LyricsProvider] || providers - .map(p => currentInfo?.lyricsVersions[p]) - .find(Boolean); + const originalLyrics = currentInfo?.lyricsVersions[settings.store.LyricsProvider] || + providers.map(p => currentInfo?.lyricsVersions[p]).find(Boolean); if (!originalLyrics || !currentInfo) { showNotif("No lyrics", `No lyrics to ${provider === Provider.Translated ? "translate" : "romanize"}`); return; } + const lyricsCheckText = originalLyrics.map(line => line.text).join(" "); + + if (provider === Provider.Romanized && !/[^\u0000-\u007F]/.test(lyricsCheckText)) { + lyricsInfo = { + ...currentInfo, + useLyric: settings.store.LyricsProvider, + lyricsVersions: { + ...currentInfo.lyricsVersions, + }, + }; + store.emitChange(); + return; + } + const fetchResult = await lyricsAlternativeFetchers[provider](originalLyrics); if (!fetchResult) {