diff --git a/websites/T/TripSit/metadata.json b/websites/T/TripSit/metadata.json new file mode 100644 index 000000000000..32bffefd8540 --- /dev/null +++ b/websites/T/TripSit/metadata.json @@ -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\\/.*", + "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" + ] +} diff --git a/websites/T/TripSit/presence.ts b/websites/T/TripSit/presence.ts new file mode 100644 index 000000000000..50243a0ee56a --- /dev/null +++ b/websites/T/TripSit/presence.ts @@ -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) +})