decord/stable/source/modules/spotify/SpotifyConstants.tsx
github-actions 57c2214117 chore: update source for stable 347.12
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
2026-09-29 21:26:22 +00:00

103 lines
3.8 KiB
TypeScript

// Module ID: 8643
// Function ID: 8644
// Name: SpotifyConstants
// Dependencies: [1074, 5532, 1364, 2]
// Exports: getSpotifyResourceType, isSpotifyParty
// Module 8643 (SpotifyConstants)
import Platforms from "Platforms" /* 5532 */;
const spotify = "spotify";
let c1 = "spotify:";
const SpotifyResourceTypes = { TRACK: "track", ARTIST: "artist", ALBUM: "album", PLAYLIST: "playlist", EPISODE: "episode", SHOW: "show" };
const obj2 = {
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);
return "https://open.spotify.com/" + encodeURIComponentResult + "/" + encodeURIComponent(album_id) + "?utm_source=discord&utm_medium=" + str;
},
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) {
let flag = arg2;
if (arg2 === undefined) {
flag = true;
}
let str = mobile;
if (mobile === undefined) {
str = "desktop";
}
const encodeURIComponentResult = encodeURIComponent(TRACK);
const tmp = spotify;
let str2 = "";
if (flag) {
const _HermesInternal = HermesInternal;
str2 = "?utm_source=discord&utm_medium=" + str;
}
return "" + tmp + ":" + encodeURIComponentResult + ":" + encodeURIComponent(sync_id) + str2;
},
PREMIUM_SITE: "https://www.spotify.com/premium/" + "?utm_source=discord&utm_medium=" + "desktop",
INSTALL_ATTRIBUTION(Identifier) {
return "https://app.adjust.com/bdyga9?campaign=" + Identifier;
},
APP_STORE: null,
IOS_APP_STORE: "https://itunes.apple.com/us/app/spotify-music/id324684580?mt=8"
};
const PlatformUtils = fn(1364);
let str = "https://itunes.apple.com/us/app/spotify-music/id324684580?mt=8";
if (PlatformUtils.isAndroid()) {
str = "https://play.google.com/store/apps/details?id=com.spotify.music&hl=en_US&gl=US";
}
obj2.APP_STORE = str;
const frozen = Object.freeze(obj2);
const size = fn(2);
const result = size.fileFinishedImporting("modules/spotify/SpotifyConstants.tsx");
export const SPOTIFY_APP_PROTOCOL = "spotify";
export const SPOTIFY_PARTY_PREFIX = "spotify:";
export const SPOTIFY_PLATFORM_NAME = Platforms.get(fn(1074).PlatformTypes.SPOTIFY).name;
export const isSpotifyParty = function isSpotifyParty(id) {
let startsWithResult = null != id;
if (startsWithResult) {
startsWithResult = id.startsWith(c1);
}
return startsWithResult;
};
export { SpotifyResourceTypes };
export const SpotifyActionTypes = { USER_ACTIVITY_PLAY: "user_activity_play", USER_ACTIVITY_SYNC: "user_activity_sync", EMBED_SYNC: "embed_sync" };
export const SPOTIFY_HOSTNAMES = ["open.spotify.com", "www.spotify.com"];
export const SpotifyEndpoints = frozen;
export const getSpotifyResourceType = function getSpotifyResourceType(str) {
if (typeof str !== "string") {
return null;
} else if ("track" === str) {
return obj.TRACK;
} else if ("artist" === str) {
return obj.ARTIST;
} else if ("album" === str) {
return obj.ALBUM;
} else if ("playlist" === str) {
return obj.PLAYLIST;
} else if ("episode" === str) {
return obj.EPISODE;
} else if ("show" === str) {
return obj.SHOW;
} else {
return null;
}
};