Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Proxer): add watch type #8803

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion websites/P/Proxer/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"nl": "Gratis en open Duitse Anime-community"
},
"url": "proxer.me",
"version": "1.0.22",
"version": "1.0.23",
"logo": "https://cdn.rcd.gg/PreMiD/websites/P/Proxer/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/P/Proxer/assets/thumbnail.png",
"color": "#8A0E0E",
Expand All @@ -24,4 +24,4 @@
"proxerme"
],
"iframe": true,
"iFrameRegExp": ".*"

Check warning on line 27 in websites/P/Proxer/metadata.json

View workflow job for this annotation

GitHub Actions / Presence Validator

Presence (Proxer) has metadata.iFrameRegExp set to '.*', please change this if possible
Expand Down
20 changes: 11 additions & 9 deletions websites/P/Proxer/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ presence.on("UpdateData", () => {
details: "Idle",
state: "Browsing Proxer.me",
},
path = document.location.pathname;
{ pathname } = document.location;

if (path.startsWith("/watch")) {
if (pathname.startsWith("/watch")) {
const ep = getByXpath(
"//*[@id='wContainer']//*[@class='wEp']",
e => e.textContent
Expand All @@ -38,6 +38,7 @@ presence.on("UpdateData", () => {
);

if (videoData) {
presenceData.type = ActivityType.Watching;
if (!videoData.paused) {
presenceData.details = "Watching";
[presenceData.startTimestamp, presenceData.endTimestamp] =
Expand Down Expand Up @@ -69,26 +70,27 @@ presence.on("UpdateData", () => {
}
/*
// For the future to make watch together requests
const id = /(?:\/watch\/)([0-9]*)\/([0-9]*)\/([a-z]*)/.exec(path);
const id = /(?:\/watch\/)([0-9]*)\/([0-9]*)\/([a-z]*)/.exec(pathname);
if (id.length == 3) {
const animeId = id[0],
epId = id[1],
langId = id[2];
}
*/
} else if (path.startsWith("/info")) {
} else if (pathname.startsWith("/info")) {
presenceData.details = `Checking out ${document.title.replace(
/ - Proxer\.Me$/,
""
)}`;
} else if (path.startsWith("/anime") || path.startsWith("/season"))
} else if (pathname.startsWith("/anime") || pathname.startsWith("/season"))
presenceData.details = "Checking out Anime";
else if (path.startsWith("/chat")) presenceData.details = "Chatting";
else if (path.startsWith("/forum"))
else if (pathname.startsWith("/chat")) presenceData.details = "Chatting";
else if (pathname.startsWith("/forum"))
presenceData.details = "Checking the forum";
else if (path.startsWith("/gallery"))
else if (pathname.startsWith("/gallery"))
presenceData.details = "Checking the gallery";
else if (path.startsWith("/news")) presenceData.details = "Checking the news";
else if (pathname.startsWith("/news"))
presenceData.details = "Checking the news";

if (presenceData.details) presence.setActivity(presenceData);
else presence.setActivity();
Expand Down
Loading