mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-13 08:33:01 -04:00
Make BetterActivites Use Spotify Album Art
This commit is contained in:
parent
a1c19e6990
commit
c3b82dc6ee
3 changed files with 9 additions and 16 deletions
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { SVGProps } from "react";
|
||||
|
||||
export function SpotifyIcon(props: SVGProps<SVGSVGElement>) {
|
||||
return (<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" {...props}><path fill="#1ed760" d="M128 0C57.308 0 0 57.309 0 128c0 70.696 57.309 128 128 128c70.697 0 128-57.304 128-128C256 57.314 198.697.007 127.998.007zm58.699 184.614c-2.293 3.76-7.215 4.952-10.975 2.644c-30.053-18.357-67.885-22.515-112.44-12.335a7.981 7.981 0 0 1-9.552-6.007a7.968 7.968 0 0 1 6-9.553c48.76-11.14 90.583-6.344 124.323 14.276c3.76 2.308 4.952 7.215 2.644 10.975m15.667-34.853c-2.89 4.695-9.034 6.178-13.726 3.289c-34.406-21.148-86.853-27.273-127.548-14.92c-5.278 1.594-10.852-1.38-12.454-6.649c-1.59-5.278 1.386-10.842 6.655-12.446c46.485-14.106 104.275-7.273 143.787 17.007c4.692 2.89 6.175 9.034 3.286 13.72zm1.345-36.293C162.457 88.964 94.394 86.71 55.007 98.666c-6.325 1.918-13.014-1.653-14.93-7.978c-1.917-6.328 1.65-13.012 7.98-14.935C93.27 62.027 168.434 64.68 215.929 92.876c5.702 3.376 7.566 10.724 4.188 16.405c-3.362 5.69-10.73 7.565-16.4 4.187z"></path></svg>);
|
||||
}
|
|
@ -10,7 +10,6 @@ import { React, Tooltip } from "@webpack/common";
|
|||
import { JSX } from "react";
|
||||
|
||||
import { ActivityTooltip } from "../components/ActivityTooltip";
|
||||
import { SpotifyIcon } from "../components/SpotifyIcon";
|
||||
import { TwitchIcon } from "../components/TwitchIcon";
|
||||
import { settings } from "../settings";
|
||||
import { ActivityListIcon, ActivityListProps, ApplicationIcon, IconCSSProperties } from "../types";
|
||||
|
@ -57,7 +56,6 @@ export function patchActivityList({ activities, user, hideTooltip }: ActivityLis
|
|||
}
|
||||
};
|
||||
addActivityIcon("Twitch", TwitchIcon);
|
||||
addActivityIcon("Spotify", SpotifyIcon);
|
||||
|
||||
if (icons.length) {
|
||||
const iconStyle: IconCSSProperties = {
|
||||
|
|
|
@ -39,11 +39,11 @@ export function getActivityApplication(activity: Activity | null) {
|
|||
|
||||
export function getApplicationIcons(activities: Activity[], preferSmall = false): ApplicationIcon[] {
|
||||
const applicationIcons: ApplicationIcon[] = [];
|
||||
const applications = activities.filter(activity => activity.application_id || activity.platform);
|
||||
const applications = activities.filter(activity => activity.application_id || activity.platform || activity.id.startsWith("spotify:"));
|
||||
|
||||
for (const activity of applications) {
|
||||
const { assets, application_id, platform } = activity;
|
||||
if (!application_id && !platform) continue;
|
||||
const { assets, application_id, platform, id } = activity;
|
||||
if (!application_id && !platform && !id.startsWith("spotify:")) continue;
|
||||
|
||||
if (assets) {
|
||||
const { small_image, small_text, large_image, large_text } = assets;
|
||||
|
@ -59,6 +59,12 @@ export function getApplicationIcons(activities: Activity[], preferSmall = false)
|
|||
activity
|
||||
});
|
||||
}
|
||||
} else if (image.startsWith("spotify:")) {
|
||||
const url = `https://i.scdn.co/image/${image.split(":")[1]}`;
|
||||
applicationIcons.push({
|
||||
image: { src: url, alt },
|
||||
activity
|
||||
});
|
||||
} else {
|
||||
const src = `https://cdn.discordapp.com/app-assets/${application_id}/${image}.png`;
|
||||
applicationIcons.push({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue