Skip to content

Commit

Permalink
Merge branch 'master' into posh2
Browse files Browse the repository at this point in the history
  • Loading branch information
SunsetTechuila authored Nov 19, 2023
2 parents ca77c77 + 01fbdfb commit 6dce590
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 32 deletions.
39 changes: 36 additions & 3 deletions css-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@
"TbrIq3NG2VYFoAUMSmp9": "view-homeShortcutsGrid-nameWrapper",
"jb9xD5ECTqKFK02qe3HZ": "view-homeShortcutsGrid-shortcutLink",
"Kcb74zm1aMqGfPxTwO5s": "view-homeShortcutsGrid-PlayButtonContainer",
"jxXIarsEHgz2HoaVCVzA": "view-homeShortcutsGrid-playingIcon",
"jxXIarsEHgz2HoaVCVzA": "view-homeShortcutsGrid-equaliser",
"HbKLiGoYM4dpuK8L4TMX": "x-downloadButton-button",
"wCl7pMTEE68v1xuZeZiB": "x-filterBox-expandButton",
"QZhV0hWVKlExlKr266jo": "x-filterBox-filterInput",
Expand Down Expand Up @@ -1911,7 +1911,7 @@
"dsrNi2znflb0fuUnhzfp": "main-shelf-titleWithIcon",
"Oq5wiHCwgjjMg_VYy068": "main-topBar-fullscreenHistoryButtons",
"sNde2kloCY28V4GB9AvP": "main-topBar-topNavBarLinks",
"k0vXhOdr0XE83lAQaJ1O": "main-topBar-topNavBarSeperator",
"k0vXhOdr0XE83lAQaJ1O": "main-topBar-topNavBarSeparator",
"LKFFk88SIRC9QKKUWR5u": "main-topBar-loginButtons",
"sibxBMlr_oxWTfBrEz2G": "main-topBar-signupButton",
"jsV182e49Puwz9SIYt2J": "main-trackList-text",
Expand Down Expand Up @@ -2515,5 +2515,38 @@
"k9LEjzjnGgVaEm3BvhAb": "main-entityHeader-largeHeader",
"_osiFNXU9Cy1X0CYaU9Z": "main-entityHeader-imageContainerNew",
"zjsGbrMpvbdA1HJ4rpfi": "main-entityHeader-smallMadeForIcon",
"A3ohAQNHsDIMv2EM3Ytp": "lyrics-lyricsContent-text"
"A3ohAQNHsDIMv2EM3Ytp": "lyrics-lyricsContent-text",
"aAYpzGljXQv1_zfopxaH": "main-card-cardContainer",
"llTZj1tjDr5ZnIOkKdHv": "main-contextMenu-menuItemStatic",
"abJqsjKClbniwiTCZ7bC": "main-contextMenu-subMenuLeading",
"uEPiT_llP0oFNDYu_QZR": "main-contextMenu-loadingContainer",
"ExGt4YQfmcwvVFGM7tpN": "main-contextMenu-trigger",
"lp9Tfm4rsM9_pfbIE0zd": "main-entityHeader-pretitle",
"YW4dYEf5ZuLzMfSjsqZk": "main-entityHeader-piled",
"sLw5dxB32cAxVxqiar7J": "view-homeShortcutsGrid-title",
"jdqzCrz9SoQp3ZUsU08w": "view-homeShortcutsGrid-gridOf4Columns",
"DqAHiYCkcPCcDorezUKI": "view-homeShortcutsGrid-recentlyPlayedShortcutIcon",
"EzRmGRncgnv1zFgF4dqE": "view-homeShortcutsGrid-name",
"bPmmKmSPLKMhtJSaUJRX": "view-homeShortcutsGrid-shortcutNewEpisodeIndicator",
"vpQWUBWS_lXRLZMRJT7w": "view-homeShortcutsGrid-episodeExtraContent",
"GSv7K805J9Jw7LB9tn2A": "view-homeShortcutsGrid-episodeProgressBar",
"s9c9x_mJq197U2hBzGtV": "view-homeShortcutsGrid-PlayButtonContainerVisible",
"vq0lsCoYrDUDvkuUIaRg": "view-homeShortcutsGrid-playButton",
"Sdmk6QLCvk5EuAP54IN5": "main-shelf-shelfGridResponsive",
"PodseQtNc4pWHyOfGkgA": "main-shelf-shelfGridResponsiveMultiRows",
"ixZyJJ3SHxsSb3NHkhWn": "main-trackList-trackListCompactMode",
"bnolo3jJ8KBxI6jyN7bD": "main-trackList-rowFeedback",
"B2Dwok3Y07k2ttjGDssH": "main-trackList-queuePanelTracklist",
"vDk3w0iWhhczk8PS_K3B": "main-trackList-isRecommendedTrackListRow",
"KJeaWI3jCZemsmu4eYL3": "main-trackList-curationButton",
"UeRAfdSphrPaohh2HWmB": "main-trackList-rowCompactMode",
"gQnx5tArze5q1wfG6AWJ": "main-trackList-rowMainContentCompact",
"nEZjuVeUuGSmYaQWgXTd": "main-trackList-ownedBySelf",
"vL_PgycspyjCBwfFg9j9": "main-trackList-eventVenue",
"rTTxX5loXbtazDI0NLAj": "artist-artistOnTour-eventName",
"QbD9zl7z3AhEQu_TGmo8": "main-home-subfeedSection",
"Cjga8q3TFvtKCu9qfm27": "main-contextMenu-menuItemStatic",
"wtEUrk4Sxa5e3QZhvbrs": "main-contextMenu-subMenuLeading",
"ibA08TpSVrM0wThmotVd": "main-contextMenu-loadingContainer",
"zL6hQR4mukVUUQaa_7K1": "main-nowPlayingView-coverArtContainer"
}
91 changes: 71 additions & 20 deletions jsHelper/spicetifyWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ window.Spicetify = {
"ButtonPrimary",
"ButtonSecondary",
"ButtonTertiary",
"Snackbar"
"Snackbar",
"Chip"
];

