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
27 changes: 27 additions & 0 deletions websites/T/TripSit/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://schemas.premid.app/metadata/1.16",
"apiVersion": 1,
"author": {
"id": "538604507064696832",
"name": "talon2"
},
"service": "TripSit",
"altnames": [
"Trip Sit"
],
"description": {
"en": "TripSit is a website that educates people on the misconceptions about drug use and gives people the tools they need for a safer experience. Do not do drugs."
},
"url": "tripsit.me",
"regExp": "https?:\\/\\/(.*\\.)?tripsit\\.me\\/.*",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"regExp": "https?:\\/\\/(.*\\.)?tripsit\\.me\\/.*",
"regExp": "^https?[:][/][/]([a-z0-9-]+[.])*tripsit[.]me[/]",

"version": "1.0.0",
"logo": "https://i.imgur.com/tPoRsMr.png",
"thumbnail": "https://i.imgur.com/ieEcy0K.png",
"color": "#808080",
"category": "other",
"tags": [
"drugs",
"harm-reduction",
"psychonaut"
]
}
90 changes: 90 additions & 0 deletions websites/T/TripSit/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
const browsingTimestamp = Math.floor(Date.now() / 1000)

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

presence.on('UpdateData', async () => {
const rawHostname = document.location.hostname
const hostname = rawHostname.replace(/^www\./, '')
const { pathname, hash } = document.location

const presenceData: PresenceData = {
largeImageKey: 'https://i.imgur.com/tPoRsMr.png',
startTimestamp: browsingTimestamp,
}

/* TripSit main site */
if (hostname === 'tripsit.me') {
if (pathname === '/' && !hash) {
presenceData.details = 'Browsing TripSit'
}
else if (hash === '#about') {
presenceData.details = 'Reading About TripSit'
}
else if (hash === '#resources') {
presenceData.details = 'Browsing Resources'
}
else if (hash === '#faq') {
presenceData.details = 'Reading the FAQ'
}
else if (hash === '#cta') {
presenceData.details = 'Viewing TripSit Volunteering'
}
else if (pathname === '/factsheets') {
presenceData.details = 'Browsing Factsheets'
}
else if (pathname === '/appeal') {
presenceData.details = 'Viewing Ban Appeals'
}
else if (pathname === '/webchat') {
presenceData.details = 'Using Web Chat'
}
else {
presenceData.details = 'Browsing TripSit'
}
}

/* Subdomains */
else if (hostname === 'learn.tripsit.me') {
presenceData.details = 'Using the Learning Portal'
}
else if (hostname === 'dxm.tripsit.me') {
presenceData.details = 'Using the DXM Dosage Calculator'
}
else if (hostname === 'volume.tripsit.me') {
presenceData.details = 'Using the Volumetric Dosing Tool'
}
else if (hostname === 'benzos.tripsit.me') {
presenceData.details = 'Using the Benzodiazepine Dose Converter'
}
else if (hostname === 'uptime.tripsit.me') {
presenceData.details = 'Viewing Service Status'
}
else if (hostname === 'updates.tripsit.me') {
presenceData.details = 'Reading Updates'
}
else if (hostname === 'combo.tripsit.me') {
presenceData.details = 'Reading Drug Combinations'
}

/* TripSit Wiki */
else if (hostname === 'wiki.tripsit.me') {
let articleName: string | null = null

if (pathname.startsWith('/wiki/')) {
articleName = decodeURIComponent(pathname.replace('/wiki/', ''))
.replace(/_/g, ' ')
.trim()
}

presenceData.details = articleName
? `Reading the article "${articleName}"`
: 'Browsing the Wiki'
}
else {
return
}

presence.setActivity(presenceData)
})
Loading