Skip to content

Commit

Permalink
Merge branch 'spicetify:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Lseoksee authored Jul 15, 2024
2 parents b6a580b + ecf4681 commit 8c6e3cf
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 31 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Build

on: [pull_request, push]
on:
pull_request:
branches:
- main
- "*/main/**"
push:
branches:
- main
- "*/main/**"
release:
types: [published]

jobs:
build:
Expand Down Expand Up @@ -35,7 +45,7 @@ jobs:
os: ["linux", "darwin", "windows"]
arch: ["amd64", "arm64", "386"]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/v2')
needs: build

steps:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Code quality

on: [push, pull_request]
on:
pull_request:
branches:
- main
- "*/main/**"
push:
branches:
- main
- "*/main/**"

jobs:
linter:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/lintpr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ name: Lint Pull Request

on:
pull_request_target:
types:
- opened
- edited
- synchronize
types: [opened, edited, synchronize]

jobs:
lintpr:
Expand Down
6 changes: 6 additions & 0 deletions css-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
"WomzHWnDO_yFyjnkd49P": "desktopmodals-versionStatus-content",
"R83hOohwVshnd6bEkDO4": "desktopmodals-versionStatus-copyButton",
"YJMECPbMHWgMUs8RFdcV": "folder-folderPage-sectionWrapper",
"zogFp9G1AEqb8AKOd5B0": "GenericModal",
"I3zkdnuhFFrZ1Rr1BJhb": "GenericModal__overlay",
"cUwQnQoE3OqXqSYLT0hv": "link-subtle",
"VUXMMFKWudUWE1kIXZoS": "link-subtle",
"iKgf4UDhbRTHxmZSuAEc": "lyrics-lyrics-adLeaderboardIsEnabled",
Expand Down Expand Up @@ -1092,6 +1094,10 @@
"B1vgcMXBqOxgMxXh5j1f": "playback-progressbar-container",
"p1ULRzPc4bD8eQ4T_wyp": "playback-progressbar",
"DFtdzavKSbEhwKYkPTa6": "playback-progressbar-isInteractive",
"gItY2hnfCB4TsDJCkPiO": "player-controls",
"XrZ1iHVHAPMya3jkB2sa": "player-controls__buttons",
"NKUrT1GciYXAEEUtagN1": "player-controls__left",
"Qt226Z4rBQs53aedRQBQ": "player-controls__right",
"JzyZE2R09wq7xtjECDeR": "playlist-inlineSearchBox-clearButton",
"FeWwGSRANj36qpOBoxdx": "playlist-inlineSearchBox-filterInput",
"YAYCVnYpPvmYV4JyTmn5": "playlist-inlineSearchBox-filterInputContainer",
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ go 1.21
require (
github.com/go-ini/ini v1.67.0
github.com/mattn/go-colorable v0.1.13
golang.org/x/net v0.26.0
golang.org/x/net v0.27.0
)

require (
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/stretchr/testify v1.7.1 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
64 changes: 46 additions & 18 deletions jsHelper/spicetifyWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,55 @@ window.Spicetify = {
Platform: {}
};

(function waitForPlatform() {
if (!Spicetify._platform) {
setTimeout(waitForPlatform, 50);
return;
}
const { _platform } = Spicetify;
for (const key of Object.keys(_platform)) {
if (key.startsWith("get") && typeof _platform[key] === "function") {
Spicetify.Platform[key.slice(3)] = _platform[key]();
} else {
Spicetify.Platform[key] = _platform[key];
}
}

if (!Spicetify.Platform.Registry) Spicetify.Events.platformLoaded.fire();
})();

(function addMissingPlatformAPIs() {
if (!Spicetify.Platform?.version && !Spicetify.Platform?.Registry) {
setTimeout(addMissingPlatformAPIs, 50);
return;
}
const version = Spicetify.Platform.version.split(".").map(i => Number.parseInt(i));
if (version[0] === 1 && version[1] === 2 && version[2] < 38) return;

for (const [key, _] of Spicetify.Platform.Registry._map.entries()) {
if (typeof key?.description !== "string" || !key?.description.endsWith("API")) continue;
const symbolName = key.description;
if (Object.hasOwn(Spicetify.Platform, symbolName)) continue;
const resolvedAPI = Spicetify.Platform.Registry.resolve(key);
if (!resolvedAPI) {
console.warn(`[spicetifyWrapper] Failed to resolve PlatformAPI from Registry: ${symbolName}`);
continue;
}

Spicetify.Platform[symbolName] = resolvedAPI;
console.debug(`[spicetifyWrapper] Resolved PlatformAPI from Registry: ${symbolName}`);
}

if (Spicetify.Events.platformLoaded.callbacks.length) Spicetify.Events.platformLoaded.fire();
})();

(function addProxyCosmos() {
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 _cosmos = Spicetify.Player.origin?._cosmos ?? Spicetify.Platform?.Registry.resolve(Symbol.for("Cosmos"));

const corsProxyURL = "https://cors-proxy.spicetify.app";
const allowedMethodsMap = {
Expand All @@ -332,7 +374,9 @@ window.Spicetify = {
get: (target, prop, receiver) => {
const internalFetch = Reflect.get(target, prop, receiver);

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

return async function (url, body) {
const urlObj = new URL(url);
Expand Down Expand Up @@ -404,22 +448,6 @@ window.Spicetify = {
});
})();

(function waitForPlatform() {
if (!Spicetify._platform) {
setTimeout(waitForPlatform, 50);
return;
}
const { _platform } = Spicetify;
for (const key of Object.keys(_platform)) {
if (key.startsWith("get") && typeof _platform[key] === "function") {
Spicetify.Platform[key.slice(3)] = _platform[key]();
} else {
Spicetify.Platform[key] = _platform[key];
}
}
Spicetify.Events.platformLoaded.fire();
})();

(function hotloadWebpackModules() {
if (!window?.webpackChunkclient_web) {
setTimeout(hotloadWebpackModules, 50);
Expand Down

0 comments on commit 8c6e3cf

Please sign in to comment.