Skip to content

Commit

Permalink
filter existing svgs, improve regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ohitstom committed Nov 16, 2023
1 parent 4ac5571 commit 1d0cef6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions jsHelper/spicetifyWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,13 @@ window.Spicetify = {

// Get Interanl Spotify SVGs
const svgFunctions = functionModules.filter(m => m.toString().includes("svgContent"));
const svgContent16pxArray = svgFunctions
Spicetify.SVGIcons["misc"] = svgFunctions
.map(m => {
const match = m.toString().match(/<path d='([^']+)'/);
return match ? match[1] : null;
const match = m.toString().match(/size:16,svgContent:"(.*?)"/);
return match && !Object.values(Spicetify.SVGIcons).some(value => value.includes(match[1])) ? match[1] : null;
})
.filter(Boolean);

Spicetify.SVGIcons["misc"] = svgContent16pxArray;

Object.assign(Spicetify, {
React: cache.find(m => m?.useMemo),
ReactDOM: cache.find(m => m?.createPortal),
Expand Down

0 comments on commit 1d0cef6

Please sign in to comment.