Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions websites/S/SAKURA/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://schemas.premid.app/metadata/1.17",
"apiVersion": 1,
"author": {
"name": "Foxy",
"id": "1064801165201641592"
},
"service": "SAKURA",
"description": {
"en": "Displays what anime or cartoon you are watching on SAKURA.",
"fr": "Affiche l'anime ou le dessin animé que vous regardez sur SAKURA."
},
"url": "sakura.thefoxy.me",
"regExp": "^https?[:][/][/](([a-z0-9-]+[.])*sakura[.]thefoxy[.]me|localhost)(:\\d{1,5})?([/]|$)",
"version": "1.0.0",
"logo": "https://sakura.thefoxy.me/icon-512.png",
"thumbnail": "https://sakura.thefoxy.me/banner.png",
"color": "#FF2D55",
"category": "anime",
"tags": [
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
"anime",
"cartoons",
"streaming",
"manga"
]
}
59 changes: 59 additions & 0 deletions websites/S/SAKURA/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { ActivityType } from 'premid'

const presence = new Presence({
clientId: '1568341036894523432',
})

presence.on('UpdateData', async () => {
const el = document.getElementById('premid-presence')
if (el) {
const details = el.getAttribute('data-details')
const state = el.getAttribute('data-state')
const largeImage = el.getAttribute('data-large-image')
const largeText = el.getAttribute('data-large-text')
const smallImage = el.getAttribute('data-small-image')
const smallText = el.getAttribute('data-small-text')
const start = el.getAttribute('data-start')
const end = el.getAttribute('data-end')
const buttonLabel = el.getAttribute('data-button-label')
const buttonUrl = el.getAttribute('data-button-url')

if (details) {
const isBrowsing
= !end
&& (state?.includes('Parcourt')
|| state?.includes('Cherche')
|| state?.includes('Explore')
|| state?.includes('Consulte'))

const activity: any = {
type: isBrowsing ? ActivityType.Playing : ActivityType.Watching,
details,
state: state || undefined,
largeImageKey: largeImage || 'https://sakura.thefoxy.me/icon.png',
largeImageText: largeText || 'SAKURA',
smallImageKey: smallImage || 'https://sakura.thefoxy.me/icon.png',
smallImageText: smallText || 'SAKURA',
}

if (start)
activity.startTimestamp = Math.floor(Number(start))
if (end)
activity.endTimestamp = Math.floor(Number(end))

if (buttonLabel && buttonUrl && buttonUrl.startsWith('http')) {
activity.buttons = [
{
label: buttonLabel.slice(0, 32),
url: buttonUrl,
},
]
}

presence.setActivity(activity)
return
}
}

presence.clearActivity()
})
6 changes: 6 additions & 0 deletions websites/S/SAKURA/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/"
}
}
Loading