Skip to content

Commit

Permalink
feat(filman.cc): add presence (PreMiD#6104)
Browse files Browse the repository at this point in the history
Co-authored-by: Slowlife <slowlife1165@gmail.com>
Co-authored-by: Slowlife01 <slowlife1165@gmail.com>
  • Loading branch information
xKubuuus and Slowlife01 authored Apr 23, 2022
1 parent b84dd51 commit bd64d1f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
19 changes: 19 additions & 0 deletions websites/F/filman.cc/dist/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://schemas.premid.app/metadata/1.7",
"author": {
"name": "xKubson_",
"id": "404217213873029120"
},
"service": "filman.cc",
"description": {
"en": "Polish site offering links to series and movies from other sources.",
"pl": "Polska strona oferująca linki do seriali i filmów z innych źródeł."
},
"url": "filman.cc",
"version": "1.0.0",
"logo": "https://i.imgur.com/NHoj4QX.png",
"thumbnail": "https://i.imgur.com/Fx7f5BM.png",
"color": "#00b3ff",
"category": "videos",
"tags": ["videos"]
}
45 changes: 45 additions & 0 deletions websites/F/filman.cc/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const presence = new Presence({
clientId: "966334543789424781"
}),
browsingTimestamp = Math.floor(Date.now() / 1000);

presence.on("UpdateData", async () => {
const presenceData: PresenceData = {
largeImageKey: "logo",
startTimestamp: browsingTimestamp
},
path = document.location.pathname.toLowerCase();
if (path == "/" || path == "/online")
presenceData.details = "Przegląda stronę główną...";
else if (path.includes("/movies")) {
presenceData.details = "Ogląda film:";
presenceData.state = document.title.split(" ").slice(0, -9).join(" ");
} else if (path.includes("/serial-online/") && path.split("/").length == 5) {
presenceData.details = "Ogląda serial:";
presenceData.state = `${document.title.split(" ").slice(0, -9).join(" ")}`;
} else if (path.includes("/serial-online")) {
presenceData.details = "Sprawdza serial:";
presenceData.state = document.title.split(" ").slice(0, -9).join(" ");
} else if (path.includes("/filmy-online-pl"))
presenceData.details = "Przegląda listę filmów";
else if (path.includes("/seriale-online-pl"))
presenceData.details = "Przegląda listę seriali";
else if (path.includes("/dla-dzieci-pl"))
presenceData.details = 'Przegląda "Dla dzieci"';
else if (path.includes("/popularne"))
presenceData.details = "Przegląda popularne filmy i seriale";
else if (path.includes("/tag")) {
presenceData.details = "Przegląda tag:";
presenceData.state = path.split("/")[2];
} else if (path.includes("/wyszukiwarka")) {
presenceData.details = "Szuka:";
presenceData.state = document.title.split(" ").slice(4, -9).join(" ");
} else if (path.includes("/regulamin"))
presenceData.details = "Czyta regulamin";
else if (path.includes("/pomoc")) presenceData.details = "Czyta FAQ";
else if (path.includes("/poszukiwane"))
presenceData.details = "Przegląda poszukiwane filmy i seriale...";

if (presenceData.details) presence.setActivity(presenceData);
else presence.setActivity();
});
6 changes: 6 additions & 0 deletions websites/F/filman.cc/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist/"
}
}

0 comments on commit bd64d1f

Please sign in to comment.