decord/alpha/source/modules/spotify/SpotifyConstants.tsx

111 lines
4.2 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 8442
// Function ID: 8443
// Name: SpotifyConstants
2026-10-09 10:00:15 +00:00
// Dependencies: [1085, 5760, 1382, 2]
2026-07-20 16:05:17 +00:00
// Exports: getSpotifyResourceType, isSpotifyParty
2026-10-09 10:00:15 +00:00
// Module 8442 (SpotifyConstants)
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
2026-10-09 10:00:15 +00:00
import Platforms from "Platforms" /* 5760 */;
import PlatformUtils from "PlatformUtils" /* 1382 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let str;
2026-07-29 08:29:29 +00:00
const spotify = "spotify";
let c1 = "spotify:";
2026-10-03 08:58:59 +00:00
const PlatformTypes = Constants.PlatformTypes;
const SpotifyResourceTypes = { TRACK: "track", ARTIST: "artist", ALBUM: "album", PLAYLIST: "playlist", EPISODE: "episode", SHOW: "show" };
const obj2 = {
2026-08-24 06:08:38 +00:00
PROFILE: "" + "https://api.spotify.com/v1" + "/me",
NOTIFICATIONS_PLAYER: "" + "https://api.spotify.com/v1" + "/me/notifications/player",
PLAYER: "" + "https://api.spotify.com/v1" + "/me/player",
PLAYER_DEVICES: "" + "https://api.spotify.com/v1" + "/me/player/devices",
PLAYER_PLAY: "" + "https://api.spotify.com/v1" + "/me/player/play",
PLAYER_PAUSE: "" + "https://api.spotify.com/v1" + "/me/player/pause",
PLAYER_REPEAT: "" + "https://api.spotify.com/v1" + "/me/player/repeat",
WEB_OPEN(ALBUM, album_id, mobile) {
let str = mobile;
if (mobile === undefined) {
str = "desktop";
}
const encodeURIComponentResult = encodeURIComponent(ALBUM);
2026-10-03 08:58:59 +00:00
const encodeURIComponentResult1 = encodeURIComponent(album_id);
return "https://open.spotify.com/" + encodeURIComponentResult + "/" + encodeURIComponentResult1 + "?utm_source=discord&utm_medium=" + str;
2026-08-24 06:08:38 +00:00
},
IMAGE(arg0) {
return "https://i.scdn.co/image/" + encodeURIComponent(arg0);
},
2026-08-24 06:08:38 +00:00
EMBED(arg0) {
let str = arg1;
if (arg1 === undefined) {
str = "desktop";
}
return "https://open.spotify.com/embed" + arg0 + "?utm_source=discord&utm_medium=" + str;
},
PLAYER_OPEN(TRACK, sync_id, arg2, mobile) {
2026-08-24 06:08:38 +00:00
let flag = arg2;
if (arg2 === undefined) {
flag = true;
}
let str = mobile;
if (mobile === undefined) {
str = "desktop";
}
2026-10-03 08:58:59 +00:00
let str2 = "";
2026-08-24 06:08:38 +00:00
const encodeURIComponentResult = encodeURIComponent(TRACK);
2026-10-03 08:58:59 +00:00
const encodeURIComponentResult1 = encodeURIComponent(sync_id);
2026-08-24 06:08:38 +00:00
const tmp = spotify;
if (flag) {
const _HermesInternal = HermesInternal;
str2 = "?utm_source=discord&utm_medium=" + str;
}
2026-10-03 08:58:59 +00:00
return "" + tmp + ":" + encodeURIComponentResult + ":" + encodeURIComponentResult1 + str2;
2026-08-24 06:08:38 +00:00
},
WEB_HOME: "https://open.spotify.com/" + "?utm_source=discord&utm_medium=" + "desktop",
2026-08-24 06:08:38 +00:00
PREMIUM_SITE: "https://www.spotify.com/premium/" + "?utm_source=discord&utm_medium=" + "desktop",
INSTALL_ATTRIBUTION(Identifier) {
return "https://app.adjust.com/bdyga9?campaign=" + Identifier;
},
2026-10-03 08:58:59 +00:00
APP_STORE: str,
2026-08-24 06:08:38 +00:00
IOS_APP_STORE: "https://itunes.apple.com/us/app/spotify-music/id324684580?mt=8"
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
const name = Platforms.get(PlatformTypes.SPOTIFY).name;
const _Object = Object;
str = "https://itunes.apple.com/us/app/spotify-music/id324684580?mt=8";
if (PlatformUtils.isAndroid()) {
2026-07-20 16:05:17 +00:00
str = "https://play.google.com/store/apps/details?id=com.spotify.music&hl=en_US&gl=US";
}
2026-10-03 08:58:59 +00:00
const freezeResult = freeze(obj2);
const result = size.fileFinishedImporting("modules/spotify/SpotifyConstants.tsx");
2026-07-20 16:05:17 +00:00
export const SPOTIFY_APP_PROTOCOL = "spotify";
export const SPOTIFY_PARTY_PREFIX = "spotify:";
2026-10-03 08:58:59 +00:00
export const SPOTIFY_PLATFORM_NAME = name;
2026-07-20 16:05:17 +00:00
export const isSpotifyParty = function isSpotifyParty(id) {
2026-10-03 08:58:59 +00:00
const startsWithResult = null != id && id.startsWith(c1);
2026-07-20 16:05:17 +00:00
return startsWithResult;
};
export { SpotifyResourceTypes };
2026-07-20 16:05:17 +00:00
export const SpotifyActionTypes = { USER_ACTIVITY_PLAY: "user_activity_play", USER_ACTIVITY_SYNC: "user_activity_sync", EMBED_SYNC: "embed_sync" };
2026-07-23 10:11:24 +00:00
export const SPOTIFY_HOSTNAMES = ["open.spotify.com", "www.spotify.com"];
2026-10-03 08:58:59 +00:00
export const SpotifyEndpoints = freezeResult;
2026-08-04 21:03:28 +00:00
export const getSpotifyResourceType = function getSpotifyResourceType(str) {
if (typeof str !== "string") {
2026-07-20 16:05:17 +00:00
return null;
2026-08-04 21:03:28 +00:00
} else if ("track" === str) {
2026-07-20 16:05:17 +00:00
return obj.TRACK;
2026-08-04 21:03:28 +00:00
} else if ("artist" === str) {
2026-07-20 16:05:17 +00:00
return obj.ARTIST;
2026-08-04 21:03:28 +00:00
} else if ("album" === str) {
2026-07-20 16:05:17 +00:00
return obj.ALBUM;
2026-08-04 21:03:28 +00:00
} else if ("playlist" === str) {
2026-07-20 16:05:17 +00:00
return obj.PLAYLIST;
2026-08-04 21:03:28 +00:00
} else if ("episode" === str) {
2026-07-20 16:05:17 +00:00
return obj.EPISODE;
2026-08-04 21:03:28 +00:00
} else if ("show" === str) {
2026-07-20 16:05:17 +00:00
return obj.SHOW;
} else {
return null;
}
};