Skip to content

Commit

Permalink
Merge branch 'nitrotype' of https://github.com/joerkig/Presences into…
Browse files Browse the repository at this point in the history
… nitrotype
  • Loading branch information
joerkig committed Dec 23, 2024
2 parents ad0f075 + 8e11d20 commit ea2cce1
Show file tree
Hide file tree
Showing 1,258 changed files with 4,648 additions and 3,379 deletions.
6 changes: 2 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Each presence has a descriptor file called `metadata.json`, the metadata has a s

```json
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "USER",
Expand Down Expand Up @@ -211,9 +211,7 @@ A list of fields and their rules are listed below:
- If you decide to make a format string (for e.g., `%song% by %artist%`), you must have the variables surrounded by a percent sign on either side. Variables like `%var`, `var%`, or `%%var%%` and anything in between are **not** permitted for the sake of standardization.
- The name of the settings must **not** be in all capital letters. For example, names such as `SHOW BROWSING STATUS` will **not** be permitted; however, names such as `Show Browsing Status` or `Show browsing status` are permitted.
- If you are using the `multiLanguage` option it can have the following types:
- **Boolean** type which will only enable strings from [`general.json`](https://github.com/PreMiD/Localization/blob/master/src/Presence/general.json) from the Localization repo or from the presence file (e.g. when the name of the presence is YouTube, the extension will get strings from `youtube.json` too.)
- **String** type (e.g. `youtube`) which will specify the name of the files that you want to get strings from.
- **Array<String>** type (e.g. `["youtube", "discord"]`) which will specify the name of the files that you want to get strings from.
- **True** type which will only enable strings from [`general.json`](https://github.com/PreMiD/Localization/blob/master/src/Presence/general.json) from the Localization repo or from the presence file (e.g. when the name of the presence is YouTube, the extension will get strings from `youtube.json` too.)

## [**presence.ts**](https://docs.premid.app/dev/presence/class)

Expand Down
10 changes: 2 additions & 8 deletions @types/premid/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,9 @@ interface Metadata {
*/
values?: (string | number | boolean)[];
/**
* `false`: default, it disables multi-localization.
*
* `true`: use this if you are only going to use strings from the [`general.json`](https://github.com/PreMiD/Localization/blob/main/src/Presence/general.json) file.
*
* `string`: name of the file, excluding the extension (.json), inside the [localization github repo](https://github.com/PreMiD/Localization/tree/master/src/Presence).
*
* `string[]`: if you are using more than one file, from inside of the [localization github repo](https://github.com/PreMiD/Localization/tree/master/src/Presence), you can specify all the values in an array. Only common languages of all the files will be listed.
* `true`: use this if you are only going to use strings from the [`general.json`](https://github.com/PreMiD/Localization/blob/main/src/Presence/general.json) file, and your <service>.json file.
*/
multiLanguage?: boolean | string | string[];
multiLanguage?: true;
}[];
}

Expand Down
2 changes: 1 addition & 1 deletion cli/bin/functions/fetchSchema.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/src/functions/fetchSchema.ts
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();
}
8 changes: 5 additions & 3 deletions cli/template/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "",
Expand All @@ -15,5 +15,7 @@
"thumbnail": "",
"color": "",
"category": "",
"tags": [""]
}
"tags": [
""
]
}
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/classes/PresenceCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ interface BaseSetting {
}

interface MultiLanguageSetting extends BaseSetting {
multiLanguage: true | string | string[];
multiLanguage: true;
}

interface Setting extends BaseSetting {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"id": "258380809172418570",
Expand All @@ -14,7 +14,7 @@
"ja_JP": "「アイドルマスター」シリーズ最新作が、スマートフォン向けブラウザゲームで登場! 新たな事務所「283(ツバサ)プロダクション」を舞台に、アイドルを羽ばたかせよう! ©BANDAI NAMCO Entertainment Inc."
},
"url": "shinycolors.enza.fun",
"version": "1.0.11",
"version": "1.0.12",
"logo": "https://cdn.rcd.gg/PreMiD/websites/%23/%E3%82%A2%E3%82%A4%E3%83%89%E3%83%AB%E3%83%9E%E3%82%B9%E3%82%BF%E3%83%BC%E3%82%B7%E3%83%A3%E3%82%A4%E3%83%8B%E3%83%BC%E3%82%AB%E3%83%A9%E3%83%BC%E3%82%BA/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/%23/%E3%82%A2%E3%82%A4%E3%83%89%E3%83%AB%E3%83%9E%E3%82%B9%E3%82%BF%E3%83%BC%E3%82%B7%E3%83%A3%E3%82%A4%E3%83%8B%E3%83%BC%E3%82%AB%E3%83%A9%E3%83%BC%E3%82%BA/assets/thumbnail.png",
"color": "#8adfff",
Expand Down
4 changes: 2 additions & 2 deletions websites/#/ッツ Ebook Reader/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"id": "615896601554190346",
Expand All @@ -10,7 +10,7 @@
"en": "Online e-book reader that supports Yomichan."
},
"url": "reader.ttsu.app",
"version": "1.0.3",
"version": "1.0.4",
"logo": "https://cdn.rcd.gg/PreMiD/websites/%23/%E3%83%83%E3%83%84%20Ebook%20Reader/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/%23/%E3%83%83%E3%83%84%20Ebook%20Reader/assets/thumbnail.jpg",
"color": "#37474F",
Expand Down
4 changes: 2 additions & 2 deletions websites/#/巴哈姆特/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "蒟蒻",
Expand All @@ -15,7 +15,7 @@
"vi_VN": "Cộng đồng game và hoạt hình lớn nhất Trung Quốc, cung cấp tin tức ACG hằng ngày, xếp hạng phổ biến, không gian giao tiếp và bàn luận phong phú, cũng như các bài viết về video và âm thanh đặc sắc."
},
"url": "forum.gamer.com.tw",
"version": "1.1.26",
"version": "1.1.27",
"logo": "https://cdn.rcd.gg/PreMiD/websites/%23/%E5%B7%B4%E5%93%88%E5%A7%86%E7%89%B9/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/%23/%E5%B7%B4%E5%93%88%E5%A7%86%E7%89%B9/assets/thumbnail.png",
"color": "#2E93A5",
Expand Down
4 changes: 2 additions & 2 deletions websites/#/巴哈姆特動畫瘋/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "Bas950",
Expand All @@ -15,7 +15,7 @@
"vi_VN": "Nền tảng cung cấp hoạt hình hoàn toàn miễn phí."
},
"url": "ani.gamer.com.tw",
"version": "1.2.24",
"version": "1.2.25",
"logo": "https://cdn.rcd.gg/PreMiD/websites/%23/%E5%B7%B4%E5%93%88%E5%A7%86%E7%89%B9%E5%8B%95%E7%95%AB%E7%98%8B/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/%23/%E5%B7%B4%E5%93%88%E5%A7%86%E7%89%B9%E5%8B%95%E7%95%AB%E7%98%8B/assets/thumbnail.png",
"color": "#58bec9",
Expand Down
4 changes: 2 additions & 2 deletions websites/#/网易云音乐/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "Moe Kotoki",
Expand All @@ -14,7 +14,7 @@
"vi_VN": "Netease Cloud Music là nền tảng phát nhạc trực tuyến Freemium được sở hữu và phát triển bởi Tập đoàn NetEase."
},
"url": "music.163.com",
"version": "1.1.9",
"version": "1.1.10",
"logo": "https://cdn.rcd.gg/PreMiD/websites/%23/%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/%23/%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90/assets/thumbnail.png",
"color": "#E30000",
Expand Down
4 changes: 2 additions & 2 deletions websites/#/대성마이맥/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "1LUXION",
Expand All @@ -15,7 +15,7 @@
"vi_VN": "Digital Daesung là công ty giáo dục hàng đầu Hàn Quốc, cung cấp nội dung giáo dục chất lượng cao. Chúng tôi cung cấp dịch vụ giáo dục toàn vẹn cho bậc tiểu học, trung học, cao đẳng và đại học, từ học trực tuyến đến trực tiếp, luyện viết luận và tư vấn nộp hồ sơ đại học."
},
"url": "www.mimacstudy.com",
"version": "1.0.20",
"version": "1.0.21",
"logo": "https://cdn.rcd.gg/PreMiD/websites/%23/%EB%8C%80%EC%84%B1%EB%A7%88%EC%9D%B4%EB%A7%A5/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/%23/%EB%8C%80%EC%84%B1%EB%A7%88%EC%9D%B4%EB%A7%A5/assets/thumbnail.png",
"color": "#2581c4",
Expand Down
4 changes: 2 additions & 2 deletions websites/#/라프텔/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"id": "868016688090710067",
Expand All @@ -14,7 +14,7 @@
"ko_KR": "한국에서 서비스하는 애니 OTT 스트리밍 서비스"
},
"url": "laftel.net",
"version": "1.0.4",
"version": "1.0.5",
"logo": "https://cdn.rcd.gg/PreMiD/websites/%23/%EB%9D%BC%ED%94%84%ED%85%94/assets/logo.jpg",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/%23/%EB%9D%BC%ED%94%84%ED%85%94/assets/thumbnail.jpg",
"color": "#816BFF",
Expand Down
4 changes: 2 additions & 2 deletions websites/0-9/000webhost/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "Dark_Ville",
Expand All @@ -13,7 +13,7 @@
},
"url": "000webhost.com",
"regExp": "([a-z0-9-]+[.])*000webhost[.]com[\\/]",
"version": "1.3.3",
"version": "1.3.4",
"logo": "https://cdn.rcd.gg/PreMiD/websites/0-9/000webhost/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/0-9/000webhost/assets/thumbnail.jpg",
"color": "#ff5c62",
Expand Down
4 changes: 2 additions & 2 deletions websites/0-9/10fastfingers/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "Yelo",
Expand All @@ -12,7 +12,7 @@
"vi_VN": "Thử và cải thiện tốc độ đánh máy của bạn với các trò chơi đánh máy miễn phí của chúng tôi."
},
"url": "10fastfingers.com",
"version": "1.0.18",
"version": "1.0.19",
"logo": "https://cdn.rcd.gg/PreMiD/websites/0-9/10fastfingers/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/0-9/10fastfingers/assets/thumbnail.png",
"color": "#082333",
Expand Down
4 changes: 2 additions & 2 deletions websites/0-9/1337x/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "Bas950",
Expand All @@ -24,7 +24,7 @@
"1337x.is"
],
"regExp": "([a-z0-9-]+[.])*x?1337x([.][a-z]+)+[/]",
"version": "1.5.22",
"version": "1.5.23",
"logo": "https://cdn.rcd.gg/PreMiD/websites/0-9/1337x/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/0-9/1337x/assets/thumbnail.png",
"color": "#d63600",
Expand Down
4 changes: 2 additions & 2 deletions websites/0-9/1CAK/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"$schema": "https://schemas.premid.app/metadata/1.12",
"apiVersion": 1,
"author": {
"name": "allvzx",
Expand All @@ -15,7 +15,7 @@
"vi_VN": "1CAK là trang giải trí Indonesia cung cấp các hình ảnh và video từ người dùng. Trang web này cũng được biết đến là nơi cung cấp meme. Người dùng 1CAK có thể lựa chọn và bình luận vào ảnh. Các hình ảnh nổi bật được trưng bày trên trang web chính."
},
"url": "1cak.com",
"version": "1.4.9",
"version": "1.4.10",
"logo": "https://cdn.rcd.gg/PreMiD/websites/0-9/1CAK/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/0-9/1CAK/assets/thumbnail.png",
"color": "#ffffff",
Expand Down
22 changes: 22 additions & 0 deletions websites/0-9/1anime/metadata.json
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"
]
}
71 changes: 71 additions & 0 deletions websites/0-9/1anime/presence.ts
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);
});
Loading

0 comments on commit ea2cce1

Please sign in to comment.