-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(TripSit): add activity #10355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Zinibow
wants to merge
7
commits into
PreMiD:main
Choose a base branch
from
Zinibow:TripSit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(TripSit): add activity #10355
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cf8750a
Added TripSit Activity
Zinibow e357c76
Edited Comments
Zinibow 1930f68
Fixed Thumbnail
Zinibow 9bd838c
Edited Comments
Zinibow 6e738f8
Fix Tag Issue
Zinibow ba4e114
Removed IFrame Stuff
Zinibow f415fea
Merge branch 'main' into TripSit
Zinibow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,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" | ||
| ] | ||
| } | ||
This file contains hidden or 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,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) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.