Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/jsHelper/spicetifyWrapper/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ void (async function addProxyCosmos() {
const internalFetch = Reflect.get(target, prop, receiver);

if (typeof internalFetch !== "function" || !allowedMethodsSet.has(prop)) return internalFetch;
const version = Spicetify.Platform.version.split(".").map((i) => Number.parseInt(i, 10));
if (version[1] >= 2 && version[2] < 31) return internalFetch;
if (isVersionBefore(Spicetify.Platform.version, [1, 2, 31])) return internalFetch;

/** @this {any} */
return async function (url, body) {
Expand Down
6 changes: 6 additions & 0 deletions src/jsHelper/spicetifyWrapper/shared/version.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ describe("isVersionBefore", () => {
assert.equal(isVersionBefore("2.0.0", [1, 2, 57]), false);
assert.equal(isVersionBefore("1.1.99", [1, 2, 57]), true);
});

it("keeps the CosmosAsync proxy on for 1.2.31 and every later minor", () => {
assert.equal(isVersionBefore("1.2.30.1", [1, 2, 31]), true);
assert.equal(isVersionBefore("1.2.31.0", [1, 2, 31]), false);
assert.equal(isVersionBefore("1.3.3.264", [1, 2, 31]), false);
});
});
Loading