Skip to content
Merged
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
24 changes: 24 additions & 0 deletions websites/M/mistwarp/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://schemas.premid.app/metadata/1.16",
"apiVersion": 1,
"author": {
"id": "603952506330021898",
"name": "mistium"
},
"service": "mistwarp",
"description": {
"en": "MistWarp is a mod of Turbowarp made by Mistium intended for people who just want to squeeze that little bit more out of scratch."
},
"url": "warp.mistium.com",
"regExp": "^https?[:][/][/]([a-z0-9-]+[.])*warp[.]mistium[.]com[/]",
"version": "1.0.0",
"logo": "https://raw.githubusercontent.com/MistWarp/.github/refs/heads/main/logo.png",
"thumbnail": "https://raw.githubusercontent.com/MistWarp/.github/refs/heads/main/thumbnail.png",
"color": "#d399e5",
"category": "other",
"tags": [
"scratch",
"editor",
"turbowarp"
]
}
50 changes: 50 additions & 0 deletions websites/M/mistwarp/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const presence = new Presence({
clientId: '1458217703742378044',
})
const browsingTimestamp = Math.floor(Date.now() / 1000)

enum ActivityAssets {
Logo = 'https://raw.githubusercontent.com/MistWarp/.github/refs/heads/main/logo.png',
}

function handleEditor(presenceData: PresenceData) {
const projectTitleInput = document.querySelector<HTMLInputElement>('[class*="title-field"]')
const projectTitle = projectTitleInput?.value?.trim()

if (projectTitle) {
presenceData.details = `currently editing: ${projectTitle}`
}
}

function handleProject(presenceData: PresenceData) {
const projectTitle = document.querySelector<HTMLHeadingElement>('[class^="author-info_project-title_"]')?.textContent

if (projectTitle) {
presenceData.details = `currently playing: ${projectTitle}`
}
// add a button
presenceData.buttons = [
{
label: 'View Project',
url: window.location.href,
},
]
}

presence.on('UpdateData', async () => {
const presenceData: PresenceData = {
largeImageKey: ActivityAssets.Logo,
startTimestamp: browsingTimestamp,
}

const location = new URL(window.location.href)

if (location.pathname.includes('/editor')) {
handleEditor(presenceData)
}
else if (location.hash.startsWith('#')) {
handleProject(presenceData)
}

presence.setActivity(presenceData)
})
Loading