Conversation
Signed-off-by: Dynnx <realdynnxx@gmail.com>
There was a problem hiding this comment.
ESLint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
| "apiVersion": 1, | ||
| "author": { | ||
| "name": "Dynnx", | ||
| "id": "0" |
| }, | ||
| "service": "Seanime", | ||
| "description": { | ||
| "en": "Discord Rich Presence for Seanime, a self-hosted anime streaming app." |
There was a problem hiding this comment.
Use official description from service
| "en": "Discord Rich Presence for Seanime, a self-hosted anime streaming app." | ||
| }, | ||
| "url": "localhost", | ||
| "regExp": "^https?:\\/\\/.*:43211\\/", |
There was a problem hiding this comment.
| "regExp": "^https?:\\/\\/.*:43211\\/", | |
| "regExp": "^https?[:][/][/](localhost|(?:\d{1,3}[.]){3}\d{1,3})[:]43211[/]", |
| "regExp": "^https?:\\/\\/.*:43211\\/", | ||
| "version": "1.0.0", | ||
| "logo": "https://i.imgur.com/e3lBwoS.png", | ||
| "thumbnail": "https://i.imgur.com/e3lBwoS.png", |
There was a problem hiding this comment.
Thumbnail should be a landscape promotional image or screenshot, not the logo
| if (!url.includes(':43211')) { | ||
| return | ||
| } | ||
|
|
There was a problem hiding this comment.
| if (!url.includes(':43211')) { | |
| return | |
| } |
Unnecessary, since the regex only keeps links ending in :43211
| return | ||
| } | ||
|
|
||
| const video = document.querySelector('video') as HTMLVideoElement | null |
There was a problem hiding this comment.
Use generics when using document.querySelector rather than type casting
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
| "en": "Seanime is a media server with a web interface and desktop app for managing your local library, streaming anime and reading manga." | ||
| }, | ||
| "url": "localhost", | ||
| "regExp": "^https?:\\/\\/(localhost|(?:\\d{1,3}\\.){3}\\d{1,3}):43211(\\/|$)", |
There was a problem hiding this comment.
| "regExp": "^https?:\\/\\/(localhost|(?:\\d{1,3}\\.){3}\\d{1,3}):43211(\\/|$)", | |
| "regExp": "^https?[:][/][/](localhost|(?:\\d{1,3}[.]){3}\\d{1,3})[:]43211([/]|$)", |
| const PLAY_ICON = 'https://i.imgur.com/Fi1hHy2.png' | ||
| const PAUSE_ICON = 'https://i.imgur.com/OnySmVp.png' |
There was a problem hiding this comment.
Use the Assets enum from the premid package instead
https://docs.premid.app/v1/api/utility-functions.html#assets-enum
| } | ||
|
|
||
| presence.on('UpdateData', async () => { | ||
| console.log('Presence running') |
There was a problem hiding this comment.
| console.log('Presence running') |
|
|
||
| if (!path || path === '/' || path.length <= 1) { | ||
| presence.setActivity({ | ||
| type: 0, |
There was a problem hiding this comment.
Use the ActivityType enum from the premid package instead
| const page = findPageCounter() | ||
|
|
||
| presence.setActivity({ | ||
| type: 0, |
| const paused = video.paused | ||
|
|
||
| presence.setActivity({ | ||
| type: 3, |
| } | ||
|
|
||
| presence.setActivity({ | ||
| type: 0, |
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
Signed-off-by: Dynnx <realdynnxx@gmail.com>
| @@ -0,0 +1,96 @@ | |||
| presence.on('UpdateData', async () => { | |||
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
| const rawTitle = document.title.replace(' | Seanime', '') | ||
|
|
||
| if (!path || path === '/' || path.length <= 1) { | ||
| presence.setActivity({ |
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
| type: 0, | ||
| details: 'Browsing Library', | ||
| state: 'Looking for something to watch', | ||
| largeImageKey: LOGO, |
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
| } | ||
|
|
||
| if (path.includes('/manga/entry')) { | ||
| const chapter = findChapter() |
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
|
|
||
| if (path.includes('/manga/entry')) { | ||
| const chapter = findChapter() | ||
| const page = findPageCounter() |
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
| name: 'Anime', | ||
| details: cleanTitle, | ||
| state: stateText, | ||
| largeImageKey: LOGO, |
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
| ? undefined | ||
| : endTimestamp, | ||
| smallImageKey: paused | ||
| ? PAUSE_ICON |
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
| : endTimestamp, | ||
| smallImageKey: paused | ||
| ? PAUSE_ICON | ||
| : PLAY_ICON, |
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
| return | ||
| } | ||
|
|
||
| presence.setActivity({ |
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
| type: 0, | ||
| details: rawTitle, | ||
| state: 'Browsing', | ||
| largeImageKey: LOGO, |
Check failure
Code scanning / PMD
Makes sure the TypeScript files are correct Error
| const episodeTitle = findEpisodeTitle() | ||
|
|
||
| const cleanTitle | ||
| = document |
Check failure
Code scanning / ESLint
Enforce consistent indentation Error
|
|
||
| const cleanTitle | ||
| = document | ||
| .querySelector('[data-vc-element="top-playback-info-title"]') |
Check failure
Code scanning / ESLint
Enforce consistent indentation Error
| const cleanTitle | ||
| = document | ||
| .querySelector('[data-vc-element="top-playback-info-title"]') | ||
| ?.textContent |
Check failure
Code scanning / ESLint
Enforce consistent indentation Error
| = document | ||
| .querySelector('[data-vc-element="top-playback-info-title"]') | ||
| ?.textContent | ||
| ?.trim() |
Check failure
Code scanning / ESLint
Enforce consistent indentation Error
| .querySelector('[data-vc-element="top-playback-info-title"]') | ||
| ?.textContent | ||
| ?.trim() | ||
| || rawTitle |
Check failure
Code scanning / ESLint
Indentation for binary operators Error
|
|
||
| const epShort | ||
| = epNumber | ||
| ? `Ep ${epNumber[0]}` |
Check failure
Code scanning / ESLint
Enforce consistent indentation Error
| const epShort | ||
| = epNumber | ||
| ? `Ep ${epNumber[0]}` | ||
| : null |
Check failure
Code scanning / ESLint
Enforce consistent indentation Error
| const paused = video.paused | ||
|
|
||
| const stateText | ||
| = paused |
Check failure
Code scanning / ESLint
Enforce consistent indentation Error
|
|
||
| const stateText | ||
| = paused | ||
| ? `Paused • ${epShort || ''}\n${episodeTitle || ''}`.trim() |
Check failure
Code scanning / ESLint
Enforce consistent indentation Error
| const stateText | ||
| = paused | ||
| ? `Paused • ${epShort || ''}\n${episodeTitle || ''}`.trim() | ||
| : `${epShort || ''}\n${episodeTitle || ''}`.trim() |
Check failure
Code scanning / ESLint
Enforce consistent indentation Error
|
This PR has been marked as stale because it has been inactive for over 14 days. |
|
This PR has been automatically closed due to inactivity for over 14 days. |
Description
Adds Rich Presence support for Seanime — an anime and manga streaming platform.
This activity displays the user's current watching or reading status in Discord Rich Presence.
Features
The activity detects the video player and manga reader on the Seanime website and updates the Rich Presence dynamically.
No existing activities were modified.
Acknowledgements
npm run lintScreenshots
Proof showing the creation/modification is working as expected
Anime Watching
Activity Settings
Manga Reading