diff --git a/jsHelper/spicetifyWrapper.js b/jsHelper/spicetifyWrapper.js index 13808aba2b..1a83b2cbe1 100644 --- a/jsHelper/spicetifyWrapper.js +++ b/jsHelper/spicetifyWrapper.js @@ -310,11 +310,13 @@ window.Spicetify = { }; (function addProxyCosmos() { - if (!Spicetify.Player.origin?._cosmos) { + if (!Spicetify.Player.origin?._cosmos && !Spicetify.Platform?.Registry) { setTimeout(addProxyCosmos, 50); return; } + const _cosmos = Spicetify.Player.origin?._cosmos ?? Spicetify.Platform?.Registry._map.get(Symbol.for("Cosmos")).instance; + const corsProxyURL = "https://cors-proxy.spicetify.app"; const allowedMethodsMap = { get: "get", @@ -394,7 +396,7 @@ window.Spicetify = { } }; - Spicetify.Player.origin._cosmos = new Proxy(Spicetify.Player.origin._cosmos, handler); + Spicetify.Player.origin._cosmos = new Proxy(_cosmos, handler); Object.defineProperty(Spicetify, "CosmosAsync", { get: () => { return Spicetify.Player.origin?._cosmos; @@ -697,6 +699,13 @@ window.Spicetify = { } }); + const confirmDialogChunk = chunks.find( + ([, value]) => value.toString().includes("confirmDialog") && value.toString().includes("shouldCloseOnEsc") && value.toString().includes("isOpen") + ); + if (!Spicetify.ReactComponent?.ConfirmDialog && confirmDialogChunk) { + Spicetify.ReactComponent.ConfirmDialog = Object.values(require(confirmDialogChunk[0])).find(m => typeof m === "object"); + } + const contextMenuChunk = chunks.find(([, value]) => value.toString().includes("toggleContextMenu")); if (contextMenuChunk) { Spicetify.ReactComponent.ContextMenu = Object.values(require(contextMenuChunk[0])).find(m => typeof m === "function");