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(AniTilky): add activity #9264

Open
wants to merge 90 commits into
base: main
Choose a base branch
from
Open

feat(AniTilky): add activity #9264

wants to merge 90 commits into from

Conversation

hyqanxd
Copy link

@hyqanxd hyqanxd commented Feb 9, 2025

AniTilky Presence

Features

  • Shows what anime you're watching with episode information
  • Shows what user profile you're viewing
  • Shows what anime details page you're browsing
  • Includes buttons to directly access anime pages and episodes
  • Supports both Turkish and English languages

Özellikler

  • İzlediğiniz animeyi bölüm bilgisiyle gösterir
  • Hangi kullanıcı profilini görüntülediğinizi gösterir
  • Hangi anime detay sayfasını incelediğinizi gösterir
  • Anime sayfalarına ve bölümlere doğrudan erişim için butonlar içerir
  • Türkçe ve İngilizce dil desteği sunar

Screenshots/Ekran Görüntüleri

Click to expand/Genişletmek için tıklayın

Anime Watching/Anime İzleme

watching

Profile View/Profil Görünümü

profile

Anime Details/Anime Detayları

details

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@Kuriel23
Copy link
Contributor

Kuriel23 commented Feb 9, 2025

Close #9263

@Kuriel23
Copy link
Contributor

Kuriel23 commented Feb 9, 2025

Rename title to feat(AniTilky): add activity

"iFrameRegExp": "anitilky\\.xyz",
"regExp": "anitilky\\.xyz",
"readLogs": false,
"apiVersion": "3.1.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"apiVersion": "3.1.0"
"apiVersion": 1

Comment on lines 86 to 89
let lastAnimeId: string | null = null,
lastAnimeData: AnimeData | null = null,
lastUsername: string | null = null,
lastUserData: UserData | null = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let lastAnimeId: string | null = null,
lastAnimeData: AnimeData | null = null,
lastUsername: string | null = null,
lastUserData: UserData | null = null;

Comment on lines 92 to 96
const presenceData: PresenceData = {
largeImageKey: "logo"
};

const baseUrl = "https://anitilky.xyz";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const presenceData: PresenceData = {
largeImageKey: "logo"
};
const baseUrl = "https://anitilky.xyz";
const presenceData: PresenceData = {
largeImageKey: Assets.Logo
},
baseUrl = "https://anitilky.xyz";

Comment on lines 105 to 108
const username = document.querySelector(".profile-username")?.textContent?.trim();

presenceData.details = "Kendi profiline bakıyor";
presenceData.state = username || "Profil";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const username = document.querySelector(".profile-username")?.textContent?.trim();
presenceData.details = "Kendi profiline bakıyor";
presenceData.state = username || "Profil";
presenceData.details = "Kendi profiline bakıyor";
presenceData.state = document.querySelector(".profile-username")?.textContent?.trim() || "Profil";

}
// Başka kullanıcı profili kontrolü
else if (document.location.pathname.startsWith("/u/")) {
const username = document.location.pathname.split('/').pop() || '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const username = document.location.pathname.split('/').pop() || '';
const username = document.location.pathname.split("/").pop() || "";

Comment on lines 39 to 58
async function getAnimeData(animeId: string): Promise<AnimeData> {
try {
const titleElement = document.querySelector(".anime-title");
if (titleElement && titleElement.textContent) {
return {
title: { tr: titleElement.textContent.trim() }
};
}

const response = await fetch(`https://backend.anitilky.xyz/api/anime/${animeId}`);
if (!response.ok) throw new Error('API error');
const data = await response.json();
return data;
} catch (error) {
console.error("Anime verisi alınamadı:", error);
return {
title: { tr: "Bilinmeyen Anime" }
};
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async function getAnimeData(animeId: string): Promise<AnimeData> {
try {
const titleElement = document.querySelector(".anime-title");
if (titleElement && titleElement.textContent) {
return {
title: { tr: titleElement.textContent.trim() }
};
}
const response = await fetch(`https://backend.anitilky.xyz/api/anime/${animeId}`);
if (!response.ok) throw new Error('API error');
const data = await response.json();
return data;
} catch (error) {
console.error("Anime verisi alınamadı:", error);
return {
title: { tr: "Bilinmeyen Anime" }
};
}
}


presence.on("UpdateData", async () => {
const presenceData: PresenceData = {
largeImageKey: "logo"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
largeImageKey: "logo"
largeImageKey: Assets.Logo

lastAnimeData: AnimeData | null = null,
lastUsername: string | null = null,
lastUserData: UserData | null = null;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const enum Assets {
Logo = "https://i.imgur.com/zZ5r866.png",
}

},
"url": "anitilky.xyz",
"version": "1.0.0",
"logo": "https://i.imgur.com/zZ5r866.png",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logo should be 512x512.

@@ -0,0 +1,29 @@
{
"$schema": "https://schemas.premid.app/metadata/1.10",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"$schema": "https://schemas.premid.app/metadata/1.10",
"$schema": "https://schemas.premid.app/metadata/1.13",

websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
@hyqanxd hyqanxd changed the title add AniTilky presence feat(AniTilky): add activity Feb 10, 2025
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
websites/A/AniTilky/presence.ts Fixed Show fixed Hide fixed
@theusaf theusaf enabled auto-merge (squash) February 19, 2025 18:34
@theusaf theusaf requested a review from Bas950 February 19, 2025 18:34
"tags": ["anime", "video", "streaming", "turkish"],
"iframe": true,
"iFrameRegExp": "anitilky\\.xyz",
"readLogs": false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"readLogs": false

"color": "#FF6B6B",
"category": "anime",
"tags": ["anime", "video", "streaming", "turkish"],
"iframe": true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"iframe": true,

Comment on lines 3 to 15
export const presence = new Presence({
clientId: '1124065204200820786',
})
export const time = Math.floor(Date.now() / 1000)
export const path = document.location.pathname
export const videoData = {
current: 0,
duration: 0,
isLive: false,
paused: true,
}
export const baseUrl = 'https://anitilky.xyz'
export const apiUrl = 'https://backend.anitilky.xyz/api'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these exports seem useless

auto-merge was automatically disabled February 20, 2025 10:21

Head branch was pushed to by a user without write access

@hyqanxd hyqanxd requested a review from Bas950 February 20, 2025 10:27
Comment on lines 1 to 2
/// <reference types="premid" />
/// <reference path="../../../@types/premid/index.d.ts" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be unneeded?

Comment on lines 113 to 114
largeImageKey: 'logo',
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use an imgur url instead of assets from the app

Comment on lines 96 to 97
avatar: data.data.avatar || 'logo',
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


presenceData.details = 'Anime detayına bakıyor'
presenceData.state = animeInfo?.title.romaji || animeInfo?.title.english || animeInfo?.title.native || 'Yükleniyor...'
presenceData.largeImageKey = animeInfo?.coverImage || 'logo'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@hyqanxd hyqanxd requested a review from Bas950 February 20, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants