-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(kitsu.live): add activity #10912
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
Merged
+64
−0
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e3d9746
Add metadata.json for kitsu.live integration
zzxncl 3eccc78
Create presence.ts
zzxncl 17afde0
Delete websites/kitsu.live directory
zzxncl 31fa0d8
Create metadata.json
zzxncl a103873
Implement presence functionality for kitsu.live
zzxncl 98afe3c
Update presence.ts
zzxncl 2bb4911
Update presence.ts
zzxncl f829789
Update presence.ts
zzxncl 460db38
Update presence.ts
zzxncl 7ab1acc
Merge branch 'main' into main
zzxncl 9cfe4f8
Merge branch 'main' into main
zzxncl d3bfe82
Merge branch 'main' into main
zzxncl 224b4f2
Update metadata.json for kitsu.live service
zzxncl 097277c
Update smallImageKey to use favicon URL
zzxncl b0fcdad
Add regex pattern for kitsu.live URL validation
zzxncl 5ae97e8
Merge branch 'main' into main
zzxncl 0ffa3bd
Merge branch 'main' into main
zzxncl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,24 @@ | ||
| { | ||
| "$schema": "https://schemas.premid.app/metadata/1.17", | ||
| "apiVersion": 1, | ||
|
zzxncl marked this conversation as resolved.
|
||
| "author": { | ||
| "name": "kitsu.live", | ||
| "id": "1515251988646989854" | ||
| }, | ||
| "service": "kitsu.live", | ||
| "description": { | ||
| "en": "kitsu.live is a premium anime streaming and manga reading platform." | ||
| }, | ||
| "url": "kitsu.live", | ||
| "regExp": "^https?[:][/][/]([a-z0-9-]+[.])*kitsu[.]live[/]", | ||
| "version": "1.0.0", | ||
| "logo": "https://kitsu.live/favicon.png", | ||
| "thumbnail": "https://kitsu.live/assets/hero_banner.png", | ||
| "color": "#8b5cf6", | ||
| "category": "anime", | ||
| "tags": [ | ||
| "anime", | ||
| "manga", | ||
| "streaming" | ||
| ] | ||
| } | ||
This file contains hidden or 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,40 @@ | ||
| import { ActivityType } from 'premid' | ||
|
|
||
| const presence = new Presence({ clientId: '1515251988646989854' }) | ||
|
|
||
| presence.on('UpdateData', () => { | ||
| const el = document.getElementById('kitsu-presence-data') | ||
|
|
||
| if (!el || !el.getAttribute('data-active')) { | ||
| presence.clearActivity() | ||
| return | ||
| } | ||
|
|
||
| const details = el.getAttribute('data-details') || undefined | ||
| const state = el.getAttribute('data-state') || undefined | ||
| const largeImageKey = el.getAttribute('data-large-image') || undefined | ||
| const largeImageText = el.getAttribute('data-large-image-text') || undefined | ||
| const startTimestampStr = el.getAttribute('data-start-timestamp') | ||
| const endTimestampStr = el.getAttribute('data-end-timestamp') | ||
|
|
||
| const startTimestamp = startTimestampStr ? Number.parseInt(startTimestampStr, 10) * 1000 : undefined | ||
| const endTimestamp = endTimestampStr ? Number.parseInt(endTimestampStr, 10) * 1000 : undefined | ||
|
|
||
| presence.setActivity({ | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| type: ActivityType.Watching, | ||
| details, | ||
| state, | ||
| largeImageKey, | ||
| largeImageText, | ||
| smallImageKey: 'https://kitsu.live/favicon.png', | ||
| smallImageText: 'kitsu.live', | ||
| startTimestamp, | ||
| endTimestamp, | ||
| buttons: [ | ||
| { | ||
| label: 'Watch on kitsu.live', | ||
| url: document.location.href, | ||
| }, | ||
| ], | ||
| }) | ||
| }) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.