Skip to content

Commit

Permalink
feat(BeatLeader): add watching & ReBeat images (#8899)
Browse files Browse the repository at this point in the history
* feat(BeatLeader): add watching & ReBeat images

* fix(BeatLeader): correct version bump
  • Loading branch information
joerkig authored Nov 21, 2024
1 parent d0f9c38 commit f25b305
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 16 deletions.
52 changes: 46 additions & 6 deletions websites/B/BeatLeader/assets.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
export const leaderboardImages: Record<string, string> = {
"360DegreeEasy":
"https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/1.png",
Expand Down Expand Up @@ -185,15 +186,54 @@ export const leaderboardImages: Record<string, string> = {
"https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/129.png",
Generated90Degree:
"https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/130.png",
ReBeatEasy: "https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/131.png",
ReBeatExpert:
ReBeat_StandardEasy:
"https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/131.png",
ReBeat_StandardExpert:
"https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/132.png",
ReBeatExpertPlus:
ReBeat_StandardExpertPlus:
"https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/133.png",
ReBeatHard: "https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/134.png",
ReBeatNormal:
ReBeat_StandardHard:
"https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/134.png",
ReBeat_StandardNormal:
"https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/135.png",
ReBeat: "https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/136.png",
ReBeat_Standard:
"https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/136.png",
ReBeat_OneSaberEasy: "https://i.imgur.com/5Ao6Xqq.png",
ReBeat_OneSaberExpert: "https://i.imgur.com/laT9Byr.png",
ReBeat_OneSaberExpertPlus: "https://i.imgur.com/88ISudR.png",
ReBeat_OneSaberHard: "https://i.imgur.com/SUg4WDo.png",
ReBeat_OneSaberNormal: "https://i.imgur.com/8fEe1vq.png",
ReBeat_OneSaber: "https://i.imgur.com/FLTtn7z.png",
ReBeat_90DegreeEasy: "https://i.imgur.com/HSYa4m5.png",
ReBeat_90DegreeExpert: "https://i.imgur.com/ErLBlF2.png",
ReBeat_90DegreeExpertPlus: "https://i.imgur.com/mlBeHct.png",
ReBeat_90DegreeHard: "https://i.imgur.com/huNP7Se.png",
ReBeat_90DegreeNormal: "https://i.imgur.com/gJ0q523.png",
ReBeat_90Degree: "https://i.imgur.com/WJ0rz55.png",
ReBeat_360DegreeEasy: "https://i.imgur.com/8dn3fRK.png",
ReBeat_360DegreeExpert: "https://i.imgur.com/tCTvxQF.png",
ReBeat_360DegreeExpertPlus: "https://i.imgur.com/l5dD7w5.png",
ReBeat_360DegreeHard: "https://i.imgur.com/03vakEt.png",
ReBeat_360DegreeNormal: "https://i.imgur.com/TOfdQV5.png",
ReBeat_360Degree: "https://i.imgur.com/6Y8KECM.png",
ReBeat_LawlessEasy: "https://i.imgur.com/IBVZSmU.png",
ReBeat_LawlessExpert: "https://i.imgur.com/cNqtIR6.png",
ReBeat_LawlessExpertPlus: "https://i.imgur.com/b9mUDTG.png",
ReBeat_LawlessHard: "https://i.imgur.com/Pqh3UxI.png",
ReBeat_LawlessNormal: "https://i.imgur.com/4TRkLD5.png",
ReBeat_Lawless: "https://i.imgur.com/ABh5ohg.png",
ReBeat_NoArrowsEasy: "https://i.imgur.com/6CXF00d.png",
ReBeat_NoArrowsExpert: "https://i.imgur.com/XuoU1Fs.png",
ReBeat_NoArrowsExpertPlus: "https://i.imgur.com/xYNMJIy.png",
ReBeat_NoArrowsHard: "https://i.imgur.com/KC9ltqt.png",
ReBeat_NoArrowsNormal: "https://i.imgur.com/J8neyyr.png",
ReBeat_NoArrows: "https://i.imgur.com/zvMIe8I.png",
ReBeat_LightshowEasy: "https://i.imgur.com/8VftlDI.png",
ReBeat_LightshowExpert: "https://i.imgur.com/RIghQr3.png",
ReBeat_LightshowExpertPlus: "https://i.imgur.com/dKfcDXI.png",
ReBeat_LightshowHard: "https://i.imgur.com/SYtY2af.png",
ReBeat_LightshowNormal: "https://i.imgur.com/ggYwNNt.png",
ReBeat_Lightshow: "https://i.imgur.com/HCQw79Z.png",
Easy: "https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/103.png",
Expert: "https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/104.png",
ExpertPlus: "https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/105.png",
Expand Down
2 changes: 1 addition & 1 deletion websites/B/BeatLeader/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"royale.beatleader.xyz"
],
"regExp": "beatleader\\.xyz|beatleader\\.net",
"version": "1.10.3",
"version": "1.11.0",
"logo": "https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/B/BeatLeader/assets/thumbnail.png",
"color": "#c81c9f",
Expand Down
18 changes: 9 additions & 9 deletions websites/B/BeatLeader/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ function simplifyKey(key: string): string {
result = result.replace("-PinkPlay_Controllable", "");
if (result.match(/(Horizontal|Vertical|Inverted|Inverse)/))
result = result.replace(/Lawless|OneSaber|NoArrows|Standard|Legacy/, "");
if (result.match(/ReBeat_/)) {
result = result.replace(
/(Lawless|OneSaber|NoArrows|Standard|Legacy|90Degree|360Degree)/,
""
);
result = result.replaceAll("_", "");
}
return result;
}

Expand Down Expand Up @@ -119,11 +112,13 @@ presence.on("UpdateData", async () => {
};

if (hostname.split(".")[0] === "replay") {
presenceData.type = ActivityType.Watching;
presenceData.name = "BL Replay";
presenceData.largeImageKey = cover
? document.querySelector<HTMLImageElement>("#songImage")
: replayIcon;
presenceData.details = document.querySelector("#songName").textContent;
presenceData.state = document.querySelector("#playerName").textContent;
presenceData.details = document.querySelector("#songName")?.textContent;
presenceData.state = document.querySelector("#playerName")?.textContent;
presenceData.smallImageKey = document.querySelector("div.btn.play")
? Assets.Pause
: Assets.Play;
Expand All @@ -148,6 +143,8 @@ presence.on("UpdateData", async () => {
},
];
} else if (hostname.split(".")[0] === "royale") {
presenceData.type = ActivityType.Watching;
presenceData.name = "BL Royale";
presenceData.largeImageKey = cover
? document.querySelector<HTMLImageElement>("#songImage")
: replayIcon;
Expand Down Expand Up @@ -353,6 +350,8 @@ presence.on("UpdateData", async () => {
?.src.includes("replay.beatleader.") &&
replay.name
) {
presenceData.type = ActivityType.Watching;
presenceData.name = "BL Replay";
presenceData.largeImageKey = cover ? replay.cover : replayIcon;
presenceData.details = replay.name;
presenceData.state = replay.playerName;
Expand Down Expand Up @@ -384,6 +383,7 @@ presence.on("UpdateData", async () => {
delete presenceData.startTimestamp;
delete presenceData.endTimestamp;
}

if (!buttons && presenceData.buttons) delete presenceData.buttons;

if (presenceData.details && presenceData.largeImageKey)
Expand Down

0 comments on commit f25b305

Please sign in to comment.