const REACT_HOOK = ["DragHandler", "usePanelState", "useExtractedColor"];
Expand Down Expand Up @@ -412,6 +413,7 @@ window.Spicetify = {
ctaText: functionModules.find(m => m.toString().includes("ctaText")),
styledImage: functionModules.find(m => m.toString().includes("placeholderSrc"))
},
Chip: modules.find(m => m?.render?.toString().includes("invertedDark") && m?.render?.toString().includes("isUsingKeyboard")),
...Object.fromEntries(menus)
},
ReactHook: {
Expand Down Expand Up @@ -952,7 +954,7 @@ Spicetify.SVGIcons = {
car: '<path d="M2.92 2.375A2.75 2.75 0 015.303 1h5.395c.983 0 1.89.524 2.382 1.375L14.017 4h1.233a.75.75 0 010 1.5h-.237c.989.9.988 2.117.987 2.707v7.043a.75.75 0 01-.75.75h-1.5a.75.75 0 01-.75-.75V14H3v1.25a.75.75 0 01-.75.75H.75a.75.75 0 01-.75-.75V8.207C0 7.617-.002 6.4.987 5.5H.75a.75.75 0 010-1.5h1.233l.938-1.625zm2.382.125c-.446 0-.859.238-1.082.625L3.137 5h9.726L11.78 3.125a1.25 1.25 0 00-1.083-.625H5.302zm8.57 4H2.128a2.72 2.72 0 01-.055.046c-.473.377-.556.894-.57 1.454h2.429a1 1 0 011 1v.5H1.5v3h13v-3h-3.43V9a1 1 0 011-1h2.427c-.013-.56-.096-1.077-.569-1.454a2.585 2.585 0 01-.055-.046z"/>',
"chart-down": '<path d="M3 6l5 5.794L13 6z"/>',
"chart-up": '<path d="M13 10L8 4.206 3 10z"/>',
check: '<path d="M13.985 2.383L5.127 12.754 1.388 8.375l-.658.77 4.397 5.149 9.618-11.262z"/>',
check: '<path d="M15.53 2.47a.75.75 0 0 1 0 1.06L4.907 14.153.47 9.716a.75.75 0 0 1 1.06-1.06l3.377 3.376L14.47 2.47a.75.75 0 0 1 1.06 0z"/>',
"check-alt-fill":
'<path d="M7.5 0C3.354 0 0 3.354 0 7.5S3.354 15 7.5 15 15 11.646 15 7.5 11.646 0 7.5 0zM6.246 12.086l-3.16-3.707 1.05-1.232 2.111 2.464 4.564-5.346 1.221 1.05-5.786 6.771z"/><path fill="none" d="M0 0h16v16H0z"/>',
"chevron-left": '<path d="M11.521 1.38l-.65-.76L2.23 8l8.641 7.38.65-.76L3.77 8z"/>',
Expand Down Expand Up @@ -1128,26 +1130,32 @@ Spicetify.SVGIcons = {
})();

class _HTMLContextMenuItem extends HTMLLIElement {
constructor({ name, disabled = false, icon = undefined, divider = false }) {
constructor({ name, disabled = false, icon = undefined, trailingIcon = undefined, divider = false }) {
super();
this.name = name;
this.icon = icon || "";
this.icon = icon;
this.trailingIcon = trailingIcon;
this.disabled = disabled;
this.divider = divider;
this.classList.add("main-contextMenu-menuItem");
}

render() {
let icon = this.icon;
if (icon && Spicetify.SVGIcons[icon]) {
icon = `<svg height="16" width="16" viewBox="0 0 16 16" fill="currentColor">${Spicetify.SVGIcons[icon]}</svg>`;
}
const parseIcon = icon => {
if (icon && Spicetify.SVGIcons[icon]) {
return `<svg height="16" width="16" viewBox="0 0 16 16" fill="currentColor">${Spicetify.SVGIcons[icon]}</svg>`;
}
return icon || "";
};

this.innerHTML = `
<button class="main-contextMenu-menuItemButton ${this.disabled ? "main-contextMenu-disabled" : ""} ${
<button class="main-contextMenu-menuItemButton ${this.disabled ? "main-contextMenu-disabled" : ""} ${
this.divider ? "main-contextMenu-dividerAfter" : ""
}">
<span class="ellipsis-one-line main-type-mesto" dir="auto">${this.name}</span>
${icon || ""}
</button>`;
${parseIcon(this.icon)}
<span class="ellipsis-one-line main-type-mesto main-contextMenu-menuItemLabel">${this.name}</span>
${parseIcon(this.trailingIcon)}
</button>`;
}

connectedCallback() {
Expand Down Expand Up @@ -1260,7 +1268,7 @@ Spicetify.Menu = (function () {
};

class Item {
constructor(name, isEnabled, onClick, icon = undefined) {
constructor(name, isEnabled, onClick, icon = "") {
this._name = name;
this._isEnabled = isEnabled;
this._icon = icon;
Expand All @@ -1269,13 +1277,14 @@ Spicetify.Menu = (function () {
};
this._element = new _HTMLContextMenuItem({
name: name,
icon: isEnabled ? "check" : icon ?? ""
icon: icon,
trailingIcon: isEnabled ? "check" : ""
});
}

setState(isEnabled) {
this._isEnabled = isEnabled;
this._element.update("icon", isEnabled ? "check" : this._icon ?? "");
this._element.update("trailingIcon", isEnabled ? "check" : "");
}
set isEnabled(bool) {
this.setState(bool);
Expand Down Expand Up @@ -1315,12 +1324,17 @@ Spicetify.Menu = (function () {
}

class SubMenu {
constructor(name, items) {
constructor(name, items, icon, trailingIcon) {
this._name = name;
this._items = new Set(items);
this._icon = icon;
this._trailingIcon = trailingIcon;
this._element = new _HTMLContextMenuItem({
name: name,
icon: `<svg role="img" height="16" width="16" fill="currentColor" class="main-contextMenu-subMenuIcon" viewBox="0 0 16 16"><path d="M13 10L8 4.206 3 10z"></path></svg>`
icon: icon,
trailingIcon:
trailingIcon ||
'<span><svg role="img" height="16" width="16" fill="currentColor" class="main-contextMenu-subMenuIcon" viewBox="0 0 16 16"><path d="M14 10 8 4l-6 6h12z"></path></svg></span>'
});
}

Expand All @@ -1342,6 +1356,28 @@ Spicetify.Menu = (function () {
this._items.delete(item);
}

setIcon(icon) {
this._icon = icon;
this._element.update("icon", icon);
}
set icon(icon) {
this.setIcon(icon);
}
get icon() {
return this._icon;
}

setTrailingIcon(trailingIcon) {
this._trailingIcon = trailingIcon;
this._element.update("trailingIcon", trailingIcon);
}
set trailingIcon(trailingIcon) {
this.setTrailingIcon(trailingIcon);
}
get trailingIcon() {
return this._trailingIcon;
}

register() {
collection.add(this);
}
Expand All @@ -1358,15 +1394,17 @@ Spicetify.ContextMenu = (function () {
const iconList = Object.keys(Spicetify.SVGIcons);

class Item {
constructor(name, onClick, shouldAdd = uris => true, icon = undefined, disabled = false) {
constructor(name, onClick, shouldAdd = uris => true, icon = "", trailingIcon = "", disabled = false) {
this.onClick = onClick;
this.shouldAdd = shouldAdd;
this._name = name;
this._icon = icon;
this._trailingIcon = trailingIcon;
this._disabled = disabled;
this._element = new _HTMLContextMenuItem({
name: name,
icon: icon,
trailingIcon: trailingIcon,
disabled: disabled
});
}
Expand All @@ -1386,6 +1424,14 @@ Spicetify.ContextMenu = (function () {
return this._icon;
}

set trailingIcon(name) {
this._trailingIcon = name;
this._element.update("trailingIcon", name);
}
get trailingIcon() {
return this._trailingIcon;
}

set disabled(bool) {
this._disabled = bool;
this._element.update("disabled", bool);
Expand All @@ -1405,14 +1451,19 @@ Spicetify.ContextMenu = (function () {
Item.iconList = iconList;

class SubMenu {
constructor(name, items, shouldAdd = uris => true, disabled = false) {
constructor(name, items, shouldAdd = uris => true, disabled = false, icon = "", trailingIcon = "") {
this._items = new Set(items);
this.shouldAdd = shouldAdd;
this._name = name;
this._disabled = disabled;
this._icon = icon;
this._trailingIcon = trailingIcon;
this._element = new _HTMLContextMenuItem({
name: name,
icon: `<svg role="img" height="16" width="16" fill="currentColor" class="main-contextMenu-subMenuIcon" viewBox="0 0 16 16"><path d="M13 10L8 4.206 3 10z"></path></svg>`,
icon: icon,
trailingIcon:
trailingIcon ||
'<span><svg role="img" height="16" width="16" fill="currentColor" class="main-contextMenu-subMenuIcon" viewBox="0 0 16 16"><path d="M14 10 8 4l-6 6h12z"></path></svg></span>',
disabled: disabled
});
}
Expand Down
9 changes: 0 additions & 9 deletions src/cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
"strings"

backupstatus "github.com/spicetify/spicetify-cli/src/status/backup"
"github.com/spicetify/spicetify-cli/src/utils"
)

Expand Down Expand Up @@ -106,13 +104,6 @@ func Update(currentVersion string) bool {
utils.CheckExistAndDelete(exeOld)
utils.PrintGreen("OK")
utils.PrintSuccess("spicetify is up-to-date.")
backupVersion := backupSection.Key("version").MustString("")
backStat := backupstatus.Get(prefsPath, backupFolder, backupVersion)
cmd := []string{"spicetify", "backup", "apply"}
if !backStat.IsOutdated() {
cmd = append(cmd[:1], append([]string{"restore"}, cmd[1:]...)...)
}
utils.PrintInfo(`Please run "` + strings.Join(cmd, " ") + `" to receive new features and bug fixes`)
return true
}

Expand Down

0 comments on commit 6dce590

Please sign in to comment.