mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-21 04:17:01 -04:00
tidal embeds plugin (#284)
* tidal embeds plugin * Fix Patch * Bleh --------- Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
parent
959622c634
commit
c540a515f4
1 changed files with 47 additions and 0 deletions
47
src/equicordplugins/tidalEmbeds/index.tsx
Normal file
47
src/equicordplugins/tidalEmbeds/index.tsx
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2025 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { EquicordDevs } from "@utils/constants";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "TidalEmbeds",
|
||||||
|
description: "Embeds TIDAL songs to make them playable in Discord.",
|
||||||
|
authors: [EquicordDevs.vmohammad],
|
||||||
|
dependencies: ["MessageUpdaterAPI"],
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: "}renderEmbeds(",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=renderEmbeds\(\i\){.+?embeds\.map\(\((\i),\i\)?=>{)/,
|
||||||
|
replace: '$&if($1?.provider?.name === "TIDAL")return null;'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
renderMessageAccessory({ message }) {
|
||||||
|
const tidalEmbed = message.embeds?.find(embed => embed.provider?.name === "TIDAL");
|
||||||
|
if (!tidalEmbed) return null;
|
||||||
|
const songId = tidalEmbed?.url?.split("/").pop().split("?")[0];
|
||||||
|
if (!songId) {
|
||||||
|
console.warn("Tidal embed found without song ID", tidalEmbed);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div className="tidal-embed">
|
||||||
|
<iframe
|
||||||
|
src={`https://embed.tidal.com/tracks/${songId}?disableAnalytics=true`}
|
||||||
|
width="500"
|
||||||
|
height="120"
|
||||||
|
allow="encrypted-media"
|
||||||
|
sandbox="allow-same-origin allow-scripts allow-forms allow-popups"
|
||||||
|
title="TIDAL Embed Player"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue