-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'nitrotype' of https://github.com/joerkig/Presences into…
… nitrotype
- Loading branch information
Showing
1,258 changed files
with
4,648 additions
and
3,379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import fetch from "cross-fetch"; | ||
|
||
export default async function fetchSchema() { | ||
return (await fetch("https://schemas.premid.app/metadata/1.11")).json(); | ||
return (await fetch("https://schemas.premid.app/metadata/1.12")).json(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"$schema": "https://schemas.premid.app/metadata/1.12", | ||
"apiVersion": 1, | ||
"author": { | ||
"id": "331606403057713154", | ||
"name": "faetalize" | ||
}, | ||
"service": "1Anime", | ||
"description": { | ||
"en": "Experience Anime & Manga without Ads, Completely Free!" | ||
}, | ||
"url": "1anime.one", | ||
"version": "1.0.2", | ||
"logo": "https://cdn.rcd.gg/PreMiD/websites/0-9/1anime/assets/logo.png", | ||
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/0-9/1anime/assets/thumbnail.jpg", | ||
"color": "#C63BAD", | ||
"category": "anime", | ||
"tags": [ | ||
"anime", | ||
"streaming" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
const presence = new Presence({ | ||
clientId: "1314062632419852309", | ||
}), | ||
strings = presence.getStrings({ | ||
play: "general.playing", | ||
pause: "general.paused", | ||
}), | ||
browsingTimestamp = Math.floor(Date.now() / 1000); | ||
|
||
const enum Assets { | ||
Logo = "https://cdn.rcd.gg/PreMiD/websites/0-9/1anime/assets/logo.png", | ||
} | ||
|
||
//state | ||
let playing = false; | ||
|
||
presence.on("UpdateData", async () => { | ||
const presenceData: PresenceData = { | ||
largeImageKey: Assets.Logo, | ||
type: ActivityType.Watching, | ||
}; | ||
|
||
switch (document.location.hostname) { | ||
case "1anime.one": { | ||
if (document.location.pathname === "/") { | ||
presenceData.details = "Checking out 1anime's homepage!"; | ||
presenceData.startTimestamp = browsingTimestamp; | ||
} else if (document.location.pathname.includes("/anime/watch/")) { | ||
//player state ig | ||
const player = document.querySelector("video"), | ||
timestamps = presence.getTimestampsfromMedia(player); | ||
playing = !player.paused; | ||
//anime info ig | ||
const title = document.querySelector( | ||
"div#details h3.font-Archivo" | ||
).textContent, | ||
splitIndex = title.lastIndexOf(" - "); //title is in "Anime Title - Episode x" format | ||
|
||
//setting up presence | ||
presenceData.details = `${ | ||
title.slice(0, splitIndex).trim() || "something.." | ||
}`; | ||
presenceData.state = `Currently on ${ | ||
title.slice(splitIndex + 3).trim() || "an episode.." | ||
}`; | ||
presenceData.smallImageKey = playing ? Assets.Play : Assets.Pause; | ||
presenceData.smallImageText = playing | ||
? (await strings).play | ||
: (await strings).pause; | ||
if (playing) { | ||
presenceData.startTimestamp = timestamps[0]; | ||
presenceData.endTimestamp = timestamps[1]; | ||
} else { | ||
delete presenceData.startTimestamp; | ||
delete presenceData.endTimestamp; | ||
} | ||
//buttons-actions | ||
presenceData.buttons = [ | ||
{ | ||
label: "Watch Now", | ||
url: `https://1ani.me/a/${ | ||
document.location.pathname.split("/")[3] | ||
}`, | ||
}, | ||
]; | ||
} | ||
break; | ||
} | ||
} | ||
presence.setActivity(presenceData); | ||
}); |
Oops, something went wrong.