-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,21 @@ | ||
{ | ||
"$schema": "https://schemas.premid.app/metadata/1.13", | ||
"apiVersion": 1, | ||
"author": { | ||
"id": "357461892526243840", | ||
"name": "litomore" | ||
}, | ||
"service": "Raycast", | ||
"description": { | ||
"en": "Your shortcut to everything." | ||
}, | ||
"url": ["www.raycast.com", "developers.raycast.com"], | ||
"version": "1.0.0", | ||
"logo": "https://litomore.me/images/raycast-512.png", | ||
"thumbnail": "https://www.raycast.com/opengraph-image-pwu6ef.png", | ||
"color": "#FF6363", | ||
"category": "other", | ||
"tags": [ | ||
"productivity" | ||
] | ||
} |
This file contains 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,76 @@ | ||
const presence = new Presence({ | ||
clientId: '1341778656762134538', | ||
}) | ||
const browsingTimestamp = Math.floor(Date.now() / 1000) | ||
|
||
enum ActivityAssets { | ||
Logo = 'https://litomore.me/images/raycast-512.png', | ||
} | ||
|
||
presence.on('UpdateData', async () => { | ||
const args = document.location.pathname.split('/') | ||
const href = document.location.href | ||
const presenceData: PresenceData = { | ||
largeImageKey: ActivityAssets.Logo, | ||
startTimestamp: browsingTimestamp, | ||
} | ||
|
||
presenceData.details = 'Exploring Raycast' | ||
|
||
if (document.location.hostname === 'www.raycast.com') { | ||
if (document.location.pathname === '/') { | ||
presenceData.details = 'Viewing Home Page' | ||
} | ||
else if (args[1] === 'store') { | ||
presenceData.details = 'Exploring Raycast Store' | ||
} | ||
else if (args[1] === 'pro') { | ||
presenceData.details = 'Learning about Raycast Pro' | ||
} | ||
else if (args[1] === 'teams') { | ||
presenceData.details = 'Learning about Raycast Teams' | ||
} | ||
else if (args[1] === 'developers') { | ||
presenceData.details = 'Learning about Raycast Developers' | ||
} | ||
else if (args[1] === 'changlog') { | ||
presenceData.details = 'Viewing Raycast Changelog' | ||
presenceData.buttons = [{ label: 'View Raycast Changlog', url: href }] | ||
} | ||
else if (args[1] === 'blog') { | ||
presenceData.details = 'Exploring Raycast Blog' | ||
if (args[2]) { | ||
presenceData.details = 'Reading Blog Post' | ||
presenceData.state = document.title | ||
presenceData.buttons = [{ label: 'View Blog Post', url: href }] | ||
} | ||
} | ||
else if (args[1] === 'pricing') { | ||
presenceData.details = 'Checking Raycast Pricing' | ||
} | ||
else if (args[1] === 'extension-issues') { | ||
presenceData.details = 'Checking Extension Issues' | ||
} | ||
else if (args[1] && args[2] && document.querySelector('[class^="ExtensionPage_extensionInstallButton__"]')) { | ||
presenceData.details = 'Viewing Extension' | ||
presenceData.state = document.querySelector('[class^="ExtensionPage_title__"]')?.textContent ?? 'Unknown Extension' | ||
presenceData.buttons = [{ label: 'View Extension', url: href }] | ||
} | ||
else if (args[1] && document.querySelector('[class^="UserProfile_mainInfo__"]')) { | ||
presenceData.details = 'Viewing User Profile' | ||
const username = document.querySelector('[class^="OwnerDetails_nameAndHandle__"] h1')?.textContent ?? '' | ||
const handle = document.querySelector('[class^="OwnerDetails_nameAndHandle__"] h2')?.textContent ?? '' | ||
presenceData.state = [ | ||
username, | ||
handle ? `(${handle})` : '', | ||
].filter(Boolean).join(' ') | ||
presenceData.buttons = [{ label: 'View Profile', url: href }] | ||
} | ||
} | ||
else if (document.location.hostname === 'developers.raycast.com') { | ||
presenceData.details = 'Reading Raycast Developer Docs' | ||
presenceData.state = document.title | ||
presenceData.buttons = [{ label: 'View Documentation', url: href }] | ||
} | ||
presence.setActivity(presenceData) | ||
}) |