mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-21 04:17:01 -04:00
feat(jellyfinRichPresence): Add Dynamic ActivityType & Override (#288)
* feat(jellyfinRichPresence): add dynamic ActivityType, aswell as an override * Update pnpm-lock.yaml * Fixes * Fix Default --------- Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
parent
7c661139d5
commit
dd6920d20a
1 changed files with 43 additions and 1 deletions
|
@ -65,6 +65,33 @@ const settings = definePluginSettings({
|
||||||
description: "Jellyfin user ID obtained from your user profile URL",
|
description: "Jellyfin user ID obtained from your user profile URL",
|
||||||
type: OptionType.STRING,
|
type: OptionType.STRING,
|
||||||
},
|
},
|
||||||
|
overrideRichPresenceType: {
|
||||||
|
description: "Override the rich presence type",
|
||||||
|
type: OptionType.SELECT,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "Off",
|
||||||
|
value: false,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Listening",
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Playing",
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Streaming",
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Watching",
|
||||||
|
value: 3
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const applicationId = "1381368130164625469";
|
const applicationId = "1381368130164625469";
|
||||||
|
@ -169,9 +196,24 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
async getActivity(): Promise<Activity | null> {
|
async getActivity(): Promise<Activity | null> {
|
||||||
|
let richPresenceType;
|
||||||
|
|
||||||
const mediaData = await this.fetchMediaData();
|
const mediaData = await this.fetchMediaData();
|
||||||
if (!mediaData) return null;
|
if (!mediaData) return null;
|
||||||
|
|
||||||
|
if (settings.store.overrideRichPresenceType) {
|
||||||
|
richPresenceType = settings.store.overrideRichPresenceType;
|
||||||
|
} else {
|
||||||
|
switch (mediaData.type) {
|
||||||
|
case "Audio":
|
||||||
|
richPresenceType = 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
richPresenceType = 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const largeImage = mediaData.imageUrl;
|
const largeImage = mediaData.imageUrl;
|
||||||
const assets: ActivityAssets = {
|
const assets: ActivityAssets = {
|
||||||
large_image: largeImage ? await getApplicationAsset(largeImage) : await getApplicationAsset("jellyfin"),
|
large_image: largeImage ? await getApplicationAsset(largeImage) : await getApplicationAsset("jellyfin"),
|
||||||
|
@ -208,7 +250,7 @@ export default definePlugin({
|
||||||
assets,
|
assets,
|
||||||
timestamps,
|
timestamps,
|
||||||
|
|
||||||
type: 3,
|
type: richPresenceType,
|
||||||
flags: 1,
|
flags: 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue