Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ferivoq authored Apr 29, 2024
2 parents 16a3189 + 6da804f commit 7b6bd3f
Show file tree
Hide file tree
Showing 14 changed files with 262 additions and 241 deletions.
10 changes: 9 additions & 1 deletion websites/B/bilibili/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@
"biligame.com"
],
"regExp": "([a-z0-9-]+[.])*(bilibili|biligame)[.]com[/]",
"version": "2.4.1",
"version": "2.4.2",
"logo": "https://cdn.rcd.gg/PreMiD/websites/B/bilibili/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/B/bilibili/assets/thumbnail.jpg",
"color": "#05acff",
"category": "anime",
"tags": [
"video",
"anime"
],
"settings": [
{
"id": "privacy",
"title": "Privacy Mode",
"icon": "fad fa-user-secret",
"value": false
}
]
}
14 changes: 10 additions & 4 deletions websites/B/bilibili/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ const multiUploader = document.querySelector("div.membersinfo-normal");

presence.on("UpdateData", async () => {
const presenceData: PresenceData = {
largeImageKey:
"https://cdn.rcd.gg/PreMiD/websites/B/bilibili/assets/logo.png",
};
largeImageKey:
"https://cdn.rcd.gg/PreMiD/websites/B/bilibili/assets/logo.png",
},
privacy = await presence.getSetting<boolean>("privacy");

async function getTimestamps() {
video = document.querySelector("bpx-player-container");
Expand Down Expand Up @@ -51,6 +52,11 @@ presence.on("UpdateData", async () => {
case "www.bilibili.com": {
switch (urlpath[1]) {
case "video": {
if (privacy) {
presenceData.details = "Watching a video";
break;
}

getTimestamps();

if (multiUploader) {
Expand All @@ -71,7 +77,7 @@ presence.on("UpdateData", async () => {
}

uploaderLink = uploader.getAttribute("href");
title = document.querySelector("#viewbox_report > h1");
title = document.querySelector(".video-title");

presenceData.details = title.getAttribute("title");
presenceData.state = uploaderName;
Expand Down
8 changes: 4 additions & 4 deletions websites/I/IDLIX/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"description": {
"en": "Watch the latest movies, TV series, dramas, anime with high quality available in Indonesian subtitles and updated every day. Box Office Movies to the Best TV Series are all available on the IDLIX site."
},
"url": "tv1.idlixofficial.co",
"regExp": "([0-9]+)(?<!10)[.]([0-9]+)(?<!192[.]168)(?<!172[.](1[6-9]|2[0-9]|3[0-1]))[.]([0-9]+)[.]([0-9]+)|((tv([0-9])[.])?id(f)?lix(official)?[.][a-z]{2,6})",
"version": "1.0.11",
"url": "vip.idlixofficial.net",
"regExp": "([0-9]+)(?<!10)[.]([0-9]+)(?<!192[.]168)(?<!172[.](1[6-9]|2[0-9]|3[0-1]))[.]([0-9]+)[.]([0-9]+)|(((tv([0-9]?))?(vip)?[.])?id(f)?lix(official)?[.][a-z]{2,6})",
"version": "1.1.0",
"logo": "https://cdn.rcd.gg/PreMiD/websites/I/IDLIX/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/I/IDLIX/assets/thumbnail.png",
"color": "#e50914",
Expand All @@ -22,7 +22,7 @@
"idlix"
],
"iframe": true,
"iFrameRegExp": ".*",
"iFrameRegExp": "(jenius|filmdewasa).*",
"settings": [
{
"id": "lang",
Expand Down
163 changes: 71 additions & 92 deletions websites/I/IDLIX/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ async function getStrings() {
return presence.getStrings(
{
browse: "general.browsing",
buttonViewEpisode: "general.buttonViewEpisode",
buttonViewMovie: "general.buttonViewMovie",
buttonWatchVideo: "general.buttonWatchVideo",
buttonViewPage: "general.buttonViewPage",
buttonWatchMovie: "general.buttonWatchVideo",
paused: "general.paused",
play: "general.playing",
search: "general.searchFor",
viewHome: "general.viewHome",
viewMovie: "general.viewMovie",
viewShow: "general.viewShow",
},
await presence.getSetting<string>("lang").catch(() => "en")
Expand Down Expand Up @@ -44,14 +42,76 @@ presence.on(
}
);

function videoDetails(presenceData: PresenceData, href: string) {
delete presenceData.startTimestamp;
const title =
document
.querySelector('[class="pag_episodes"]')
?.querySelectorAll("a")[1]
?.getAttribute("title") ??
document.querySelector('[class="epih1"]')?.textContent ??
document.querySelector('[class="data"]').firstElementChild?.textContent ??
document
.querySelector('[property="og:title"]')
?.getAttribute("content")
?.replace(" - Subtitle Indonesia - IDLIX", "") ??
document
.querySelector("title")
?.textContent?.split("- Subtitle Indonesia - IDLIX")?.[0] ??
"Unknown";

presenceData.largeImageKey =
document
.querySelector('[class="poster"]')
?.querySelector("img")
?.getAttribute("src") ??
document
.querySelector('[class="owl-wrapper"]')
?.querySelector("img")
?.getAttribute("src") ??
Assets.Logo;
if (!isNaN(duration)) {
presenceData.details = title;
presenceData.state =
document.querySelector('[class="epih3"]')?.textContent ?? "";
presenceData.buttons = [
{
label: strings.buttonWatchVideo,
url: href,
},
];
presenceData.smallImageKey = paused ? Assets.Pause : Assets.Play;
presenceData.smallImageText = paused ? strings.paused : strings.play;
if (!paused)
[, presenceData.endTimestamp] = presence.getTimestamps(current, duration);
} else {
presenceData.details = strings.viewShow;
presenceData.state = title;
presenceData.buttons = [
{
label: strings.buttonViewPage,
url: href,
},
];
}
return presenceData;
}

presence.on("UpdateData", async () => {
// Check to see if the site name includes idlix if not then return
const { hostname } = document.location;
if (
!document
.querySelector('[property="og:site_name"]')
?.getAttribute("content")
.toLowerCase()
.includes("idflix")
.includes("idflix") &&
!document
.querySelector("title")
?.textContent.toLowerCase()
.includes("idlix") &&
!hostname?.toLowerCase().includes("idlix") &&
!hostname?.toLowerCase().includes("idflix")
)
return;
const presenceData: PresenceData = {
Expand Down Expand Up @@ -103,100 +163,18 @@ presence.on("UpdateData", async () => {
presence.setActivity(presenceData);
return;
}

switch (pathname.split("/")[1]) {
case "": {
presenceData.details = strings.viewHome;
break;
}
case "movie": {
delete presenceData.startTimestamp;
const title = document
.querySelector('[property="og:title"]')
?.getAttribute("content")
?.replace(" - Subtitle Indonesia - IDLIX", "");
presenceData.largeImageKey = document
.querySelector('[class="poster"]')
?.querySelector("img")
?.getAttribute("src");
if (isVideo && !isNaN(duration)) {
presenceData.details = title;
presenceData.buttons = [
{
label: strings.buttonWatchMovie,
url: href,
},
];
presenceData.smallImageKey = paused ? Assets.Pause : Assets.Play;
presenceData.smallImageText = paused ? strings.paused : strings.play;
if (!paused) {
[, presenceData.endTimestamp] = presence.getTimestamps(
current,
duration
);
}
} else {
presenceData.details = strings.viewMovie;
presenceData.state = title;
presenceData.buttons = [
{
label: strings.buttonViewMovie,
url: href,
},
];
}
break;
}

case "episodes":
case "episode":
case "tvseries": {
delete presenceData.startTimestamp;
const title =
document
.querySelector('[class="pag_episodes"]')
?.querySelectorAll("a")[1]
?.getAttribute("title") ??
document.querySelector('[class="epih1"]')?.textContent ??
document.querySelector('[class="data"]').firstElementChild?.textContent;
presenceData.largeImageKey =
document
.querySelector('[class="poster"]')
?.querySelector("img")
?.getAttribute("src") ??
document
.querySelector('[class="owl-wrapper"]')
?.querySelector("img")
?.getAttribute("src") ??
Assets.Logo;
if (isVideo && !isNaN(duration)) {
presenceData.details = title;
presenceData.state =
document.querySelector('[class="epih3"]')?.textContent;
presenceData.buttons = [
{
label: strings.buttonViewEpisode,
url: href,
},
];

presenceData.smallImageKey = paused ? Assets.Pause : Assets.Play;
presenceData.smallImageText = paused ? strings.paused : strings.play;

if (!paused) {
[, presenceData.endTimestamp] = presence.getTimestamps(
current,
duration
);
}
} else {
presenceData.details = strings.viewShow;
presenceData.state = title;
presenceData.buttons = [
{
label: "View Show",
url: href,
},
];
}
case "tvseries":
case "movie": {
videoDetails(presenceData, href);
break;
}
case "trending":
Expand All @@ -217,7 +195,8 @@ presence.on("UpdateData", async () => {
break;
}
default: {
if (heading && category) {
if (isVideo) videoDetails(presenceData, href);
else if (heading && category) {
presenceData.details = `Viewing ${heading} ${category}`;
presenceData.state = `Viewing page ${
document.querySelector('[class="current"]')?.textContent
Expand Down
2 changes: 1 addition & 1 deletion websites/M/Minecraft Wiki/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"*://minecraft.wiki/*",
"*://*.minecraft.wiki/*"
],
"version": "1.0.1",
"version": "1.0.2",
"logo": "https://cdn.rcd.gg/PreMiD/websites/M/Minecraft%20Wiki/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/M/Minecraft%20Wiki/assets/thumbnail.png",
"color": "#3776A9",
Expand Down
Loading

0 comments on commit 7b6bd3f

Please sign in to comment.